Commit Graph

54 Commits

Author SHA1 Message Date
Augie Fackler
2316255c71 largefiles: stop using <> operator in favor of !=
<> has been deprecated for a while, and != is futureproof
2013-01-01 13:04:40 -06:00
Mads Kiilerich
f356c36feb largefiles: remove trivial portability wrappers 2012-12-13 19:19:06 +01:00
Mads Kiilerich
59edc6b723 largefiles: remove findoutgoing portability wrapper 2012-12-13 19:19:06 +01:00
Mads Kiilerich
c4f44002f9 largefiles: unindent code 2012-12-28 11:55:57 +01:00
Mads Kiilerich
38f4eda033 largefiles: simplify lfdirstate ignore handling - it is only for tracking .hglf 2012-12-13 19:19:06 +01:00
Mads Kiilerich
e973341bd0 largefiles: remove overly complex handling of ignored and unknown files 2012-12-13 19:19:06 +01:00
Mads Kiilerich
056fcbf2bc merge with stable 2012-12-28 11:55:45 +01:00
Mads Kiilerich
82c7e260df largefiles: don't walk through all ignored files
Problem: 'hg status' with largefiles enabled would walk through all the files
that .hgignore said should be ignored. That made it slow if a lot of files were
.hgignored or the cache was cold.

It seems like there was a reason to this, but other improvements has rendered
this unnecessary.

Solution: .hgignore is now only ignored when that is requested (--ignore).

This is a minimal 'stable' change. There is room for other improvement.
2012-12-13 19:19:06 +01:00
Mads Kiilerich
f9eedbbdd4 largefiles status: update lfdirstate with result from cleanliness check
Problem: 'hg status' kept checking largefiles with an unknown state until some
other command wrote the updated dirstate.

Solution: Add missing lfdirstate.write().
2012-12-13 19:19:06 +01:00
Levi Bard
5ac6c21477 largefiles: commit directories that only contain largefiles (issue3548)
If we pass a directory to commit whose only commitable files
are largefiles, the core commit code aborts before finding
the largefiles.
So we do the following:
For directories that only have largefiles as matches,
we explicitly add the largefiles to the matchlist and remove
the directory.
In other cases, we leave the match list unmodified.
2012-12-10 14:58:42 +01:00
Mads Kiilerich
2d06a8beab merge with stable 2012-12-13 21:34:55 +01:00
Pierre-Yves David
5ccc6bfa9a clfilter: rename unfilteredmeth to unfilteredmethod
As originally intended.
2012-11-30 22:34:21 +01:00
Pierre-Yves David
afde19de6d largefile: status is buggy on repoproxy, so run unfiltered
For some yet-unkown reason, largefile status does not work on
repoproxy. As status is not affected by filtering, we run it unfiltered.

Na'Tosha Bard's view on this issue:

    "but, well, largefiles status is kind of an unholy piece of code"
2012-10-08 18:11:56 +02:00
Pierre-Yves David
dc4260df80 largefile: use self in repo method instead of repo
Most method added (or overwritten) to repo by largefile works on `repo`
instead of `self`. This currently works without trouble because `self` and
`repo` are likely the same. However this is semantically dubious and this may
cause issue for filtering. `self` may be proxy object different from the `repo`
one.

This changeset fix that and use `self` when applicable.
2012-10-08 15:41:58 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Matt Harbison
f0d41a8692 largefiles: defer lfdirstate.drop() until after commit (issue3364)
The example in comment #9 of the bug writeup must be run exactly- it was the
commit after the rm and prior to the addremove that screwed things up, because
that commit noticed that the largefile was missing, called drop(), and then the
original commit function did nothing (due to the file in the '!' state).  The
addremove command properly put it into the 'R' state, but it remained stuck in
that state (because commit insisted 'nothing changed').  Without the commit
prior to addremove, the problem didn't occur.

Maybe this is an indication that lfdirstate needs to take a few more hints from
the regular dirstate, regardless of what _it_ thinks the state is- similar
inconsistency is probably still possible with this patch if the original commit
succeeds but the lfdirstate write fails.
2012-07-19 10:00:15 -04:00
Na'Tosha Bard
b035ee4c71 largefiles: fix addremove when largefile is missing (issue3227) 2012-05-13 12:11:50 +02:00
Patrick Mezard
9b4af94333 largefiles: fix "hg status dir" missing regular files (issue3421)
largefiles status implementation attemps to rewrite the input match objects to
match the "standins" as well as the regular files. When fixing the directories
listed in match.files(), if there was related standin entry, it was kept and
the original path discarded. But directories can appear both as regular and
standin entries.
2012-05-06 13:14:58 +02:00
Na'Tosha Bard
da576e6ebb largefiles: fix commit of both largefiles and non-largefiles (issue3354)
This bug was caused by some old code that should have been removed long ago.
2012-05-03 15:24:45 +02:00
Matt Mackall
9b533bc599 merge with stable 2012-03-26 16:42:53 -05:00
FUJIWARA Katsunori
a3e4d70aa4 largefiles: use 'dirstate.dirs()' for 'directory pattern' relation check
original implementation queries whether specified pattern is related
or not to largefiles in target context by 'dirstate.__contains__()'.

but this can't recognize 'directory pattern' correctly, so this patch
uses 'dirstate.dirs()' for it.

this patch uses dirstate instead of lfdirstate in 'working' route
(second patch hunk for 'hgext/largefiles/reposetup.py'), because
'dirs()' information may be already built for dirstate but not yet for
lfdirstate at this point. this prevents lfdirstate from building up
and having 'dirs()' information.
2012-03-22 23:58:47 +09:00
FUJIWARA Katsunori
74e7c5bd04 largefiles: suppress unexpected warning of 'hg status' for removed files
original implementation queries whether specified pattern is related
or not to largefiles, to target context.

but changectx/workingctx returns False about relationship with files
marked as removed.

So, 'hg status' with 'file pattern' for removed file shows unexpected
warning message in below process:

    1. 'tostandin()' returns non-STANDIN filename for removed file,
       because changectx/workingctx returns False about relationship
       with it

    2. 'match.files()' contains non-STANDIN filename, which is already
       removed from working directory

    3. 'dirstate.walk()' invoked via 'localrepository.status()' treats
       non-STANDIN filename as bad filename, because there is no entry
       for it in dirstate: only STANDIN is managed in dirstate

    4. 'dirstate.walk()' invokes 'match.bad()', which is defined in
       'localrepository.status()' as 'bad()'

    5. 'bad()' shows warning message for non-STANDIN, because it is
       not related to source context: only STANDIN is related to it

this patch queries to dirstate instead of changectxt/workingctx,
because dirstate returns expected result for removed files.

'match.files()' is used by 'localrepository.status()' only in
'working' case, so this patched code also works correctly in
non-'working' case.
2012-03-22 23:58:47 +09:00
Na'Tosha Bard
c51d8441de largefiles: fix check-code errors. 2012-03-09 17:11:07 +01:00
Na'Tosha Bard
65205ee295 largefiles: remove use of underscores that breaks coding convention 2012-03-09 16:11:52 +01:00
Dan Villiom Podlaski Christiansen
83af46e848 largefiles: don't break filesets 2012-02-20 17:59:48 +01:00
FUJIWARA Katsunori
c3838f8d3f largefiles: check whether specified patterns are related to largefiles strictly
current 'lfiles_repo.status()' implementation examines whether
specified patterns are related to largefiles in working directory (not
to STANDIN) or not by NOT-EMPTY-NESS of below list:

    [f for f in match.files() if f in lfdirstate]

but it can not be assumed that all in 'match.files()' are file itself
exactly, because user may only specify part of path to match whole
under subdirectories recursively.

above examination will mis-recognize such pattern as 'not related to
largefiles', and executes normal 'status()' procedure. so, 'hg status'
shows '?'(unknown) status for largefiles in working directory unexpectedly.

this patch examines relation of pattern to largefiles by applying
'match()' on each entries in lfdirstate and checking wheter there is
no matched entry.

it may increase cost of examination, because it causes of full scan of
entries in lfdirstate.

so this patch uses normal for-loop instead of list comprehensions, to
decrease cost when matching is found.
2012-02-15 23:01:09 +09:00
Na'Tosha Bard
e63a87cfd7 largefiles: fix transplant for all cases (issue3192) 2012-01-25 14:10:01 +01:00
Dan Villiom Podlaski Christiansen
b83792b911 largefiles: factor out a copyalltostore() function 2012-01-08 14:33:10 +01:00
Levi Bard
745707ea8a largefiles: fix inappropriate locking (issue3182)
Don't lock/write on operations that should be readonly (status).
Always lock when writing the lfdirstate (rollback).
Don't write lfdirstate until after committing; state isn't actually changed
until the commit is complete.
2012-01-07 19:05:59 +01:00
Na'Tosha Bard
0bbf2e33ad largefiles: correctly handle dirstate status when rebasing
When rebasing, we need to trust that the standins are always correct. The
rebase operation updates the standins according to the changeset it is
rebasing. We need to make the largefiles in the working copy match.  If we
don't make them match, then they get accidentally reverted, either during
the rebase or during the next commit after the rebase.

This worked previously only becuase we were relying on the behavior that
largefiles with a changed standin, but unchanged contents, never showed up in
the list of modified largefiles.  Unfortunately, pre-commit hooks can get
an incorrect status this way, and it also results in extra execution of code.

The solution is to simply trust the standins when we are about to commit a
rebased changeset, and politely ask updatelfiles() to pull the new contents
down.  In this case, updatelfiles() will also mark any files it has pulled
down as dirty in the lfdirstate so that pre-commit hooks will get correct
status output.
2012-01-07 18:43:34 +01:00
Levi Bard
68127050e4 largefiles: Fix parser warning: redefinition of unused 'node' from line 14 2012-01-08 11:23:21 +01:00
Dan Villiom Podlaski Christiansen
175ef36b21 largefiles: remove a chunk of commented out code 2012-01-07 15:27:34 +01:00
Matt Mackall
7cf4e6eacb merge with stable 2011-12-16 19:05:59 -06:00
Na'Tosha Bard
112b1abe18 largefiles: optimize status when files are specified (issue3144)
This fixes a performance issue with 'hg status' when files are specified
on the command-line.  Previously, a large amount of largefiles code was
executed, even if files were specified on the command-line and those files
were not largefiles.  This patch fixes the problem by first checking if
non-largefiles were specified on the command-line and, just letting the
normal status function handle the case if they were.

On a brand new machine, the execution time for 'hg status filename' on
a repository with largefiles was:

real    0m0.636s
user    0m0.512s
sys     0m0.120s

versus the following (the same repository, with largefiles disabled):

real    0m0.215s
user    0m0.180s
sys     0m0.032s

After this patch, the performance of 'hg status filename' on the same
repository, with largefiles enabled is:

real    0m0.228s
user    0m0.189s
sys     0m0.036s

This performance boost is also true when patterns (rather than specific
files) are specified on the command-line.

In the case where patterns are specified in addition to a file list, we
just defer to the normal codepath in order to not spend extra time
expanding the patterns to just risk having to expand them again later.
2011-12-15 16:23:26 +01:00
Martin Geisler
19be7012dc largefiles: handle merges between normal files and largefiles (issue3084)
The largefiles extension prevents users from adding a normal file
named 'foo' if there is already a largefile with the same name.
However, there was a loop-hole: when merging, it was possible to bring
in a normal file named 'foo' while also having a '.hglf/foo' file.

This patch fixes this by extending the manifest merge to deal with
these kinds of conflicts. If there is a normal file 'foo' in the
working copy, and the other parent brings in a '.hglf/foo' file, then
the user will be prompted to keep the normal file or the largefile.
Likewise for the symmetric case where a normal file is brought in via
the second parent. The prompt looks like this:

  $ hg merge
  foo has been turned into a largefile
  use (l)argefile or keep as (n)ormal file?

After the merge, either the '.hglf/foo' file or the 'foo' file will
have been deleted. This would cause status to return output like:

  $ hg status
  M foo
  R foo

To fix this, the lfiles_repo.status method is changed so that a
removed normal file isn't shown if there is largefile with the same
name, and vice versa for largefiles.
2011-12-09 17:35:00 +01:00
Martin Geisler
3a9a310829 largefiles: fix 'hg status' abort after merge
If a largefile is introduced on the branch that is merged into the
working copy, then 'hg status' would abort with an error like:

   $ hg status
   abort: .hglf/foo@33fdd332ec: not found in manifest!

The problem was that the largefiles status code only looked in the
first parent for the largefile. Largefiles are now always reported as
modified if they don't exist in the first parent -- this matches the
behavior of localrepo.status for normal files.
2011-12-09 17:34:58 +01:00
Martin Geisler
f89c093d08 merge with stable 2011-12-09 17:58:12 +01:00
Martin Geisler
1fbdd9520a largefiles: use lfutil functions
Using regular expressions to cut off a (fixed) string prefix is overly
complicated and wasteful.
2011-12-09 17:34:57 +01:00
Martin Geisler
9b8776da45 largefiles: remove pre-1.7 compatibility code
Mercurial 1.7 added the --subrepos flag to status and archive and the
largefiles code was still compatible with the old method signatures.
2011-12-07 16:25:51 +01:00
Na'Tosha Bard
15aa924ecd largefiles: optimize performance of status on largefiles repos (issue3136) 2011-12-07 12:56:44 +01:00
Matt Mackall
2f72e8b497 largefiles: avoid checking requirements on every command
When largefiles is enabled, commands on large repositories which don't
require largefiles could be slowed down substantially. Disable
checking this for every command.
2011-10-29 17:38:13 -05:00
Benjamin Pollack
164bde4288 largefiles: remove redundant any_ function 2011-10-19 20:40:55 -04:00
Benjamin Pollack
417391117f largefiles: rename functions and methods to match desired behavior
The original intent was that the largefiles would primarily be in the
repository, with the global cache being only that--a cache.  The naming
conventions and actual intent have both strayed.  In this first patch, the
naming conventions are switched to match the actual intent, as are the
configuration options.
2011-10-20 13:24:09 -04:00
Eli Carter
d76a96462f largefiles: remove 1.9 compat code 2011-10-19 15:37:03 -05:00
Greg Ward
522fc48c21 largefiles: tidy imports
- no need to defensively import scmutil
- remove duplicate
- unwrap non-long line
2011-10-16 10:29:51 -04:00
Greg Ward
9201e11906 largefiles: cosmetics, whitespace, code style
This is mainly about keeping code under the 80-column limit with as
few backslashes as possible. I am deliberately not making any logic or
behaviour changes here and have restrained myself to a few "peephole"
refactorings.
2011-10-13 21:42:54 -04:00
Greg Ward
f01e46c64d largefiles: more work on cleaning up comments
- always say "largefile", not "lfile"
- cleanup mangled syntax, hopefully correctly
  (punctuation: it's your friend!)
- wrap to 75 columns (where feasible)
2011-10-13 20:45:49 -04:00
Greg Ward
8b7a685468 largefiles: improve error reporting
- tweak wording of some error messages
- use consistent capitalization
- always say 'largefile', not 'lfile'
- fix I18N problems
- only raise Abort for errors the user can do something about
2011-10-13 20:24:29 -04:00
Greg Ward
5f73b6d815 largefiles: improve comments, internal docstrings
- fix some ungrammatical/unclear/incorrect comments/docstrings
- rewrite some really unclear comments/docstrings
- make formatting/style more consistent with the rest of Mercurial
  (lowercase without period unless it's really multiple sentences)
- wrap to 75 columns
- always say "largefile(s)", not "lfile(s)" (or "big files")
- one space between sentences, not two
2011-10-12 20:59:27 -04:00
Na'Tosha Bard
6b1f4db174 largefiles: speed up commit by only rewriting standins for modified largefiles 2011-10-13 12:11:25 +02:00