Commit Graph

24757 Commits

Author SHA1 Message Date
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
Gregory Szorc
704132c0a7 run-tests: don't error when glob matched line ends with backslash
As part of writing another test, I triggered an array index error in
glob match processing code by having a (glob) line end in a single
backslash (which is the escape character).

Adding a simple bounds check prevents the error in run-tests.py.
2015-04-17 14:12:01 -07:00
Durham Goode
71ec25235f histedit: change state format to allow non-hash lines
The existing state serialization format assumed the rule line consisted of an
action and a hash. In our external extension that adds 'exec' this is not the
case (there is no hash, just the shell command). So let's change the format to
be more generic with just an action and a remainder, and the various commands
can handle it as they wish.

Flagged for stable since we want to get this format tweak in before the new
format goes live in the release.
2015-04-17 09:46:43 -07:00
Matt Mackall
c5804a09d6 tests: fix portability issue with test-merge-tools
Not sure how this ever worked.
2015-04-17 15:42:20 -05:00
Matt Harbison
d731476e46 test-rename-merge2: fix test failure on Windows
Windows and OpenVMS use double quote for shell quoting, posix uses
single quote. Since the other test lines added in 3ba9d147e92e don't
include the quotes, this was presumably an oversight.
2015-04-17 12:39:55 -04:00
Matt Harbison
f2dec594fe test-add.t: fix output difference between Windows and OS X (issue4603) 2015-04-17 12:11:14 -04:00
Yuya Nishihara
230c1c62ef tags: do not abort if failed to write lock file to save cache
LockHeld wasn't enough to suppress error during acquiring lock. If .hg directory
is read-only, LockUnavailable will be raised.

  $ chmod ugo-w .hg
  $ hg identify
  abort: could not lock working directory of ...: Permission denied
2015-04-17 23:22:58 +09:00
Matt Mackall
38e6a1d12c Added signature for changeset 84bb5f32dd49 2015-04-16 20:58:41 -05:00
Matt Mackall
0999da5247 tests: fix up whitespace complaint 2015-04-16 20:56:43 -05:00
Matt Mackall
3c00a35039 tests: fix test-tags on vfat
The unix conditional section wasn't cleaning up sufficiently.
2015-04-16 20:52:37 -05:00
Matt Mackall
26612cbb39 tests: ignore sha512 flag in bundle2 for py2.4 2015-04-16 20:31:44 -05:00
Pierre-Yves David
fe42feb68e bundle2-localpeer: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle need to be
processed for outputting their content. This concludes our quest for fixing
issue4594.
2015-04-16 04:01:51 -04:00
Pierre-Yves David
28bc9e7079 bundle2: add on more layer of exception catching in localrepo.unbundle
We are going to add output related logic in this function. We do the
indentation first to help next changeset readability. We need a new try except
because we want to handle output on any exception, including PushRaced ones.
2015-04-16 05:09:37 -04:00
Pierre-Yves David
0bbcf25859 bundle2-wireproto: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle are re-injected
into the bundle carrying the exception.

We still need to fix the situation for non-wireprotocol push.
2015-04-16 03:17:37 -04:00
Pierre-Yves David
e97e706e0f bundle2: refactor error bundle creation for the wireprotocol
We want to add output information to the error bundle. Before doing this, we
rework the code to have a single bundler creation and return statement. This
will make the update with the output simpler as only one place will have to be
touched.
2015-04-16 03:56:50 -04:00
Pierre-Yves David
2d01ad7c2e bundle2: store the salvaged output on the exception object
The re-handling of output is happening in some 'unbundle' callers. We have to
transmit the output information to this place so we stick it on the exception.

This is the third step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output part from the aborted reply
into the exception bundle.
2015-04-16 03:17:01 -04:00
Pierre-Yves David
9291c81ebf bundle2: add a 'salvageoutput' method on bundle20
This method returns a copy of all 'output' parts added to the bundler.

This is the second step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output parts from the aborted reply
into the exception bundle.

The function will be used in a later patch.
2015-04-16 03:16:04 -04:00
Pierre-Yves David
ff72f63d50 bundle2: add a 'copy' method on parts
This is the first step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output parts from the aborted reply
into the exception bundle.

The function will be used in a later patch.
2015-04-16 03:15:28 -04:00
Pierre-Yves David
bfdd8d2ada hooks: add a 'txnabort' hook
This hook will be called whenever a transaction is aborted. This will make it
easy for people to clean up temporary content they may have created during a
transaction.
2015-04-16 05:36:49 -04:00
Pierre-Yves David
ce7797818b help: document the ''HG_TXNID'' environment variable during hooks
We forgot to document the new "transaction ID" mechanism.
2015-04-16 05:41:07 -04:00
Matt Harbison
041a91f971 match: add a subclass for dirstate normalizing of the matched patterns
This class is only needed on case insensitive filesystems, and only
for wdir context matches. It allows the user to not match the case of
the items in the filesystem- especially for naming directories, which
dirstate doesn't handle[1]. Making dirstate handle mismatched
directory cases is too expensive[2].

Since dirstate doesn't apply to committed csets, this is only created by
overriding basectx.match() in workingctx, and only on icasefs.  The default
arguments have been dropped, because the ctx must be passed to the matcher in
order to function.

For operations that can apply to both wdir and some other context, this ends up
normalizing the filename to the case as it exists in the filesystem, and using
that case for the lookup in the other context.  See the diff example in the
test.

Previously, given a directory with an inexact case:

  - add worked as expected

  - diff, forget and status would silently ignore the request

  - files would exit with 1

  - commit, revert and remove would fail (even when the commands leading up to
    them worked):

        $ hg ci -m "AbCDef" capsdir1/capsdir
        abort: CapsDir1/CapsDir: no match under directory!

        $ hg revert -r '.^' capsdir1/capsdir
        capsdir1\capsdir: no such file in rev 64dae27060b7

        $ hg remove capsdir1/capsdir
        not removing capsdir1\capsdir: no tracked files
        [1]

Globs are normalized, so that the -I and -X don't need to be specified with a
case match.  Without that, the second last remove (with -X) removes the files,
leaving nothing for the last remove.  However, specifying the files as
'glob:**.Txt' does not work.  Perhaps this requires 're.IGNORECASE'?

There are only a handful of places that create matchers directly, instead of
being routed through the context.match() method.  Some may benefit from changing
over to using ctx.match() as a factory function:

  revset.checkstatus()
  revset.contains()
  revset.filelog()
  revset._matchfiles()
  localrepository._loadfilter()
  ignore.ignore()
  fileset.subrepo()
  filemerge._picktool()
  overrides.addlargefiles()
  lfcommands.lfconvert()
  kwtemplate.__init__()
  eolfile.__init__()
  eolfile.checkrev()
  acl.buildmatch()

Currently, a toplevel subrepo can be named with an inexact case.  However, the
path auditor gets in the way of naming _anything_ in the subrepo if the top
level case doesn't match.  That is trickier to handle, because there's the user
provided case, the case in the filesystem, and the case stored in .hgsub.  This
can be fixed next cycle.

  --- a/tests/test-subrepo-deep-nested-change.t
  +++ b/tests/test-subrepo-deep-nested-change.t
  @@ -170,8 +170,15 @@
     R sub1/sub2/test.txt
     $ hg update -Cq
     $ touch sub1/sub2/folder/bar
  +#if icasefs
  +  $ hg addremove Sub1/sub2
  +  abort: path 'Sub1\sub2' is inside nested repo 'Sub1'
  +  [255]
  +  $ hg -q addremove sub1/sub2
  +#else
     $ hg addremove sub1/sub2
     adding sub1/sub2/folder/bar (glob)
  +#endif
     $ hg status -S
     A sub1/sub2/folder/bar
     ? foo/bar/abc

The narrowmatcher class may need to be tweaked when that is fixed.


[1] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068183.html
[2] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068191.html
2015-04-12 01:39:21 -04:00
Matt Harbison
8a1b99d29c match: move _normalize() into the match class
This will be overridden in an upcoming patch to also deal with dirstate
normalization on case insensitive filesystems.
2015-04-12 00:29:17 -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
Matt Harbison
cc76d4f63c subrepo: calculate _relpath for hgsubrepo based on self instead of parent
Prior to ef4d6b79dd3a, the subrelpath() (now _relpath) for hgsubrepo was
calculated by removing the root path of the outermost repo from the root path of
the subrepo.  Since the root paths use platform specific separators, and the
relative path is printed by various commands, the output of these commands
require a glob (and check-code.py enforces this).

In an effort to be generic to all subrepos, ef4d6b79dd3a started calculating
this path based on the parent repo, and then joining the subrepo path in .hgsub.
One of the tests in test-subrepo.t creates a subrepo inside a directory, so the
path being joined contained '/' instead of '\'.  This made the test fail with a
'~' status, because the glob is unnecessary[1].  Removing them made the test
work, but then check-code complains.  We can't just drop the check-code rule,
because sub-subrepos are still joined with '\'.  Presumably the other subrepo
types have this issue as well, but there likely isn't a test with git or svn
repos inside a subdirectory.

This simply restores the exact _relpath value (and output) for hgsubrepos prior
to ef4d6b79dd3a.


[1] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068720.html
2015-04-15 11:49:44 -04:00
Matt Harbison
92a80db936 subrepo: backout 2ee77509c828 to restore reporelpath()
The path for hgsubrepo needs to be calculated slightly differently from other
subrepo types, but can reuse this.  See the next patch for details.
2015-04-15 11:23:26 -04:00
Matt Mackall
e8828f848c rollback: clear resolve state (issue4593) 2015-04-16 18:48:20 -05:00
Durham Goode
cd579fe2e0 diff: pass the diff matcher to the copy logic
This passes the existing diff matcher instance down to the copy logic so copy
tracing can be more efficient when possible and only trace copies for matching
files.

This only actually affects forwardcopies (i.e. Given A<-B<-C<-D, it works for
'hg diff -r B -r D foo.txt', but not for 'hg diff -r D -r B foo.txt') since
backward copies require walking all histories, and not just the individual
file's.

This reduces 'hg diff -r A -r B foo.txt' time from 15s to 1s when A and B have
80,000 files different.
2015-04-16 11:31:48 -07: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
Martin von Zweigbergk
35368e1596 treemanifest: extract parse method from constructor
When we start to lazily load submanifests, it will be useful to be
able to create an treemanifest instance before manifest data gets
parsed into it. To prepare for this, extract the parsing code from
treemanifest's constructor to a separate method.
2015-04-12 23:01:18 -07:00
Martin von Zweigbergk
c1ccc70121 manifest: duplicate call to addrevision()
When we start writing submanifests to their own revlogs, we will not
want to write a new revision for a directory if there were no changes
to it. To prepare for this, duplicate the call to addrevision() and
move them earlier where they can more easily be avoided.
2015-04-12 14:37:55 -07:00
Laurent Charignon
8213891de3 record: add message when starting record's curses interface
We are adding this log message to reduce a confusion when a command prints
something just before starting the curses interface.

Since the interactive mode is taking over the entire screen, starts with no
delay and does wait for a key press, the user believes that messages printed
before opening the interactive mode were actually printed after using
interactive mode, not before.
The fix adds the line "Starting interactive mode" helping the user separate
the messages that were printed before and after the start of the
interactive mode.

One particular example where this was a problem is the revert command where we
first print the list of changes to be considered for revert, then opens the
curses interface right away without letting the user see the messages.
The user then selects the changes, validates and then see the messages from
before opening the interactive mode and is confused.
2015-04-16 14:26:50 -07:00
Mathias De Maré
3f5d166a19 subrepo: add include/exclude support for diffing git subrepos
Previously, git subrepos were ignored if any type of path selection
was done.
This can be solved by using subrepo status and filtering matching files.
2015-04-14 20:09:56 +02:00
Yuya Nishihara
eae9526460 revset: undocument wdir() until its command outputs get stable
wdir() implementation is still incomplete and shouldn't be advertised to
users. This patch will be backed out when

 - template values such as {rev} and {node} are settled
 - major commands and revsets work without crashing
2015-04-12 19:00:31 +09:00
Matt Mackall
4b6771a9f8 linkrev: fix issue with annotate of working copy
The introrev was appearing as None in new annotate tests, which the
code from the stable branch wasn't expecting.
2015-04-16 18:30:08 -05:00
Matt Mackall
9483b9f214 merge with stable 2015-04-16 17:30:01 -05:00
Yuya Nishihara
3af3ee9d07 annotate: always prepare ancestry context of base fctx (issue4600)
This patch extends the workaround introduced by d5844c5f6c7b. Even if the
base fctx is the same as intorrev, _ancestrycontext must be built for faster
_changeid lookup.

repo:    https://hg.mozilla.org/releases/mozilla-beta
command: hg annotate -r 4954faa47dd0 gfx/thebes/gfxWindowsPlatform.cpp
before:  52.450 sec
after:    1.820 sec
2015-04-16 22:33:53 +09:00
Martin von Zweigbergk
87d497396a dirstate.walk: don't report same file stat multiple times
dirstate.walk() generates pairs of filename and a stat-like
object. After "hg mv foo Foo", it generates one pair for "foo" and one
for "Foo", as it should. However, on case-insensitive file systems,
when it tries to stat to get the disk state as well, it gets the same
stat result for both names. This confuses at least
scmutil._interestingfiles(), making it think that "foo" was forgotten
rather than removed. That, in turn, makes "hg addremove" add "foo"
back, resulting in both cases in the dirstate, as reported in
issue4590.

This change only takes care of the "if unknown" branch. A similar fix
should perhaps be applied to the other branch.
2015-04-04 21:54:12 -07:00
Durham Goode
7f3a86f2d3 histedit: delete all non-actionclass related code
Now that all actions have been migrated to the class format, we can delete all
the unnecessary code that supported the old function format.
2015-04-04 02:16:48 -07:00
Durham Goode
adafa999c2 histedit: improve roll action integration with fold
Previously the fold action would inspect it's class to figure out if it was a
rollup or not. This was hacky. Now that finishfold is inside the fold class,
let's modify it to check a function (which roll can override) to determine if it
should be prompting for a commit message.
2015-04-04 02:12:53 -07:00
Durham Goode
e4084f95da histedit: move finishfold into fold class
Let's move the finishfold function into the fold class so we can modify it from
the roll class more easily.
2015-04-04 02:12:24 -07:00
Durham Goode
cdb6754f26 histedit: convert fold/roll actions into a class
This converts the fold/roll actions into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.

The tests changed for two reasons:

1) We get a new 'empty changeset' warning because we now warn more consistently
between normal histedit and --continue about commits disappearing.

2) Previously we were not putting the histedit-source extra field on the
temporary fold commit during normal runs, but we were on --continue runs. By
unifying these code paths we now consistently put histedit-source on the
temporary fold commit, which changes some of the hashes in the backup bundles.
2015-04-04 02:03:27 -07:00
Durham Goode
162b56f0ee histedit: convert edit action into a class
This converts the edit action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.
2015-04-04 01:00:51 -07:00
Durham Goode
3c8163667a histedit: convert message action into a class
This converts the message action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.
2015-04-04 00:42:32 -07:00
Durham Goode
9f8ec725b7 histedit: convert drop action into a class
This converts the drop action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.
2015-04-04 00:30:01 -07:00
Durham Goode
e59cce69af histedit: convert pick action into a class
This converts the pick action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.

The test output changed because previously pick would only report the commit
disappearing if there were no merge conflicts. Now that we've unified the normal
and the --continue flows, they act the same and we get the warning even after
--continue.
2015-04-04 11:39:08 -07:00
Durham Goode
0cfabb416a histedit: integrate action class into flow
This takes the newly added histeditaction class and integrates it into the
histedit run and bootstrapcontinue logic. No actions implement the class yet,
but they will be add in upcoming patches.
2015-04-04 11:37:08 -07:00
Durham Goode
2da5a94d9a histedit: add a new histeditaction class
This adds a new class called histeditaction. It represents a single action in a
histedit plan. Future patches will integrate it into the histedit flow, then
convert each existing action in to the class form one by one.

This is part of a larger refactor aimed at increasing histedit robustness,
maintainability, and extensibility.
2015-04-04 11:34:53 -07:00
Durham Goode
8cf27316ea histedit: allow histedit --continue when not on a descendant (BC)
Previously we would not allow --continue if the current working copy parent was
not a descendant of the commit produced by the previous histedit step. There's
nothing really blocking us from continuing the histedit in this situation, so
let's stop aborting in this case.

This is technically a BC change, but it is making things more forgiving so I
think it's ok.

In the future we will likely add an 'exec' action to histedit, which means the
user can do whatever they want during the middle of a histedit (like perhaps
calling 'hg update'), which means we'll need to support this case eventually
anyway.
2015-04-04 01:00:05 -07:00
Gregory Szorc
7af3081f5e tags: explicitly log which tags cache file is being written
We now have multiple tags cache files. Record exactly which file is
being written. This should help aid debugging into performance issues
with any single filter.
2015-04-16 11:59:36 -04:00