Commit Graph

8836 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
0a80b7e42b tests: add extension to emulate invoking internalpatch at the specific time
This extension fakes "mtime" of patched files to emulate invoking
'patch.internalpatch()' at the specific time.

This is useful to reproduce timing critical issues fixed in subsequent
patches.
2015-07-08 17:01:09 +09:00
FUJIWARA Katsunori
51754ba82b context: write dirstate out explicitly after marking files as clean
To detect change of a file without redundant comparison of file
content, dirstate recognizes a file as certainly clean, if:

  (1) it is already known as "normal",
  (2) dirstate entry for it has valid (= not "-1") timestamp, and
  (3) mode, size and timestamp of it on the filesystem are as same as
      ones expected in dirstate

This works as expected in many cases, but doesn't in the corner case
that changing a file keeps mode, size and timestamp of it on the
filesystem.

The timetable below shows steps in one of typical such situations:

  ---- ----------------------------------- ----------------
                                           timestamp of "f"
                                           ----------------
                                           dirstate   file-
  time          action                     mem  file  system
  ---- ----------------------------------- ---- ----- -----
  N                                              -1    ***
       - make file "f" clean                            N

       - execute 'hg foobar'
         - instantiate 'dirstate'           -1   -1
         - 'dirstate.normal("f")'           N    -1
           (e.g. via dirty check)
         - change "f", but keep size                    N
  N+1
         - release wlock
           - 'dirstate.write()'             N    N

       - 'hg status' shows "f" as "clean"   N    N      N
  ---- ----------------------------------- ---- ----- -----

The most important point is that 'dirstate.write()' is executed at N+1
or later. This causes writing dirstate timestamp N of "f" out
successfully. If it is executed at N, 'parsers.pack_dirstate()'
replaces timestamp N with "-1" before actual writing dirstate out.

Occasional test failure for unexpected file status is typical example
of this corner case. Batch execution with small working directory is
finished in no time, and rarely satisfies condition (2) above.

This issue can occur in cases below;

  - 'hg revert --rev REV' for revisions other than the parent
  - failure of 'merge.update()' before 'merge.recordupdates()'

The root cause of this issue is that files are changed without
flushing in-memory dirstate changes via 'repo.commit()' (even though
omitting 'dirstate.normallookup()' on changed files also causes this
issue).

To detect changes of files correctly, this patch writes in-memory
dirstate changes out explicitly after marking files as clean in
'workingctx._checklookup()', which is invoked via 'repo.status()'.

After this change, timetable is changed as below:

  ---- ----------------------------------- ----------------
                                           timestamp of "f"
                                           ----------------
                                           dirstate   file-
  time          action                     mem  file  system
  ---- ----------------------------------- ---- ----- -----
  N                                              -1    ***
       - make file "f" clean                            N

       - execute 'hg foobar'
         - instantiate 'dirstate'           -1   -1
         - 'dirstate.normal("f")'           N    -1
           (e.g. via dirty check)
       ----------------------------------- ---- ----- -----
         - 'dirsttate.write()'              -1   -1
       ----------------------------------- ---- ----- -----
         - change "f", but keep size                    N
  N+1
         - release wlock
           - 'dirstate.write()'             -1   -1

       - 'hg status'                        -1   -1      N
  ---- ----------------------------------- ---- ----- -----

To reproduce this issue in tests certainly, this patch emulates some
timing critical actions as below:

  - timestamp of "f" in '.hg/dirstate' is -1 at the beginning

    'hg debugrebuildstate' before command invocation ensures it.

  - make file "f" clean at N
  - change "f" at N

    'touch -t 200001010000' before and after command invocation
    changes mtime of "f" to "2000-01-01 00:00" (= N).

  - invoke 'dirstate.write()' via 'repo.status()' at N

    'fakedirstatewritetime.py' forces 'pack_dirstate()' to use
    "2000-01-01 00:00" as "now", only if 'pack_dirstate()' is invoked
    via 'workingctx._checklookup()'.

  - invoke 'dirstate.write()' via releasing wlock at N+1 (or "not at N")

    'pack_dirstate()' via releasing wlock uses actual timestamp at
    runtime as "now", and it should be different from the "2000-01-01
    00:00" of "f".

BTW, this patch also changes 'test-largefiles-misc.t', because adding
'dirstate.write()' makes recent dirstate changes visible to external
process.
2015-07-08 17:01:09 +09:00
FUJIWARA Katsunori
4414fdbe75 tests: add extension to emulate invoking dirstate.write at the specific time
This extension fakes 'now' for 'parsers.pack_dirstate()' to emulate
invoking 'dirstate.write()' at the specific time, only when
'dirstate.write()' is invoked via functions below:

  - 'workingctx._checklookup()' (= 'repo.status()')
  - 'committablectx.markcommitted()'

This is useful to reproduce timing critical issues fixed in subsequent
patches.
2015-07-08 17:01:09 +09:00
Durham Goode
9f87b2f455 convert: add config for recording the source name
This creates the convert.hg.sourcename config option which will embed a user
defined name into each commit created by the convert. This is useful when using
the convert extension to merge several repositories together and we want to
record where each commit came from.
2015-07-08 10:31:09 -07:00
Durham Goode
54fa7659ef convert: support multiple specifed revs in git source
This allows specifying multiple revs/branches to convert from a git repo.
2015-07-08 10:29:11 -07:00
Durham Goode
0f795691b8 convert: add support for specifying multiple revs
Previously convert could only take one '--rev'. This change allows the user to
specify multiple --rev entries. For instance, this could allow converting
multiple branches (but not all branches) at once from git.

In this first patch, we disable support for this for all sources.  Future
patches will enable it for select sources (like git).
2015-07-08 10:27:43 -07:00
Pierre-Yves David
5e9a275007 bookmarks: change bookmark within a transaction
For some time, bookmark can and should be moved in the transaction. This
changeset migrates the 'hg bookmarks' commands to use a transaction.

Tests regarding rollback and transaction hooks are impacted for
obvious reasons. Some have to be slightly updated to keep testing the
same things. Some can just be dropped because they do not make sense
anymore.
2014-09-28 00:49:36 -07:00
Durham Goode
d70241d991 convert: add config to not convert tags
In some cases we do not want to convert tags from the source repo to be tags in
the target repo (for instance, in a large repository, hgtags cause scaling
issues so we want to avoid them). This adds a config option to disable
converting tags.
2015-06-29 13:40:20 -07:00
Yuya Nishihara
2f4ec7df91 templatekw: make {rev} return wdirrev instead of None
wdirrev/wdirnode identifiers are still experimental, but {node} is mapped to
wdirnode. So {rev} should do the same for consistency.

I'm not sure if templatekw can import scmutil. If not, we should move intrev()
to node module.
2015-07-02 22:18:21 +09:00
Yuya Nishihara
0ce55c7cf2 changeset_printer: use node.wdirrev to calculate meaningful parentrevs
Because we defined the working-directory revision is INT_MAX, it makes sense
that "hg log -r 'wdir()'" displays the "parent:" field. This is the same for
two revisions that are semantically contiguous but the intermediate revisions
are hidden.
2015-07-02 22:03:06 +09:00
Yuya Nishihara
950db6aab2 templatekw: apply manifest template only if ctx.manifestnode() exists
This will prevent crash by "hg log -r 'wdir()' -Tdefault". We could use the
pseudo ff... hash introduced by 187c3ec3d83f, but it isn't proven idea yet.
For now, I want to make "hg log" just works in order to test 'wdir()' revset.

Note that unlike its name, "{manifest}" is not a list of files in that
revision, but a pair of (manifestrev, manifestnode).
2015-03-14 17:58:18 +09:00
FUJIWARA Katsunori
3c2a14f766 hghave: allow adding customized features at runtime
Before this patch, there is no way to add customized features to
`hghave` without changing `hghave` and `hghave.py` themselves.

This decreases reusability of `run-tests.py` framework for third party
tools, because they may want to examine custom features at runtime
(e.g.  existence of some external tools).

To allow adding customized features at runtime, this patch makes
`hghave` import `hghaveaddon` module, only when `hghaveaddon.py` file
can be found in directories below:

  - `TESTDIR` for invocation via `run-tests.py`
  - `.` for invocation via command line

The path to the directory where `hghaveaddon.py` should be placed is
added to `sys.path` only while importing `hghaveaddon`, because:

  - `.` may not be added to `PYTHONPATH`

  - adding additional path to `sys.path` may change behavior of
    subsequent `import` for other features

`hghave` is terminated with exit code '2' at failure of `import
hghaveaddon`, because exit code '2' terminates `run-tests.py`
immediately.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
4bae7bb820 import-checker.py: exit with code 0 if no error is detected
Before this patch, `import-checker.py` exits with non-0 code, if no
error is detected. This is unusual as Unix command.

This change may be a one of preparations for issue4677, because this
can avoid extra explanation about unusual exit code of
`import-checker.py` for third party tool developers.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
4a75be9bfa run-tests.py: add TESTDIR to PATH if it differs from RUNTESTDIR
Before this patch, `RUNTESTDIR` is added to `PATH`, but `TESTDIR`
isn't.

This doesn't cause any problems, if `run-tests.py` runs in `tests`
directory of Mercurial source tree. In this case, `RUNTESTDIR` should
be equal to `TESTDIR`.

On the other hand, if `run-tests.py` runs in `tests` of third party
tools, commands in that directory should be executed with explicit
`$TESTDIR/` prefix in `*.t` test scripts. This isn't suitable for the
policy "drop explicit $TESTDIR from executables" of Mercurial itself
(see fcb1c7d8c36e).

BTW, fcb1c7d8c36e describes that "$TESTDIR is added to the path" even
though `TESTDIR` isn't added to `PATH` exactly speaking, because
`TESTDIR` and `RUNTESTDIR` weren't yet distinguished from each other
at that time.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
70980837e8 run-tests.py: add RUNTESTDIR to refer tests of Mercurial
Before this patch, there is no way to refer files under `tests` or so
of Mercurial source tree, when `run-tests.py` runs in `tests` of third
party tools. In this case, `TESTDIR` refers the latter `tests`.

This prevents third party tools from using useful tools in Mercurial
source tree (e.g. `contrib/check-code.py`).

This patch adds `RUNTESTDIR` environment variable to refer `tests` of
Mercurial source tree, in which `run-tests.py` now running is
placed. For example, tests of third party tools can refer
`contrib/check-code.py` in Mercurial source tree as
`$RUNTESTDIR/../contrib/check-code.py`.

BTW, for similarity with `TESTDIR` referring `test*s*` directory,
newly added environment variable isn't named as `RUNTEST*S*DIR`. In
addition to it, the corresponded local variable is also named as
`runtestdir`.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
c5c4f4ba0d run-tests.py: execute hghave by the path relative to run-tests.py
Before this patch, `run-tests.py` executes `hghave` by the path
relative to `TESTDIR` (= cwd of `run-tests.py` running).

This prevents third party tools for Mercurial from running
`run-tests.py`, which is placed in `tests` of Mercurial source tree,
in `tests` of own source tree. In such cases, `TESTDIR` refers the
latter `tests`, and `hghave` doesn't exist in it.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
Matt Harbison
edbaac787d templatekw: make {latesttag} a hybrid list
This maintains the previous behavior of expanding {latesttag} to a string
containing all of the tags, joined by ':'.  But now it also allows list type
operations.

I'm unsure if the plural handling is correct (i.e. it seems like it is usually
"{foos % '{foo}'}"), but I guess we are stuck with this because the singular
form previously existed.
2015-07-06 23:23:22 -04:00
Matt Harbison
9e00498f91 templatekw: introduce the changessincelatesttag keyword
Archive is putting a value with the same name in the metadata file, to count all
of the changes not covered by the latest tag, instead of just along the longest
path.  It seems that this would be useful to have on the command line as well.
It might be nice for the name to start with 'latesttag' so that it is grouped
with the other tag keywords, but I can't think of a better name.

The initial version of this counted a clean wdir() and '.' as the same value,
and a dirty wdir() as the same value after it is committed.  Yuya objected on
the grounds of consistency [1].  Since revsets can be used to conditionally
select a dirty wdir() or '.' when clean, I can build the version string I need
and will defer to him on this.

[1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071588.html
2015-06-26 23:11:05 -04:00
Matt Harbison
1ea0ae2f3c help: support 'hg help template.somekeyword'
Previously the output was simply 'abort: help section not found'.
2015-07-04 23:11:32 -04:00
Matt Harbison
10b3c14d0d test-convert-git: use a relative gitmodule url
The absolute URL was causing this error with 1.9.5 on Windows, which had a
cascading effect:

  @@ -466,22 +466,24 @@
     >   url = $TESTTMP/git-repo5
     > EOF
     $ git commit -a -m "weird white space submodule"
  -  [master *] weird white space submodule (glob)
  -   Author: nottest <test@example.org>
  -   1 file changed, 3 insertions(+)
  +  fatal: bad config file line 6 in $TESTTMP/git-repo6/.gitmodules
  +  [128]
     $ cd ..
     $ hg convert git-repo6 hg-repo6
     initializing destination hg-repo6 repository
     scanning source...

For reasons unknown, there is still this delta on Windows:

  @@ -490,7 +490,6 @@
     $ git commit -q -m "missing .gitmodules"
     $ cd ..
     $ hg convert git-repo6 hg-repo6 --traceback
  -  fatal: Path '.gitmodules' does not exist in '*' (glob)
     initializing destination hg-repo6 repository
     scanning source...
     sorting...
2015-07-02 00:04:08 -04:00
Matt Harbison
95581f5463 test-convert-git: stablize for git 1.7.7.6
The output has apparently changed slightly since this version.  Since they are
just commits without any obvious importance to the test, and I can't figure out
how to glob them away, silence them.

Sample diffs were like this:

  @@ -468,7 +468,7 @@
     $ git commit -a -m "weird white space submodule"
     [master *] weird white space submodule (glob)
      Author: nottest <test@example.org>
  -   1 file changed, 3 insertions(+)
  +   1 files changed, 3 insertions(+), 0 deletions(-)
     $ cd ..
     $ hg convert git-repo6 hg-repo6
     initializing destination hg-repo6 repository
2015-07-01 20:53:12 -04:00
Colin Chan
f6f6547f72 shelve: only keep the latest N shelve backups
This will keep the backup directory from growing indefinitely. The number of
backups to keep can be set using the shelve.maxbackups config option (defaults
to 10 backups).
2015-07-01 13:14:03 -07:00
Colin Chan
cdd7ed7476 shelve: always backup shelves instead of deleting them
Instead of being deleted, shelve files are now moved into the .hg/shelve-backup
directory. This is designed similarly to how strip saves backups into
.ht/strip-backup. The goal is to prevent data loss especially when using
unshelve. There are cases in which a user can complete an unshelve but lose
some of the data that was shelved by, for example, resolving merge conflicts
incorrectly. Storing backups will allow the user to recover the data that was
shelved, at the expense of using more disk space over time.
2015-07-01 13:13:02 -07:00
Augie Fackler
8642271531 wireproto: correctly escape batched args and responses (issue4739)
This issue appears to be as old as wireproto batching itself: I can
reproduce the failure as far back as 6afda0a50a20 trivially by
rebasing the test changes in this patch, which was back in the 1.9
era. I didn't test before that change, because prior to that the
testfile has a different name and I'm lazy.

Note that the test thought it was checking this case, but it actually
wasn't: it put a literal ; in the arg and response for its greet
command, but the mangle/unmangle step defined in the test meant that
instead of "Fo, =;o" going over the wire, "Gp-!><p" went instead,
which doesn't contain any special characters (those being [.=;]) and
thus not exercising the escaping. The test has been updated to use
pre-unmangled special characters, so the request is now "Fo+<:o",
which mangles to "Gp,=;p". I have confirmed that the test fails
without the adjustment to the escaping rules in wireproto.py.

No existing clients of RPC batching were depending on the old behavior
in any way. The only *actual* users of batchable RPCs in core were:

1) largefiles, wherein it batches up many statlfile calls. It sends
hexlified hashes over the wire and gets a 0, 1, or 2 back as a
response. No risk of special characters.

2) setdiscovery, which was using heads() and known(), both of which
communicate via hexlified nodes. Again, no risk of special characters.

Since the escaping functionality has been completely broken since it
was introduced, we know that it has no users. As such, we can change
the escaping mechanism without having to worry about backwards
compatibility issues.

For the curious, this was detected by chance: it happens that the
lz4-compressed text of a test file for remotefilelog compressed to
something containing a ;, which then caused the failure when I moved
remotefilelog to using batching for file content fetching.
2015-06-30 19:19:17 -04:00
Yuya Nishihara
329cd61d62 revset: port extra() to support keyword arguments
This is an example to show how keyword arguments are processed.
2015-06-28 22:57:33 +09:00
Yuya Nishihara
411c9c1693 revset: add parsing rule for key=value pair
It will be used as an keyword argument.

Note that our "=" operator is left-associative. In general, the assignment
operator is right-associative, but we don't care because it isn't allowed to
chain "=" operations.
2015-06-27 17:05:28 +09:00
Gregory Szorc
5fe42b2975 import-checker: establish modern import convention
We introduce a new convention for declaring imports and enforce it via
the import checker script.

The new convention is only active when absolute imports are used, which is
currently nowhere. Keying off "from __future__ import absolute_import" to
engage the new import convention seems like the easiest solution. It is
also beneficial for Mercurial to use this mode because it means less work
and ambiguity for the importer and potentially better performance due to
fewer stat() system calls because the importer won't look for modules in
relative paths unless explicitly asked.

Once all files are converted to use absolute import, we can refactor
this code to again only have a single import convention and we can
require use of absolute import in the style checker.

The rules for the new convention are documented in the docstring of the
added function. Tests have been added to test-module-imports.t. Some
tests are sensitive to newlines and source column position, which makes
docstring testing difficult and/or impossible.
2015-06-28 12:46:34 -07:00
Matt Harbison
1147e2bdb5 templatekw: use a list of tags in getlatesttags() instead of joining them
This will be used in the next patch.

It also points out that the documentation for '{latesttag}' is not quite
accurate, since it says "most recent global tag" (singular).  I assume it is too
radical of a change to convert it to a list of strings.  At least ':' is
currently a reserved character in tag names.
2015-06-26 23:23:10 -04:00
Durham Goode
bc1c03c315 convert: improve support for unusual .gitmodules
Previously convert would throw an exception if it encountered a git commit with
a .gitmodules file that was malformed (i.e. was missing, but had submodule
files, or was malformed).

Instead of breaking the convert entirely, let's print error messages and move
on.
2015-06-29 17:19:58 -07:00
Durham Goode
8785908f11 convert: handle .gitmodules with non-tab whitespaces
The old implementation assumed .gitmodules file lines always began
with tabs. It can be any whitespace, so lets trim the lines
appropriately.
2015-06-29 17:19:18 -07:00
Durham Goode
782f192338 convert: fix bug with converting the same commit twice
Convert had a bug where it relied on repo.tip() to be the newly committed
commit. This was not the case if the commit already existed in the repository
(since repo.commitctx() did nothing, the tip() referenced some random other
commit and the revmap got corrupted).

This fixes it by using the node returned by repo.commitctx().
2015-06-29 13:39:05 -07:00
Yuya Nishihara
2dde4312da templater: remove workaround for escaped quoted string in quoted template
This patch backs out 297d563e92af which should no longer be needed.

The test for '{\"invalid\"}' is removed because the parser is permissive for
\"...\" literal.
2015-06-27 15:28:46 +09:00
Matt Mackall
b050378961 merge with stable 2015-07-01 16:33:31 -05:00
Pierre-Yves David
a7b191b4b3 transplant: only pull the transplanted revision (issue4692)
For some reason, transplant was pulling all remote revisions when transplanting
from a remote repository (unless --branch was
specified).
2015-06-29 19:09:42 -07:00
Pierre-Yves David
2558bde9af transplant: update test to use hash for remote transplant
Transplant is apparently allowing using revision numbers when transplanting
through http. I call this nonsense and update the test to use an explicit hash.

This "feature" will break in the next change fixing another bug.
2015-06-29 19:18:51 -07:00
Augie Fackler
c7fd94e3df sshserver: drop ancient do_{lock,unlock,addchangegroup} methods
These were marked as deprecated and dangerous way back in
f8e443eb02c9, which was first included in Mercurial 0.9.1. While it's
possible that clients from that long ago are still around somewhere,
they're risky for servers in that they want to lock the repo, and then
might leave it locked if they died before finishing their transaction.

Given that it's been 9 years, let's go ahead and cut this last
lingering tie with a basically-untested protocol.
2015-06-29 17:10:36 -04:00
Pierre-Yves David
b05f468b44 changegroup: properly compute common base in changeggroupsubset (issue4736)
The computation of roots was buggy, any ancestor of a bundled merge which was
also a descendant of the parents of a bundled revision were included as part of
the bundle. We fix it and add a test for strip (which revealed the problem).

Check the test for a practical usecase.
2015-06-29 11:20:09 -07:00
Matt Mackall
174e090e10 archive: fix changesincelatesttag with wdir() 2015-07-01 15:12:45 -05:00
Matt Harbison
b41110155b revset: fix a crash in parents() when 'wdir()' is in the set
The crash was "TypeError: expected string or Unicode object, NoneType found"
down in revlog.parentrevs().  This fixes heads() too (which is where I found
it.)
2015-06-29 10:34:56 -04:00
Matt Harbison
9f8b7aa09e workingctx: don't report the tags for its parents
This fixes the bad distance calculation for '{latesttagdistance}' mentioned in
the previous patch.
2015-06-28 13:38:03 -04:00
Matt Harbison
36b6d6cb5d identify: avoid a crash when given '-r wdir()'
The crash was 'NoneType is not subscriptable' in hexfunc(ctx.node()), because
the node for wdir() is None.  This can be avoided simply by detecting 'wdir()'
and taking the existing path for no given revision.
2015-06-28 18:39:58 -04:00
Pierre-Yves David
792170e0e9 tests: clean up duplicated output in test-subrepo-recursion progress
We have fixed a bug where two progress instance were created and competed with
each other (in 29d8a6f6d7e4). But we did not updated the non-hardlink section of
'test-subrepo-recursion.t'. This patch fixes it.
2015-06-26 14:33:34 -07:00
Matt Mackall
2173cc3777 merge with stable 2015-06-29 16:38:22 -05:00
Matt Harbison
d4e8d4f13c archive: don't assume '.' is being archived for changessincelatesttag
Hardcoding '.' is wrong, and yielded strange results when archiving old
revisions.  For example, when archiving the cset that adds the signature to 3.4
(a4f6d198e7df), the resulting value was previously 51 (the number of commits on
stable between 3.4 and today), even though it was a direct descendant of a tag,
with a {latesttagdistance} of 2.  This still includes all other _ancestor_ paths
not included in {latesttag}.

Note that archiving wdir() currently blows up several lines above this when
building the 'base' variable.  Since wdir() isn't documented, ignore that it
needs work to handle wdir() here for now.
2015-06-25 21:16:47 -04:00
Yuya Nishihara
274728564b templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
As of Mercurial 3.4, there were several syntax rules to process nested
template strings. Unfortunately, they were inconsistent and conflicted
each other.

 a. buildmap() rule
    - template string is _parsed_ as string, and parsed as template
    - <\"> is not allowed in nested template:
      {xs % "{f(\"{x}\")}"} -> parse error
    - template escaping <\{> is handled consistently:
      {xs % "\{x}"} -> escaped
 b. _evalifliteral() rule
    - template string is _interpreted_ as string, and parsed as template
      in crafted environment to avoid double processing of escape sequences
    - <\"> is allowed in nested template:
      {if(x, "{f(\"{x}\")}")}
    - <\{> and escape sequences in string literal in nested template are not
      handled well
 c. pad() rule
    - template string is first interpreted as string, and parsed as template,
      which means escape sequences are processed twice
    - <\"> is allowed in nested template:
      {pad("{xs % \"{x}\"}', 10)}

Because of the issue of template escaping, issue4714, 56e0b66a4c27 (in stable)
unified the rule (b) to (a). Then, 41e044cfb1ef (in default) unified the rule
(c) to (b) = (a). But they disabled the following syntax that was somewhat
considered valid.

  {if(rev, "{if(rev, \"{rev}\")}")}
  {pad("{files % \"{file}\"}", 10)}

So, this patch introduces \"...\" literal to work around the escaped-quoted
nested template strings. Because this parsing rule exists only for the backward
compatibility, it is designed to copy the behavior of old _evalifliteral() as
possible.

Future patches will introduce a better parsing rule similar to a command
substitution of POSIX shells or a string interpolation of Ruby, where extra
escapes won't be necessary at all.

  {pad("{files % "{file}"}", 10)}
        ~~~~~~~~~~~~~~~~~~
        parsed as a template, not as a string

Because <\> character wasn't allowed in a template fragment, this patch won't
introduce more breakages. But the syntax of nested templates are interpreted
differently by people, there might be unknown issues. So if we want, we could
instead remove e926f2ef639a, 72be08a15d8d and 56e0b66a4c27 from the stable
branch as the bug fixed by these patches existed for longer periods.

554d6fcc3c8, "strip single backslash before quotation mark in quoted template",
should be superseded by this patch. I'll remove it later.
2015-06-25 22:07:38 +09:00
Anton Shestakov
f9942be78e hgweb: use css for stripey background in coal
Since "fd4945970469 or b7c98f01667e::be1d0b03b11a" paper style used css for
stripes in background for browsing files, for listing branches/tags/bookmarks,
and so on.

Since coal borrows many paper templates (e.g. shortlogentry.tmpl), it actually
tried to do the same, but it didn't have the needed css classes. You can
compare https://selenic.com/hg?style=coal with
https://selenic.com/hg?style=paper and see how log view in coal style has plain
white background, unlike the one in paper style. This wasn't intended.

Let's copy css classes directly from style-paper.css and remove parity classes
from elements that don't need them anymore. This makes plain white background
have stripes again and makes coal/map even more similar to paper/map (which can
ease porting changes or %including paper/map in future).
2015-06-25 20:27:36 +08:00
Matt Mackall
0508027d17 merge with stable 2015-06-24 13:41:27 -05: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
Laurent Charignon
a48a11f98e revert: change the direction of revert -i
After the discussion on the list about hg revert -i, it seems like we are
satisfied with what we called proposition 2. It shows the changes to revert in
the same direction as hg diff. This patch makes it the default option.
It changes all the + in - and vice versa in the tests for revert -i.
2015-06-23 14:28:15 -07:00
Laurent Charignon
98f25a9c3d revert: change a test to make the change of direction of revert -i easier
Currently we are handling editing of newly-added files with the interactive
interface. We are not handling editing of deleted files. In the test for revert,
we were editing a newly-added file. Since we want to change the direction of
revert -i, this editing of a newly-added file will become editing of a deleted file.
Since we don't support that, this patch changes the test to make the rest of
the series cleaner.
2015-06-23 13:46:58 -07:00
Yuya Nishihara
ec7ad76871 templater: fix handling of \-escapes in raw string literals
The backslash character should start escape sequences no matter if a string is
prefixed with 'r'. They are just not interpreted as escape sequences in raw
strings. revset.tokenize() handles them correctly, but templater didn't.

https://docs.python.org/2/reference/lexical_analysis.html#string-literals
2015-06-21 13:24:43 +09:00
Gregory Szorc
8e1cdd21f4 verify: print hint to run debugrebuildfncache
Corrupt fncache is now a recoverable operation. Inform the user how to
recover from this warning.
2015-06-20 20:11:53 -07:00
Gregory Szorc
8f8cc06067 repair: add functionality to rebuild fncache
Currently, there is no way to recover from a missing or corrupt fncache
file in place (a clone is required). For certain use cases such as
servers and with large repositories, an in-place repair may be
desirable. This patch adds functionality for in-place repair of the
fncache.

The `hg debugrebuildfncache` command is introduced. It ensures the
fncache is up to date by reconstructing the fncache from all seen files
encountered during a brute force traversal of the repository's entire
history.

The command will add missing entries and will prune excess ones.

Currently, the command no-ops unless the repository has the fncache
requirement. The command could later grow the ability to "upgrade" an
existing repository to be fncache enabled, if desired.

When testing this patch on a local clone of the Firefox repository, it
removed a bunch of entries. Investigation revealed that removed entries
belonged to empty (0 byte size) .i filelogs. The functionality for
pruning fncache of stripped revlogs was introduced in 93ba76bfbe8a, so
the presence of these entries likely predates this feature.
2015-06-22 09:59:48 -07:00
Yuya Nishihara
930b78aeff templater: evaluate "query" argument passed to revset()
revset() had the same issue as f921aa09b251. It crashed by passing non-string
expression.
2015-06-20 23:13:34 +09:00
Matt Harbison
f536f82114 match: let 'path:.' and 'path:' match everything (issue4687)
Previously, both queries exited with code 1, printing nothing.  The pattern in
the latter query is normalized to '.', so it is really the same case.
2015-06-20 19:59:26 -04:00
Yuya Nishihara
bd614aebda templater: evaluate arguments passed to diff() appropriately
Before this patch, diff() crashed by passing non-string expression because
it didn't evaluate arguments at all.
2015-06-13 20:14:22 +09:00
Yuya Nishihara
54bbfd7f6b templater: do not preprocess template string in "if" expression (issue4714)
The problem was spotted at cd1b50e99ed8, that says "this patch invokes it
with "strtoken='rawstring'" in "_evalifliteral()", because "t" is the result
of "arg" evaluation and it should be "string-escape"-ed if "arg" is "string"
expression." This workaround is no longer valid since 72be08a15d8d introduced
strict parsing of '\{'.

Instead, we should interpret bare token as "string" or "rawstring" template.
This is what buildmap() does at parsing phase.
2015-06-08 18:14:22 +09:00
Matt Harbison
a1a73ad1ab hgwebdir: don't allow the hidden parent of a subrepo to show as a directory
Previously, if a subrepo parent had 'web.hidden=True' set, neither the parent
nor child had a repository entry.  However, the directory entry for the parent
would be listed (it wouldn't have the fancy 'web.name' if configured), and that
link went to the repo's summary page, effectively making it not hidden.

This simply disables the directory processing if a valid repository is present.
Whether or not the subrepo should be hidden is debatable, but this leaves that
behavior unchanged (i.e. it stays hidden).
2015-06-01 18:06:20 -04:00
Pierre-Yves David
9e0c5a2a51 pull: avoid race condition with 'hg pull --rev name --update' (issue4706)
The previous scheme was:

1) lookup node for all pulled revision,
2) pull said node
3) lookup the node of the checkout target
4) update the repository there.

If the remote repo changes between (1) and (3), the resolved name will be
different and (3) crash. There is actually no need for a remote lookup during
(3), we could just set the value in (1). This prevent the race condition and
save a possible network roundtrip.
2015-06-03 14:29:11 -07:00
Matt Harbison
7ed6e6b3e0 hgwebdir: avoid redundant repo and directory entries when 'web.name' is set
Previously, when 'web.name' was set on a subrepo parent and 'web.collapse=True',
the parent repo would show in the list with the configured 'web.name', and a
directory with the parent repo's filesystem name (with a trailing slash) would
also appear.  The subrepo(s) would unexpectedly be excluded from the list of
repositories.  Clicking the directory entry would go right to the repo page.

Now both the parent and the subrepos show up, without the additional directory
entry.

The configured hgweb paths used '**' for finding the repos in this scenario.


A couple of notes about the tests:

- The area where the subrepo was added has a comment that it tests subrepos,
  though none previously existed there.  One now does.

- The 'web.descend' option is required for collapse to work.  I'm not sure what
  the previous expectations were for the test.  Nothing changed with it set,
  prior to adding the code in this patch.  It is however required for this test.

- The only output changes are for the hyperlinks, obviously because of the
  'web.name' parameter.

- Without this code change, there would be an additional diff:

    --- /usr/local/mercurial/tests/test-hgwebdir.t
    +++ /usr/local/mercurial/tests/test-hgwebdir.t.err
    @@ -951,7 +951,7 @@
       /rcoll/notrepo/e/
       /rcoll/notrepo/e/e2/
       /rcoll/notrepo/f/
    -  /rcoll/notrepo/f/f2/
    +  /rcoll/notrepo/f/


     Test repositories inside intermediate directories

I'm not sure why the fancy name doesn't come out, but it is enough to
demonstrate that the parent is not listed redundantly, and the subrepo isn't
skipped.
2015-06-01 14:42:55 -04:00
FUJIWARA Katsunori
1d5cc643a1 templatekw: compare target context and its parent exactly (issue4690)
Before this patch, template keywords `{file_mods}`, `{file_adds}` and
`{file_dels}` use values gotten by `repo.status(ctx.p1().node(),
ctx.node())`.

But this doesn't work as expected if `ctx` is `memctx` or
`workingcommitctx`. Typical case of templating with these contexts is
customization of the text shown in the commit message editor by
`[committemplate]` configuration.

In this case, `ctx.node()` returns None and it causes comparison
between `ctx.p1()` and `workingctx`. `workingctx` lists up all changed
files in the working directory even at selective committing.

BTW, `{files}` uses `ctx.files()` and it works as expected.

To compare target context and its parent exactly, this patch passes
`ctx.p1()` and `ctx` without `node()`-nize. This avoids unexpected
comparison with `workingctx`.

This patch uses a little redundant template configurations in
`test-commit.t`, but they are needed to avoid regression around
problems fixed by 17e2fda16f58 and 2b999bc2d89a: accessing on `ctx`
may break `ctx._status` field.
2015-06-02 02:28:33 +09:00
Durham Goode
70caa9d8e9 histedit: fix keep during --continue
The --keep option was being serialized to the state file, but it wasn't actually
being used when running a histedit --continue. This fixes that.
2015-05-28 20:30:20 -07:00
Matt Mackall
1899eff59c convert: properly pass null ids through .hgtags (issue4678)
Mercurial uses tags of null to mark deletions, but convert was
silently discarding these because it had no mapping for them. Thus, it
was resurrecting deleted tags.
2015-05-27 14:28:29 -05:00
FUJIWARA Katsunori
1a1aa7a153 localrepo: pass hook argument txnid to pretxnopen hooks
Before this patch, hook argument `txnid` isn't passed to `pretxnopen`
hooks, even though `hooks` section of `hg help config` describes so.

  ``pretxnopen``
    Run before any new repository transaction is open. The reason for the
    transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
    transaction will be in ``HG_TXNID``. A non-zero status will prevent the
    transaction from being opened.
2015-05-25 01:26:23 +09:00
Yuya Nishihara
3ca8d79bef revbranchcache: return uncached branchinfo for nullrev (issue4683)
This fixes the crash caused by "branch(null)" revset. No cache should be
necessary for nullrev because changelog.branchinfo(nullrev) does not involve
IO operation.

Note that the problem of "branch(wdir())" isn't addressed by this patch.
"wdir()" will raise TypeError in many places because of None. This is the
reason why "wdir()" is still experimental.
2015-05-23 11:14:00 +09:00
Yuya Nishihara
799e490a3c revset: drop magic of fullreposet membership test (issue4682)
This patch partially backs out a9a86cbbc5b2 and adds an alternative workaround
to functions that evaluate "null" and "wdir()". Because the new workaround is
incomplete, "first(null)" and "min(null)" don't work as expected. But they were
not usable until 3.4 and "null" isn't commonly used, we can postpone a complete
fix for 3.5.

The issue4682 was caused because "branch(default)" is evaluated to
"<filteredset <fullreposet>>", keeping fullreposet magic. The next patch will
fix crash on "branch(null)", but without this patch, it would make
"null in <branch(default)>" be True, which means "children(branch(default))"
would return all revisions but merge (p2 != null).

I believe the right fix is to stop propagating fullreposet magic on filter(),
but it wouldn't fit to stable release. Also, we should discuss how to handle
"null" and "wdir()" in revset before.
2015-05-24 10:29:33 +09:00
FUJIWARA Katsunori
c75b05f3e1 localrepo: use correct argument name for pretxnclose hooks (BC)
Before this patch, "the reason for the transaction" is passed to
`pretxnclose` hooks via wrong name argument `xnname` (`HG_XNNAME` for
external hooks)
2015-05-20 04:34:27 +09:00
FUJIWARA Katsunori
3c33b6c286 localrepo: rename hook argument from TXNID to txnid (BC)
From the first (3.4 or 4e01e6d8d623), `TXNID` is passed to Python
hooks without lowering its name, but it is wrong.
2015-05-20 04:34:27 +09:00
Matt Harbison
3adb63e5c0 match: explicitly naming a subrepo implies always() for the submatcher
The files command supports naming directories to limit the output to children of
that directory, and it also supports -S to force recursion into a subrepo.  But
previously, using -S and naming a subrepo caused nothing to be output.  The
reason was narrowmatcher() strips the current subrepo path off of each file,
which would leave an empty list if only the subrepo was named.

When matching on workingctx, dirstate.matches() would see the submatcher is not
always(), so it returned the list of files in dmap for each file in the matcher-
namely, an empty list.  If a directory in a subrepo was named, the output was as
expected, so this was inconsistent.

The 'not anypats()' check is enforced by an existing test around line 140:

    $ hg remove -I 're:.*.txt' sub1

Without the check, this removed all of the files in the subrepo.
2015-05-17 22:09:37 -04:00
Matt Harbison
dc85d51beb context: don't complain about a matcher's subrepo paths in changectx.walk()
Previously, the first added test printed the following:

  $ hg files -S -r '.^' sub1/sub2/folder
  sub1/sub2/folder: no such file in rev 9bb10eebee29
  sub1/sub2/folder: no such file in rev 9bb10eebee29
  sub1/sub2/folder/test.txt

One warning occured each time a subrepo was crossed into.

The second test ensures that the matcher copy stays in place.  Without the copy,
the bad() function becomes an increasingly longer chain, and no message would be
printed out for a file missing in the subrepo because the predicate would match
in one of the replaced methods.  Manifest doesn't know anything about subrepos,
so it needs help ignoring subrepos when complaining about bad files.
2015-05-17 01:06:10 -04:00
Pierre-Yves David
cfe00fb313 ssh: capture output with bundle2 again (issue4642)
I just discovered that we are not displaying ssh server output in real time
anymore. So we can just fall back to the bundle2 output capture for now. This
fix the race condition issue we where seeing in tests. Re-instating real time
output for ssh would fix the issue too but lets get the test to pass first.
2015-05-18 22:35:27 -05:00
Tony Tung
322aee926e rebase: check that the bookmark is still valid when restoring (issue4669)
After a rebase --abort, we attempt to restore the previously active
bookmark.  We need to ensure that the bookmark still exists.
2015-05-14 21:35:06 -07:00
Yuya Nishihara
cc6506056b revset: map postfix '%' to only() to optimize operand recursively (issue4670)
Instead of keeping 'onlypost' as a method, this patch rewrites it to 'only'
function. This way, 'x%' always has the same weight as 'only(x)'.
2015-05-15 22:32:31 +09:00
Jordi Gutiérrez Hermoso
71d8479479 rebase: clear merge when aborting before any rebasing (issue4661)
The check of the inrebase function was not correct, and it failed to
consider the situation in which nothing has been rebased yet, *and*
the working dir had been updated away from the initial revision.

But this is easy to fix. Given the rebase state, we know exactly where
we should be standing: on the first unrebased commit. We check that
instead. I also took the liberty to rename the function, as "inrebase"
doesn't really describe the situation: we could still be in a rebase
state yet the user somehow forcibly updated to a different revision.

We also check that we're in a merge state, since an interrupted merge
is the only "safe" way to interrupt a rebase. If the rebase got
interrupted by power loss or whatever (so there's no merge state),
it's still safer to not blow away the working directory.
2015-05-10 10:57:24 -04:00
Jordi Gutiérrez Hermoso
5b68cd687e test-rebase-abort: add test from issue4009
The fix for issue4009, namely fb4b3b3e981f, introduced issue4661.
Let's make sure that the fix for issue4661 will not reintroduce
issue4009.
2015-05-10 10:02:15 -04:00
Pierre-Yves David
0cae7109a3 test-run-test: unset run-test specific environment variables
Otherwise variable set for the real test run interfere with the test runner
tests.
2015-05-08 11:32:24 -07:00
Yuya Nishihara
fe4df27bf6 hgweb: bring back infinite scroll in shortlog of paper style
Since e902e55c3d0b, column headers are wrapped by <thead> element, so the first
and only <tbody> contains changelog data. I got the following error without
this patch:

    Uncaught TypeError: Cannot read property 'lastElementChild' of null
      scrollHandler @ mercurial.js:375
2015-05-07 07:46:39 +09:00
Yuya Nishihara
60069c670b templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Because double backslashes are processed as a string escape sequence, '\\{'
should start the template syntax. On the other hand, r'' disables any sort
of \-escapes, so r'\{' can go either way, never start the template syntax
or always start it. I simply chose the latter, which means r'\{' is the same
as '\\{'.
2015-05-04 10:17:34 +09:00
Yuya Nishihara
6b7d953b63 templater: do not process \-escapes at parsestring() (issue4290)
This patch brings back pre-2.8.1 behavior.

The result of parsestring() is stored in templater's cache, t.cache, and then
it is parsed as a template string by compiletemplate(). So t.cache should keep
an unparsed string no matter if it is sourced from config value. Otherwise
backslashes would be processed twice.

The test vector is borrowed from 83ff877959a6.
2015-05-04 09:54:01 +09:00
Durham Goode
86da5b2adb histedit: fix test-histedit-edit on vfat
test-histedit-edit was broken because it relied on the HGEDITOR script being
executable. Instead, lets just execute 'sh' and pass it the script to run. This
seems to be the pattern followed in other tests.
2015-05-05 11:15:17 -07:00
Matt Harbison
7ae29b6407 archive: always use portable path component separators with subrepos
The previous behavior when archiving a subrepo 's' on Windows was to internally
name the file under it 's\file', due to the use of vfs.reljoin().  When printing
the file list from the archive on Windows or Linux, the file was named
's\\file'.  The archive extracted OK on Windows, but if the archive was brought
to a Linux system, it created a file named 's\file' instead of a directory 's'
containing 'file'.

*.zip format achives seemed not to have the problem, but this was definitely an
issue with *.tgz archives.

Largefiles actually got this right, but a test is added to keep this from
regressing.  The subrepo-deep-nested-change.t test was repurposed to archive to
a file, since there are several subsequent tests that archive to a directory.
The output change is losing the filesystem prefix '../archive_lf' and not
listing the directories 'sub1' and 'sub1/sub2'.
2015-05-04 22:33:29 -04:00
Durham Goode
d8291a43e1 histedit: fix --edit-plan
--edit-plan was completely broken from the command line because it used an old
api that was not updated (it would crash with a stack trace). Let's update it
and add tests to catch this.
2015-04-22 15:53:03 -07:00
Alexander Drozdov
f95ceba6f9 revset: id() called with 40-byte strings should give the same results as for short strings
The patch solves two issues:
1. id(unknown_full_hash) aborts, but id(unknown_short_hash) doesn't
2. id(40byte_tag_or_bookmark) returns tagged/bookmarked revision,
   but id(non-40byte_tag_or_bookmark) doesn't

After the patch:
1. id(unknown_full_hash) doesn't abort
2. id(40byte_tag_or_bookmark) returns empty set
2015-04-20 10:52:20 +03:00
Yuya Nishihara
9420a5f503 templater: fix crash by passing invalid object to date() function
"date information" is somewhat obscure, but we call it that way in
templatekw.showdate().
2015-05-03 17:33:14 +09:00
Siddharth Agarwal
c4e0365d23 util.checkcase: don't abort on broken symlinks
One case where that would happen is while trying to resolve a subrepo, if the
path to the subrepo was actually a broken symlink. This bug was exposed by an
hg-git test.
2015-05-03 12:49:15 -07:00
FUJIWARA Katsunori
2d5a78fede tests: make tests with temporary environment setting portable
With "dash" (as "/bin/sh" on Debian GNU/Linux), command execution in
"ENV=val foo bar" style doesn't work as expect in test script files,
if "foo" is user-defined function: it works fine, if "foo" is existing
commands like "hg".

5acecb004820 introduced tests for HGPLAIN and HGPLAINEXCEPT into
test-revset.t, and all of them are in such style.

This patch doesn't:

  - add explicit unsetting for HGPLAIN and HGPLAINEXCEPT

    they are already introduced by 5acecb004820

  - write assignment and exporting in one line

    "ENV=val; export ENV" for two or more environment variables in one
    line causes failure of test-check-code-hg.t: it is recognized as
    "don't export and assign at once" unfortunately.
2015-05-02 00:15:03 +09:00
Matt Harbison
f2ad8f39e0 debuginstall: expand the editor path before searching for it (issue4380)
The editor launches without expanding the path with commits because the shell
does that for us.

If the path isn't an executable, the expanded path is displayed, which is
probably more useful than the unexpanded path.  For example, in cmd.exe, '~'
expands to C:\Users\$user.  But it expands to C:/mingw/msys/1.0/home/$user in
MinGW.
2015-04-30 23:02:52 -04:00
Ryan McElroy
c2a7f23bdb templater: fail more gracefully for blank strings to word 2015-04-30 12:33:36 -07:00
Matt Harbison
9d40fb3218 windows: make shellquote() quote any path containing '\' (issue4629)
The '~' in the bug report is being expanded to a path with Windows style slashes
before being passed to shellquote() via util.shellquote().  But shlex.split()
strips '\' out of the string, leaving an invalid path in dispatch.aliasargs().

This regressed in 72640182118e.

For now, the tests need to be conditionalized for Windows (because those paths
are quoted).  In the future, a more complex regex could probably skip the quotes
if all component separators are double '\'.  I opted to glob away the quotes in
test-rename-merge2.t and test-up-local-change.t (which only exist on Windows),
because they are in very large blocks of output and there are way too many diffs
to conditionalize with #if directives.  Maybe the entire path should be globbed
away like the following paths in each changed line.  Or, letting #if directives
sit in the middle of the output as was mentioned a few months back would work
too.

Unfortunately, I couldn't figure out how to test the specific bug.  All of the
'hg serve' tests have a #require serve declaration, causing them to be skipped
on Windows.  Adding an alias for 'expandtest = outgoing ~/bogusrepo' prints the
repo as '$TESTTMP/bogusrepo', so the test runner must be changing the
environment somehow.
2015-04-29 21:14:59 -04:00
Matt Harbison
40ef0473bf test-commit-interactive: add more globs for no-execbit platforms
The ability to set the exec bit on Windows would be real handy for this test..
2015-04-29 23:55:25 -04:00
Siddharth Agarwal
eba77fa34f ui: disable revsetaliases in plain mode (BC)
ui.plain() is supposed to disable config options that change the UI to the
detriment of scripts. As the test demonstrates, revset aliases can actually
override builtin ones, just like command aliases. Therefore I believe this is a
bugfix and appropriate for stable.
2015-04-30 07:46:54 -07:00
Yuya Nishihara
dcadb4da71 bundlerepo: disable filtering of changelog while constructing revision text
This avoids the following error that happened if base revision of bundle file
was hidden. bundlerevlog needs it to construct revision texts from bundle
content as revlog.revision() does.

  File "mercurial/context.py", line 485, in _changeset
    return self._repo.changelog.read(self.rev())
  File "mercurial/changelog.py", line 319, in read
    text = self.revision(node)
  File "mercurial/bundlerepo.py", line 124, in revision
    text = self.baserevision(iterrev)
  File "mercurial/bundlerepo.py", line 160, in baserevision
    return changelog.changelog.revision(self, nodeorrev)
  File "mercurial/revlog.py", line 1041, in revision
    node = self.node(rev)
  File "mercurial/changelog.py", line 211, in node
    raise error.FilteredIndexError(rev)
  mercurial.error.FilteredIndexError: 1
2015-04-29 19:47:37 +09:00
Matt Harbison
7422218b87 merge: run update hook after the last wlock release
There were 2 test failures in 3.4-rc when running test-hook.t with the
largefiles extension enabled.  For context, the first is a commit hook:

  @@ -618,9 +621,9 @@
     $ echo 'update = hg id' >> .hg/hgrc
     $ echo bb > a
     $ hg ci -ma
  -  223eafe2750c tip
  +  d3354c4310ed+
     $ hg up 0
  -  cb9a9f314b8b
  +  223eafe2750c+ tip
     1 files updated, 0 files merged, 0 files removed, 0 files unresolved

   make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui

In both cases, largefiles acquires the wlock before calling into core, which
also acquires the wlock.  The first case was fixed in 4100e338a886 by ensuring
the hook only runs after the lock has been fully released.  The full release is
important, because that is what writes dirstate to the disk, allowing external
hooks to see the result of the update.  This simply changes how the update hook
is called, so that it too is deferred until the lock is finally released.

There are many uses of mergemod.update(), but in terms of commands, it looks
like the following commands take wlock while calling mergemod.update(), and
therefore will now have their hook fired at a later time:

    backout, fetch, histedit, qpush, rebase, shelve, transplant

Unlike the others, fetch immediately unlocks after calling update(), so for all
intents and purposes, its hook invocation is not deferred (but the external hook
still sees the proper state).
2015-04-29 15:52:31 -04:00
Pierre-Yves David
e5b26a2e94 bundle2: disable ouput capture unless we use http (issue4613 issue4615)
The current bundle2 processing was capturing all output. This is nice as it
provide better meta data about what output what, but this was changing two
things:

1) adding a prefix "remote: " to "other" output during local push (issue4613)
2) local and ssh push does not provide real time output anymore (issue4615)

As we are unsure about what form should be used in (1) and how to solve (2) we
disable output capture in this two cases. Output capture can be forced using an
experimental option.
2015-04-28 17:38:02 -07:00
Matt Harbison
1df2171ff6 subrepo: propagate the --hidden option to hg subrepositories
With many commands accepting a '-S' or an explicit path to trigger recursing
into subrepos, it seems that --hidden needs to be propagated too.
Unfortunately, many of the subrepo layer methods discard the options map, so
passing the option along explicitly isn't currently an option.  It also isn't
clear if other filtered views need to be propagated, so changing all of those
commands may be insufficient anyway.

The specific jam I got into was amending an ancestor of qbase in a subrepo, and
then evolving.  The patch ended up being hidden, and outgoing said it would only
push one unrelated commit.  But push aborted with an 'unknown revision' that I
traced back to the patch.  (Odd it didn't say 'filtered revision'.)  A push with
--hidden worked from the subrepo, but that wasn't possible from the parent repo
before this.

Since the underlying problem doesn't actually require a subrepo, there's
probably more to investigate here in the discovery area.  Yes, evolve + mq is
not exactly sane, but I don't know what is seeing the hidden revision.

In lieu of creating a test for the above situation (evolving mq should probably
be blocked), the test here is a marginally useful case where --hidden is needed
in a subrepo: cat'ing a file in a hidden revision.  Without this change, cat
aborts with:

  $ hg --hidden cat subrepo/a
  skipping missing subrepository: subrepo
  [1]
2015-02-03 15:01:43 -05:00
Matt Harbison
d85501c01b subrepo: don't pass the outer repo's --rev or --branch to subrepo incoming()
When passing a --rev, 'hg incoming -S' previously suffered from the same output
truncation or abort that was fixed for 'hg outgoing -S' in the previous patch,
for the same reasons.

Unlike push, subrepos are currently only pulled when the outer repo is updated,
not when the outer repo is pulled.  That makes matching 'hg pull' behavior
impossible.  Listing all incoming csets in the subrepo seems like the most
useful behavior, and is consistent with 'hg outgoing -S'.
2015-04-27 21:34:23 -04:00
Matt Harbison
87ea927ca1 subrepo: don't pass the outer repo's --rev or --branch to subrepo outgoing()
The previous behavior didn't reflect what would actually be pushed- push will
ignore --rev and --branch in the subrepo and push everything.  Therefore,
'push -r {rev}' would not list everything, unless {rev} was also the revision of
the subrepo's tip.  Worse, if a hash was passed in, the command would abort
because that hash would either not be in the outer repo or not in the subrepo.
2015-04-27 21:15:25 -04:00
Laurent Charignon
18e5516b11 shelve: make the interactive mode experimental
While fixing issue4304: "record: allow editing new files" we introduced
changes in record/crecord. These changes need to be matched with changes in any
command using record. Shelve is one of these commands and the changes have
not been made for this release. Therefore, shelve -i should be an experimental
feature for this release.
2015-04-27 15:36:10 -07:00
Siddharth Agarwal
222edc51db help: also hide options marked EXPERIMENTAL
Similar to DEPRECATED, add a way to indicate that options are EXPERIMENTAL.
2015-04-27 15:12:41 -07:00