Commit Graph

335 Commits

Author SHA1 Message Date
Bryan O'Sullivan
e41ff99cd6 with: use context manager for wlock in mergeupdate 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
ab04c813f9 with: use context manager for wlock in overridepurge 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
070b1b5491 with: use context manager for wlock in cmdutilforget 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
b83485ed82 with: use context manager for wlock in overriderevert 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
3538da229b with: use context manager for wlock in removelargefiles 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
ccc94927e6 with: use context manager for wlock in addlargefiles 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
ebfc6943c7 largefiles: use util.readfile in overrides 2016-01-12 14:29:34 -08:00
Siddharth Agarwal
2584b69484 merge: add a new 'backup' argument to get actions
We're going to use this in an upcoming patch to back untracked files up when
they're replaced by tracked ones.
2016-01-02 03:02:57 -08:00
FUJIWARA Katsunori
4d06739a86 revset: use delayregistrar to register predicate in extension easily
Previous patch introduced 'revset.predicate' decorator to register
revset predicate function easily.

But it shouldn't be used in extension directly, because it registers
specified function immediately. Registration itself can't be restored,
even if extension loading fails after that.

Therefore, registration should be delayed until 'uisetup()' or so.

This patch uses 'extpredicate' decorator derived from 'delayregistrar'
to register predicate in extension easily.

This patch also tests whether 'registrar.delayregistrar' avoids
function registration if 'setup()' isn't invoked on it, because
'extpredicate' is the first user of it.
2015-12-29 23:58:30 +09:00
Augie Fackler
a84cc516e7 merge: restate calculateupdates in terms of a matcher
Once we get a matcher down into manifestmerge, we can make narrowhg
work more easily and potentially let manifest.match().diff() do less
work in manifestmerge.
2015-12-14 20:37:41 -05:00
Augie Fackler
0a19647501 merge: have merge.update use a matcher instead of partial fn
This is relatively rarely used functionality, but migrating this to a
matcher will make future work on narrow clones more feasible.
2015-12-14 18:54:03 -05:00
Siddharth Agarwal
f5d6c8e713 largefiles: fall back to the original for change/delete conflicts
The largefiles merge code (currently) does not handle change/delete conflicts.
So fall back to regular filemerge in that case.

Making this code handle change/delete conflicts is left as an exercise for the
future.
2015-11-18 17:40:13 -08:00
Siddharth Agarwal
4904ded295 filemerge: return whether the file was deleted
This is required for change/delete conflict resolution -- see previous patches
for more details.
2015-11-18 14:22:52 -08:00
Siddharth Agarwal
5d41145967 merge: make 'cd' and 'dc' actions store the same arguments as 'm'
We're going to treat these conflicts similarly to merge conflicts, and this
change to the way we store things in memory makes future code a lot simpler.
2015-11-13 22:43:09 -08:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
Siddharth Agarwal
dd90f817f9 filemerge: introduce a premerge flag and function
This flag will let us get to our overall goal of performing all premerges
before any merges.
2015-10-11 20:47:04 -07:00
Siddharth Agarwal
82f2aec334 filemerge: also return whether the merge is complete
In future patches, we'll pause merges after the premerge step. After the
premerge step we'll return complete = False.
2015-10-11 12:56:21 -07:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Matt Mackall
eb810eca5f merge with stable 2015-10-01 12:17:46 -05:00
Matt Harbison
f5215c2c04 largefiles: restore archiving largefiles with hgweb (issue4859)
This regressed in f07f4c45a8f2, when trying to conditionally disable archiving
of largefiles.

I'm not sure if wrapfunction() is the right way to do this, but it seems to
work.  The mysterious issue with lfstatus getting out of sync in the proxy and
the unfiltered view crops up again here.  See the referenced cset for more info.
2015-09-29 23:29:44 -04:00
Pierre-Yves David
a551464cdd largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:49:02 -07:00
Pierre-Yves David
ffcbdf7cc8 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:48:24 -07:00
Pierre-Yves David
cdc21e7de4 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:48:02 -07:00
Pierre-Yves David
4838705431 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:46:37 -07:00
Pierre-Yves David
40bf417522 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:46:12 -07:00
Pierre-Yves David
ef62bb6e54 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:44:59 -07:00
Pierre-Yves David
4dc7b8ccac largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:44:32 -07:00
Pierre-Yves David
a7ba280694 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:41:43 -07:00
Pierre-Yves David
28f9483962 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:40:53 -07:00
Matt Harbison
66766c7b03 largefiles: allow the archiving of largefiles to be disabled
There are currently no users of this, but it is a necessary step before
converting extdiff to use archive.  It may be useful to add an argument to
extdiff in the future and allow largefiles to be diffed, but archiving
largefiles can have significant overhead and may not be very diffable, so
archiving them by default seems wrong.

It is a mystery to me why the lfstatus attribute needs to be set on the
unfiltered repo.  However if it is set on the filtered repo instead (and the
filtered repo is passed to the original command), the lfstatus attribute is
False in the overrides for archival.archive() and hgsubrepo.archive() when
invoking the archive command.  This smells like the buggy status behavior (see
9fc565fa1621, which was reverted in e1574a4a2cad).  Neither the status nor
summary commands have this weird behavior in their respective overrides.
2015-07-11 23:26:33 -04:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Gregory Szorc
3aa1c73868 global: mass rewrite to use modern octal syntax
Python 2.6 introduced a new octal syntax: "0oXXX", replacing "0XXX". The
old syntax is not recognized in Python 3 and will result in a parse
error.

Mass rewrite all instances of the old octal syntax to the new syntax.

This patch was generated by `2to3 -f numliterals -w -n .` and the diff
was selectively recorded to exclude changes to "<N>l" syntax conversion,
which will be handled separately.
2015-06-23 22:30:33 -07:00
Matt Harbison
0dc20be5d4 archive: support 'wdir()'
This is a step toward replacing the extdiff internals with archive, in order to
support 'extdiff -S'.  Only Mercurial subrepos are supported for now.

If a file is missing from the filesystem, it is silently skipped.  Perhaps it
should warn, but it cannot abort when working with extdiff because deleting a
file is a legitimate diff.
2015-06-16 23:06:57 -04:00
Matt Harbison
39e618db88 scmutil: add an optional parameter to matcher factories for a bad() override
Even though scmutil.matchandpats() is documented to warn about bad files,
several callers silence the warning.
2015-06-05 19:24:32 -04:00
Matt Harbison
cb8f521952 largefiles: replace match.bad() monkey patching with match.badmatch()
No known issues with the previous code since it restored the original method,
but this is cleaner.

The monkey patching in cat is harmless, because it is created locally, and
doesn't pass it anywhere (subrepo cat isn't supported with largefiles).
2015-06-04 22:11:18 -04:00
Drew Gottlieb
04e229c0e2 match: rename _fmap to _fileroots for clarity
fmap isn't a very descriptive name for the set of the match's files.
2015-05-08 12:30:51 -07:00
Matt Mackall
8e5f3996ed largefiles: use try/except/finally 2015-05-15 09:55:15 -05:00
Matt Harbison
45986628ce largefiles: drop os.path.join() in subrepo archive override
This is related to df069d92be27, but not required for that to function correctly
because 'prefix' always ends with '/', so os.path.join(prefix, _path) simply
concatenates the strings.  Take the opportunity to drop the os.path usage, and
avoid confusion by using the same pattern as the overridden subrepo method.
2015-05-04 23:04:12 -04:00
Matt Harbison
4ce249627a largefiles: don't mangle filesets when fixing up the log matcher
The fileset-generated.t test previously failed with this:

  +  hg: parse error: unknown identifier: .hglf/modified
  +  (did you mean 'modified'?)
  +  [255]

Filesets will find the standins on their own, without any help.  While that's
useful for some things like modified(), clean(), etc., it is wrong for things
like size().  Proper fileset support for largefiles is not trivial, but this was
failing with just the extension enabled on a normal repo.
2015-04-18 13:08:41 -04:00
Matt Harbison
72ef386079 largefiles: don't crash when cloning to a remote repo
The immediate crash was when checking for requirements immediately after this,
but lfcommands.downloadlfiles() will also crash if --all-largefiles is
specified.  That has been in place since atleast e01343f7da6f (2.3-rc) without
anyone noticing.

I can't tell from the peer classes if there's a way to make the custom largefile
functionality work in this case, but atleast it doesn't crash.
2015-04-18 00:34:38 -04:00
Mads Kiilerich
4e94ae8e25 largefiles: always consider updatelfiles 'checked' parameter set
mergeupdate already set the flag to update all. This will thus only change
overriderevert and scmutilmarktouched ... where the flag effectually also were
true. The test coverage thus shows no change.

As the flag always is set, it is removed.

This is mainly a change for keeping the code simple and consistent and correct,
but it should also make it faster in many cases.
2015-01-17 03:34:57 +01:00
Mads Kiilerich
45a6e1e82f largefiles: for update -C, only update largefiles when necessary
Before, a --clean update with largefiles would use the "optimization" that it
didn't read hashes from standin files before and after the update. Instead of
trusting the content of the standin files, it would rehash all the actual
largefiles that lfdirstate reported clean and update the standins that didn't
have the expected content. It could thus in some "impossible" situations
automatically recover from some "largefile got out sync with its standin"
issues (even there apparently still were weird corner cases where it could
fail). This extra checking is similar to what core --clean intentionally do
not do, and it made update --clean unbearable slow.

Usually in core Mercurial, --clean will rely on the dirstate to find the files
it should update. (It is thus intentionally possible (when trying to trick the
system or if there should be bugs) to end up in situations where --clean not
will restore the working directory content correctly.) Checking every file when
we "know" it is ok is however not an option - that would be too slow.

Instead, trust the content of the standin files. Use the same logic for --clean
as for linear updates and trust the dirstate and that our "logic" will keep
them in sync. It is much cheaper to just rehash the largefiles reported dirty
by a status walk and read all standins than to hash largefiles.

Most of the changes are just a change of indentation now when the different
kinds of updates no longer are handled that differently. Standins for added
files are however only written when doing a normal update, while deleted and
removed files only will be updated for --clean updates.
2015-04-15 15:22:16 -04:00
Durham Goode
610230ad03 copies: add matcher parameter to copy logic
This allows passing a matcher down the pathcopies() stack to _forwardcopies().
This will let us add logic in a later patch to avoid tracing copies when not
necessary (like when doing hg diff -r 1 -r 2 foo.txt).
2015-04-16 11:29:30 -07:00
Yuya Nishihara
1209d3b6f0 largefiles: use common function to build content of .hg_archival.txt
This fixes the missing "changessincelatesttag" field introduced by
7203a55cb648.
2015-04-08 22:42:37 +09:00
Drew Gottlieb
6d2651f8ba treemanifest: optimize treemanifest._walk() to skip directories
This makes treemanifest.walk() not visit submanifests that are known not to
have any matching files. It does this by calling match.visitdir() on
submanifests as it walks.

This change also updates largefiles to be able to work with this new behavior
in treemanifests. It overrides match.visitdir(), the function that dictates
how walk() and matches() skip over directories.

The greatest speed improvements are seen with narrower scopes. For example,
this commit speeds up the following command on the Mozilla repo from 1.14s
to 1.02s:
  hg files -r . dom/apps/

Whereas with a wider scope, dom/, the speed only improves from 1.21s to 1.13s.

As with similar a similar optimization to treemanifest.matches(), this change
will bring out even bigger performance improvements once treemanifests are
loaded lazily. Once that happens, we won't just skip over looking at
submanifests, but we'll skip even loading them.
2015-04-07 15:18:52 -07:00
Martin von Zweigbergk
3e235a01ca log: prefer 'wctx' over 'pctx' for working context 2015-03-18 21:44:25 -07:00
FUJIWARA Katsunori
5359d785ec largefiles: remove useless overrideupdate
Now, "overrideupdate()" wrapping "hg update" is useless, because
"workingctx.dirty() and raising Abort" in "hg update" was replaced by
"cmdutil.bailifchanged()" in the previous patch, and the latter can
detect changes of largefiles in the working directory.
2015-03-25 13:55:35 +09:00
FUJIWARA Katsunori
9592a103f7 cmdutil: allow bailifchanged to ignore merging in progress
In "commands.update()", "cmdutil.bailifchanged()" isn't used for
"abort if the working directory is dirty", because it forcibly
examines about merging in progress.

"workingctx.dirty()" used in "commands.update()" can't detect changes
of largefiles in the working directory without "repo.lfstatus = True"
wrapping. This is only reason of "commands.update()" wrapping by
largefiles extension.

On the other hand, "cmdutil.bailifchanged()" already wrapped by
largefiles extension can detect changes of largefiles.

This patch is a preparations for replacing "workingctx.dirty()" and
raising Abort in "commands.update()" by "cmdutil.bailifchanged()". It
can remove redundant "commands.update()" wrapping.
2015-03-25 13:55:35 +09:00
Martin von Zweigbergk
5adcba3667 revert: evaluate filesets against working directory (issue4497)
As the failing revert tests in test-fileset-generated.t show,

Revert currently creates one matcher for matching files in the working
copy and another matcher for matching files in the target
revision. The two matchers are created with different contexts, which
means filesets are evaluated differently. Then the union of the sets
of files matching the matchers in the two contexts are reverted. It
doesn't seem to make sense to use two different matchers; only the
context they're applied to should be different.

It seems very likely that the user wants the filesets to be evaluated
against the working directory, which the tests
test-fileset-generated.t also assume, so let's make it so.

I willingly admit that the largefiles code was modified by trial and
error (according to tests).
2015-03-23 23:04:51 -07:00
Martin von Zweigbergk
0ff6b06eb6 largefiles: extract and reuse 'standin' variable in overriderevert() 2015-03-24 10:27:56 -07:00