Commit Graph

8133 Commits

Author SHA1 Message Date
Matt Mackall
b907416f7b merge with stable 2015-03-02 01:20:14 -06:00
Matt Harbison
b740e2a862 test-obsolete: use 'log -T {node}' instead of 'id --debug -i' to lookup hash
I ran into a case when adding a test where there were cryptic hg command line
errors.  I eventually traced it back to 'hg id' printing debug messages before
the hash:

    invalid branchheads cache (served): tip differs <hash>

This method should eliminate any other output except the node.
2015-02-28 01:12:54 -05:00
Matt Mackall
6decf56e3e merge with stable 2015-02-27 17:46:03 -06:00
Gregory Szorc
bcba93c7f5 tests: add test showing tags cache drops filtered heads (issue4550)
The tags cache can lose .hgtags filenode entries for filtered heads. Add
a test demonstrating this (bad) behavior.
2015-02-24 00:08:04 -08:00
Martin von Zweigbergk
07f7ea01b3 subrepo: add tests for change/remove conflicts
There are currently no tests for change/remove conflicts of subrepos,
and it's pretty broken. Add some tests demonstrating some of the
breakages and fix the most obvious one (a KeyError when trying to look
up a subrepo in the wrong context).
2015-02-17 23:20:55 -08:00
Yuya Nishihara
28b8cb187f shellquote: fix missing quotes for empty string
"hg kdiff3 -rREV" did not work because 72640182118e and 295ba4ee1d13 failed
to handle empty argument.
2015-02-11 19:57:07 +09:00
FUJIWARA Katsunori
d70128b84b largefiles: access to specific fields only if largefiles enabled (issue4547)
Even if largefiles extension is enabled in a repository, "repo"
object, which isn't "largefiles.reposetup()"-ed, is passed to
overridden functions in the cases below unexpectedly, because
extensions are enabled for each repositories strictly.

  (1) clone without -U:
  (2) pull with -U:
  (3) pull with --rebase:

    combination of "enabled@src", "disabled@dst" and
    "not-required@src" cause this situation.

       largefiles     requirement
    @src     @dst     @src            result
    -------- -------- --------------- --------------------
    enabled  disabled not-required    aborted unexpectedly
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------
    enabled  enabled  *               success
    -------- -------- --------------- --------------------
    disabled enabled  *               success (only for "pull")
    -------- -------- --------------- --------------------
    disabled disabled not-required    success
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------

  (4) update/revert with a subrepo disabling largefiles

In these cases, overridden functions cause accessing to largefiles
specific fields of not "largefiles.reposetup()"-ed "repo" object, and
execution is aborted.

  - (1), (2), (4) cause accessing to "_lfstatuswriters" in
    "getstatuswriter()" invoked via "updatelfiles()"

  - (3) causes accessing to "_lfcommithooks" in "overriderebase()"

For safe accessing to these fields, this patch examines whether passed
"repo" object is "largefiles.reposetup()"-ed or not before accessing
to them.

This patch chooses examining existence of newly introduced
"_largefilesenabled" instead of "_lfcommithooks" and
"_lfstatuswriters" directly, because the former is better name for the
generic "largefiles is enabled in this repo" mark than the latter.

In the future, all other overridden functions should avoid largefiles
specific processing for efficiency, and "_largefilesenabled" is better
also for such purpose.

BTW, "lfstatus" can't be used for such purpose, because some code
paths set it forcibly regardless of existence of it in specified
"repo" object.
2015-02-26 06:03:39 +09:00
Yuya Nishihara
4c5195bbaa templatekw: fix {join(bookmarks, sep)} to always show associated bookmarks
The default joinfmt, "x.values()[0]", can't be used here because it picks
either 'bookmark' or 'current' randomly.

I got wrong result with PYTHONHASHSEED=1 on my amd64 machine.
2015-02-18 22:17:35 +09:00
Sean Farley
6ef832d911 test: make test-extdiff resilient to */gnubin/echo
My Mac test machine has 'echo' in '/opt/local/libexec/gnubin/echo' since, well,
GNU is not BSD.

Also, I feel it need to be said about using regexes:

Some people, when confronted with a problem, think "I know, I'll use regular
expressions." Now they have two problems.
2015-02-26 10:23:04 -08:00
FUJIWARA Katsunori
8a439b3cc6 revset: mask specific names for named() predicate
Before this patch, revset predicate "tag()" and "named('tags')" differ
from each other, because the former doesn't include "tip" but the
latter does.

For equivalence, "named('tags')" shouldn't include the revision
corresponded to "tip". But just removing "tip" from the "tags"
namespace causes breaking backward compatibility, even though "tip"
itself is planned to be eliminated, as mentioned below.

    http://selenic.com/pipermail/mercurial-devel/2015-February/066157.html

To mask specific names ("tip" in this case) for "named()" predicate,
this patch introduces "deprecated" into "namespaces", and makes
"named()" predicate examine whether each names are masked by the
namespace, to which they belong.

"named()" will really work correctly after 3.3.1 (see a3c326a7f57a for
detail), and fixing this on STABLE before 3.3.1 can prevent initial
users of "named()" from expecting "named('tags')" to include "tip".

It is reason why this patch is posted for STABLE, even though problem
itself isn't so serious.

This may have to be flagged as "(BC)", if applied on DEFAULT.
2015-02-05 14:45:49 +09:00
Augie Fackler
69e342baa2 log: fix json-formatted output when file copies are listed (issue4523) 2015-02-02 14:26:47 -05:00
FUJIWARA Katsunori
c3172b4737 revset: get revision number of each node from target namespaces
Before this patch, revset predicate "named()" uses each nodes gotten
from target namespaces directly.

This causes problems below:

  - combination of other predicates doesn't work correctly, because
    they assume that revisions are listed up in number

  - "hg log" doesn't show any revisions for "named()" result, because:

    - "changeset_printer" stores formatted output for each revisions
      into dict with revision number (= ctx.rev()) as a key of them

    - "changeset_printer.flush(rev)" writes stored output for
      the specified revision, but

    - "commands.log" invokes it with the node, gotten from "named()"

  - "hg debugrevspec" shows nodes (= may be binary) directly

Difference between revset predicate "tag()" and "named('tags')" in
tests is fixed in subsequent patch.
2015-02-03 21:56:29 +09:00
FUJIWARA Katsunori
6a05d7fab8 revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.

This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".

This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.

This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:

  predicate  "literal:"  "re:"
  ---------- ----------- ------------
  bookmark   abort       abort
  named      abort       abort
  tag        abort       continue (*1)

  branch     abort       continue (*2)
  ---------- ----------- ------------

"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).

On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.

This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-31 01:00:50 +09:00
Matt Harbison
b0c0e689b9 largefiles: don't interfere with logging normal files
The previous code was adding standin files to the matcher's file list when
neither the standin file nor the original existed in the context.  Somehow, this
was confusing the logging code into behaving differently from when the extension
wasn't loaded.

It seems that this was an attempt to support naming a directory that only
contains largefiles, as a test fails if the else clause is dropped entirely.
Therefore, only append the "standin" if it is a directory.  This was found by
running the test suite with --config extensions.largefiles=.

The first added test used to log an additional cset that wasn't logged normally.
The only relation it had to file 'a' is that 'a' was the source of a move, but
it isn't clear why having '.hglf/a' in the list causes this change:

    @@ -47,6 +47,11 @@

     Make sure largefiles doesn't interfere with logging a regular file
       $ hg log a --config extensions.largefiles=
    +  changeset:   3:2ca5ba701980
    +  user:        test
    +  date:        Thu Jan 01 00:00:04 1970 +0000
    +  summary:     d
    +
       changeset:   0:9161b9aeaf16
       user:        test
       date:        Thu Jan 01 00:00:01 1970 +0000

The second added test used to complain about a file not being in the parent
revision:

    @@ -1638,10 +1643,8 @@

     Ensure that largefiles doesn't intefere with following a normal file
       $ hg  --config extensions.largefiles= log -f d -T '{desc}' -G
    -  @  c
    -  |
    -  o  a
    -
    +  abort: cannot follow file not in parent revision: ".hglf/d"
    +  [255]
       $ hg log -f d/a -T '{desc}' -G
       @  c
       |

Note that there is still something fishy with the largefiles code, because when
using a glob pattern like this:

    $ hg log 'glob:sub/*'

the pattern list would contain '.hglf/glob:sub/*'.  None of the tests show this
(this test lives in test-largefiles.t at 1349), it was just something that I
noticed when the code was loaded up with print statements.
2015-01-30 20:44:11 -05:00
Pierre-Yves David
1cc9c00470 discovery: properly exclude locally known but filtered heads
The conditional was a bit too narrow and produced buggy result when a node was
present in both common and heads (because it pleased the discovery) and it was
locally known but filtered.

This resulted in buggy getbundle request and server side crash.
2015-01-30 21:11:02 +00:00
Pierre-Yves David
0616b8f246 test: make test-extdiff resilient to /usr/bin/echo
My test machine has 'echo' in '/usb/bin/echo', #dontaskmewhy.
2015-01-30 21:40:30 +00:00
FUJIWARA Katsunori
2ad325e10a merge: mark .hgsubstate as possibly dirty before submerge for consistency
Before this patch, failure of updating subrepos may cause inconsistent
".hgsubstate". For example:

  1. dirstate entry for ".hgsubstate" of the parent repo is filled
     with valid size/date (via "hg state" or so)

  2. "hg update" is invoked at the parent repo

  3. ".hgsubstate" of the parent repo is updated on the filesystem as
     a part of "g"(et) action in "merge.applyupdates"

  4. it is assumed that size/date of ".hgsubstate" on the filesystem
     aren't changed from ones at (1)

     this is not so difficult condition, because just changing hash
     ids (every ids are same in length) in ".hgsubstate" doesn't
     change the file size of it

  5. "subrepo.submerge()" is invoked to update subrepos

  6. failure of updating in one of subrepos raises exception
     (e.g. "untracked file differs")

  7. "hg update" is aborted without updating dirstate of the parent repo

     dirstate entry for ".hgsubstate" still holds size/date at (1)

Then, ".hgsubstate" of the parent repo is treated as "CLEAN"
unexpectedly, because updating ".hgsubstate" at (3) doesn't change
size/date of it on the filesystem: see assumption at (4).

This inconsistent ".hgsubstate" status causes unexpected behavior, for
example:

  - "hg revert" forgets to revert ".hgsubstate"

  - "hg update" misunderstands that (not yet updated) subrepos diverge
    (then, it shows the prompt to confirm user's decision)

To avoid inconsistent ".hgsubstate" status above, this patch marks
".hgsubstate" as possibly dirty before "submerge" invocation.
"normallookup"-ed (= dirty) dirstate should be written out, even if
processing is aborted by failure.

This patch marks ".hgsubstate" as possibly dirty before "submerge",
also when it is removed or merged while merging, for safety. This
should prevent Mercurial from misunderstanding inconsistent
".hgsubstate" as clean.

To satisfy conditions at (1) and (4) above, this patch uses "hg status
--config debug.dirstate.delaywrite=2" (to fill valid size/date into
dirstate) and "touch" (to fix date of the file).
2015-01-30 04:59:05 +09:00
Pierre-Yves David
3e6abb6494 rebase: ensure rebase revision remains visible (issue4504)
Before this changeset rebase was getting very confused if any revision in the
rebase set became hidden. This was fairly easy to achieve if a rebased revision
was made visible by the working copy location. The rebase process would update
somewhere else and the revision would become hidden.

To work around this issue, we ensure rebased revisions remain visible for the
whole process.

This is a simple change suitable for stable. More subtle usage of unfiltered
repository in rebase may solve this issue more cleanly.
2015-01-27 12:33:56 +00:00
Mads Kiilerich
a59deecf40 extdiff: reintroduce backward compatibility with manual quoting of parameters
b8552020f458 broke things ... and the following cleanups didn't fix all issues.
It didn't work with the diffargs shipped in mergetools.rc with explicit
quoting. Parameters would end up with being quoted twice - especially if they
really needed quoting.

To work around that, look for explicit quotes around the variables that will be
substituted with proper quoting. Also accept an additional prefix so we can
handle both
  --foo='$parent'
and
  '--foo=$parent'

It will however still fail if the user intentionally place the variable inside
a quoted string, as in
  'parent $parent is on the left'
There is currently no good way to handle that, short of knowing exactly which
quoting mechanism will be used.
2015-01-28 02:28:39 +01:00
Matt Harbison
12ec4872c6 subrepo: don't abort in add when non-hg subrepos are present (issue4513)
This change should have been part of a5602d49abba.
2015-01-27 20:57:43 -05:00
Matt Harbison
d92b702a94 largefiles: revert to lfilesrepo.status() being an unfiltered method
This effectively reverts 9fc565fa1621, which caused some normal file copies to
not be displayed as copies.  Other normal file copies could be displayed- the
exact reason isn't clear.  This also adds two tests that were failing prior to
this backout, so that this can be sorted out next cycle.

The difference between copy cases that worked and those that didn't seemed to be
in copies.pathcopies().  When largefiles isn't enabled for the changed test, or
lfstatus is not set in the commands.status() override, 'y.ancestor(x) == x'.
That wasn't true otherwise, which fell through to the _chain() method.  In this
case, the copy is removed in the criss cross loop.

'y.ancestor(x)' returns a context.changectx type, while 'x' is a lfilesctx type
in the failing case.  I tried adding the ancestor method to the lfilesctx class
to change the type of the ancestor context, however the context when printed as
a string then gains a '+'.  This points to it being a context.committablectx,
which clearly isn't correct for an ancestor.  Possibly the problem is the
lfilesctx needs to subclass context.committablectx in some cases, but
context.changectx in others, within the same invocation?  I'm not sure how to
pull that off, and backing out this change is safer during the freeze.

As to the status changing when a path is specified, I haven't looked into it
yet.
2015-01-25 22:55:10 -05:00
Matt Mackall
81a40bb2be test-tools: portability tweak 2015-01-25 20:13:54 -06:00
Yuya Nishihara
b5f973788a revset: fix ancestors(null) to include null revision (issue4512)
Since fe39bbbf31f0, null parent is explicitly excluded. So, there is no reason
to have nullrev in the initial seen set.
2015-01-25 20:20:27 +09:00
Mateusz Kwapich
f867af76c9 histedit: add --edit-plan option to histedit
--edit-plan allows user to edit remaining histedit rules in the middle of
histedit process
2015-01-22 12:36:38 -08:00
Jordi Gutiérrez Hermoso
454d10a54c churn: deprecate -t option in favour of -T
We use -T consistently elsewhere to refer to the --template option.
The old -t option is now renamed to --oldtemplate so that -t still
works. This has the benign side effect of introducing and immediately
deprecating a new long option.

We also test with both -t and -T options.
2015-02-24 11:37:07 -05:00
Thomas Arendsen Hein
498dfaa7d6 pull: print "pulling from foo" before accessing the other repo
1. This is consistent with pushing.
2. This allows to see the URL of the other repo in case accessing the repo
   fails, e.g. wrong ssh path or issues with the https certificate, without
   using --debug or showconfig paths.

Additionally add test for this in the context of ssh with a wrong path.
2015-02-24 10:55:24 +01:00
Anton Shestakov
1b9c15214b hgweb: use introrev() for finding parents (issue4506)
The issue is titled "filtered revision 'XXX' (not in 'served' subset)" and that
is the error message you sometimes get when trying to look at a file (/file or
/annotate) in hgweb. For example:

http://hg.intevation.org/mercurial/crew/file/8414f8487b33/mercurial/cmdutil.py

This happens when a parent revision for a file is hidden, thus it is
not 'served' and isn't accessible in hgweb by default. When hgweb tries to
access such changeset, it produces the error and HTTP status code 404.

Another detail is that the parents() function, that is used in multiple places
in hgweb, sometimes returned changesets that were obsoleted by the current
changeset for the file. For example, when using rebase with evolve and rebasing
a divergent changeset that introduces a file on top of current branch. Or
grafting a change and making the new grafted changeset obsolete the source
(shown in the test case). The result is the same - the obsoleted changeset was
mistakingly returned from parents(), even though it's not a parent and the only
link to the new changeset is an obsoletion marker (and rebase/graft metadata?
not sure it matters).

The problem is fixed by using introrev() instead of linkrev() for finding
parents. This prevents parents() function from returning unrelated obsolete
changesets.

The test case prepares a separate repo because (afaict) all other test cases
never reuse file names, so there are no files that were changed in multiple
changesets. So no previously available files have obsolete changesets in their
history.
2015-02-19 19:32:06 +08:00
Matt Harbison
ee0eea92e1 revert: display full subrepo output with --dry-run
Since the point of --dry-run is to show what will happen, the output with and
without it should agree.  And since revert wasn't being called on subrepos with
--dry-run before, revert in the subrepo had to be defanged in this case.
2015-02-07 21:47:28 -05:00
Matt Harbison
d3f2dde965 largefiles: don't warn when reverting a forgotten largefile
Previously, when a largefile is forgotten and then reverted, a warning was
issued:

   $ hg revert -R subrepo subrepo/large.txt
   file not managed: subrepo/large.txt (glob)

This was purely cosmetic as the file itself actually was reverted.

The problem was even with all of the matcher patching, the largefile pattern
given on the command line wasn't converted to a standin because the standin was
neither in ctx nor wctx.  This causes the named largefile to be added to the
'names' dict in cmdutil.revert() in the repo walk at line 2550.  The warning was
printed out when the 'names' dict is iterated, because the file was specified
exactly.

Since core revert recurses into subrepos and largefiles only overrides the
revert method in commands.py, it doesn't work properly when reverting a subrepo.
However, it still will recurse into the subrepo and call the installed matcher
method, so lfdirstate is reopened for the current repo level to prevent any new
problems.
2015-02-07 19:40:02 -05:00
Anton Shestakov
dfeb532e8f hgweb: clearly outline <tr> block in paper/changeset.tmpl
This particular <tr> block should use the style of its neighboring blocks,
otherwise it's easy to think that the closing '</tr>' is missing.
2015-01-10 21:37:42 +08:00
Yuya Nishihara
34b5e5774a resolve: port to generic templater
Test output changes because color labels are applied separately.
2015-02-11 13:59:13 +09:00
Yuya Nishihara
ab0dd2e3c1 resolve: silence warning of unknown pats for -l/--list (BC)
It was introduced at 1e92106a20bc to warn that "hg resolve" did nothing
meaningful. The warning seems not good for "hg resolve -l" because it is
rather like "hg status" or "hg files".
2015-02-11 13:47:43 +09:00
Ryan McElroy
54e6a6adbc extensions: allow extending command synopsis and docstring
Mercurial uses a synopsis string and the docstring of a command for the
command's help output. Today  there is no way for an extension that adds
functionality to a command to extend either of these help strings.

This patch enables appending to both the doctring and the synopsis, and adds
a test for this functionality. Example usage is shown in the test and is also
described in the docstring of extensions.wrapcommand().
2015-02-09 11:02:45 -08:00
Martin von Zweigbergk
1568f5ba1d test-merge-tools: fix flaky test by avoiding debugsetparents
debugsetparents is a debug command and does not provide the same
guarantees as non-debug commands do. In particular, when the user sets
a different parent, any clean files will remain clean in the dirstate
even though the new parent might have a different version of the file
(so it should appear modified compared to the new parent). Let's
instead achieve the same effect by updating to the new parent and
reverting the contents back to what they were.

This fix can be tested by passing '--config
debug.dirstate.delaywrite=2' to the 'hg update' command in the
beforemerge().
2015-02-10 16:17:15 -08:00
Yuya Nishihara
ed458b9332 log: use rev() to build revset of --follow option from numeric revision
startrev can be -1.
2015-01-10 13:14:00 +09:00
Yuya Nishihara
78d778b5ef revset: allow rev(-1) to indicate null revision (BC)
This can simplify the conversion from numeric revision to string. Without it,
we have to handle -1 specially because repo['-1'] != repo[-1].

The -1 revision is not officially documented, but this change makes sense
assuming that "rev(%d)" exists for scripting or third-party tools.
2015-01-10 12:56:38 +09:00
Matt Mackall
45d5d3b1b1 test-hgweb: fix shutdown race
Logfiles weren't necessarily being flushed before being read.
2015-01-23 17:47:04 -06:00
FUJIWARA Katsunori
b75f854207 tests: invoke hg command indirectly from shell script to run on Windows
Before this patch, test-tag.t can't run successfully on Windows,
because:

  - quoted hg command ('"hg"') prevents "hg.bat" from working correctly
    (only at testing with pure Python build)

    "%~f0" and "%~dp0hg" in "hg.bat" cause unexpected result in this
    case. BTW, quoted "\path\to\hg" works correctly.

  - "`pwd`" in the command line is expanded unexpectedly

    not "C:\path\to\TESTTMP" but "C;C:\path\to\TESTTMP"
2015-01-22 00:08:13 +09:00
Martin von Zweigbergk
4b40ac0110 log: evaluate filesets on working copy, not its parent
When running "hg log 'set:added()'", we create two matchers: one used
for producing the revset and one used for finding files to match. In
185b6b930e8c (graphlog: evaluate FILE/-I/-X filesets on the working
dir, 2012-02-26), we started passing a revision argument along from
what's currently in cmdutil._makelogrevset() to
revset._matchfiles(). When the revision was an empty string, it
referred to the working copy. This was subtly done with "repo[rev or
None]". Then, in 5ff5c5c9e69f (revset: avoid recalculating filesets,
2014-10-22), that conversion from empty string to None was lost. Note
that repo[''] is equivalent to repo['.'], not repo[None].

The consequence of this, to the user, is that when running "hg log
'set:added()'", the file matcher matches files added in the working
copy, while the revset matcher matches revisions that touch files
added in the parent of the working copy. As a result, only revisions
that touch any files added in the parent of the working copy will be
considered, but they will only be included if they also touch files
added in the working copy.

Fix the bug by converting '' to None again, but make it a little more
explicit this time (plus, we now have tests for it).
2015-01-21 15:23:13 -08:00
Martin von Zweigbergk
90400ce919 fileset: add tests of generated working copy states 2015-01-21 15:40:24 -08:00
Eric Sumner
fa1eb17d62 repair._bundle: fix traceback for bad config value
On IRC, rom1dep reported a traceback[1] from setting
experimental.strip-bundle2-version to True. This diff catches
unexpected values and falls back to the non-experimental bundle1
implementation after issuing a warning.

[1] http://gist.tamytro.org/_admin/gists/qXcdQLwtApgy6e3NwWgl
2015-01-21 15:54:52 -08:00
Mathias De Maré
d2e939ddb5 subrepo: correctly add newline for git subrepo diffs
Previously, git subrepo diffs did not have a newline at the end.
This caused multiple subrepo diffs to be joined on the same line.
Additionally, the command prompt after the diff still contained
a part of the diff.
2015-01-21 21:47:27 +01:00
FUJIWARA Katsunori
9c68e572c7 tests: discard useless "(glob)" in "reverting subrepo" lines 2015-01-22 00:10:26 +09:00
FUJIWARA Katsunori
7162b6792b run-tests.py: inherit --pure option from outer run-tests.py execution
Before this patch, "test-run-tests.t" doesn't test "run-tests.py" with
"--pure", even if outer "run-tests.py" is executed with it.

This patch uses not "HG_RUN_TESTS_PURE" but "HGTEST_RUN_TESTS_PURE",
because "HG_" prefixed environments are forcibly dropped in "_getenv()".

This is also useful to run "run-tests.py" successfully by
"run-tests.py --pure" on Windows without any compilation tools (like
VisualStudio).
2015-01-22 00:07:06 +09:00
FUJIWARA Katsunori
6fd4318051 hg.bat: return exit code explicitly for indirect invocation
When "hg.bat" is invoked via interactive shell "cmd.exe" on Windows,
it can store own exit code into ERRORLEVEL correctly, regardless of
explicit "exit" statement in it: "cmd.exe" seems to hold ERRORLEVEL
updated by the last command in the batch file (= "python hg", in
"hg.bat" case).

On the other hand, "hg.bat" is invoked indirectly via
"subprocess.Popen" (e.g. shell alias, hooks, hgclient and so on), the
parent process always receives exit code 0 from spawned "hg.bat":
batch files on Windows seem not to be really spawned like as shell
scripts on UNIX, but to be executed in the "cmd.exe" process.

This patch returns exit code explicitly for indirect invocation.

"/b" should be specified for "exit" to prevent "cmd.exe" from being
terminated when "hg.bat" is invoked interactively from it.
2015-01-22 00:07:06 +09:00
FUJIWARA Katsunori
30be0460c5 run-tests.py: execute hghave with same env vars as ones for actual tests
Before this patch, "run-tests.py" executes "hghave" process without
any modifications for environment variables, even though actual tests
are executed with LC_ALL, LANG and LANGUAGE explicitly assigned "C".

When "run-tests.py" is executed:

  - with non-"C" locale environment variables on any platforms, or

  - without any explicit locale environment setting on Windows
    (only for "outer-repo" feature using "hg root")

external commands indirectly executed by "hghave" may show translated
messages.

This causes incorrect "hghave" result and skipping tests, because some
regexp matching of "hghave" expect external commands to show
un-translated messages.

To prevent external commands from showing translated messages, this
patch makes "run-tests.py" execute "hghave" with same environment
variables as ones for actual tests.

This patch doesn't make "hghave" execute external commands forcibly
with LC_ALL, LANG and LANGUAGE explicitly assigned "C", because
changing "run-tests.py" is cheaper than changing "hghave":

  - "os.popen" should be replaced by "subprocess.Popen" or so, and
  - setting up environment variables should be newly added
2015-01-22 00:03:58 +09:00
Ryan McElroy
df23a78928 commit: remove reverse search for copy source when not in parent (issue4476)
Previously, we had weird, nonsensical behavior when committing a file move
with a missing source. This removes that weird logic and tests that the bug
this strange behavior caused is fixed. Also adds a longish comment to prevent
some poor soul from accidentally re-implementing the bug in the future.
2015-01-20 15:05:44 -08:00
Martin von Zweigbergk
fc35342dbb diff: use binary diff when copy source is binary
When a binary source has been copied or renamed into a non-binary
file, we don't check whether the copy source was binary. There is a
code comment explaining that a git mode will be forced anyway in order
to capture the copy record (i.e. losedatafn() will be called). This is
true, but forcing git mode is not the only effect binary files have:
when git mode was already requested, we use the binary-ness to tell us
whether to use a regular unified diff or a git binary diff. The user
sees this as a "Binary file $file has changed" instead of the binary
2015-01-17 15:03:41 -08:00
Matt Harbison
d75d4a993b largefiles: fix commit of a directory with no largefile changes (issue4330)
When a directory is named in the commit file list, the previous behavior was to
walk the list, and if no normal files in the directory were also named, add the
corresponding standin for each largefile in that directory.  The directory is
then dropped from the list, so that committing a directory with no normal file
changes works.  It then added the corresponding standin directory for the first
largefile seen, by prefixing it with '.hglf/'.

The latter is unnecessary since each affected largefile is explicitly referenced
by its standin in the list.  It also caused an abort if there were no changed
largefiles in the directory, because none of its standins changed:

    abort: .hglf/foo/bar: no match under directory!

This list of files is used to tweak a matcher in lfutil.updatestandinsbymatch(),
which is what is passed to commit().

The status() call that is ultimately done in the commit code with this matcher
seems to have some OS specific differences.  It is not necessary to append '.'
for Windows to run the largefiles tests cleanly.  But if '.' is not added to the
list, the match function isn't called on Linux, so status() would miss any
normal files that were also in a named directory.  The commit then proceeds
without those normal files, or says "nothing changed" if there were no changed
largefiles in the directory.  This is not filesystem specific, as VFAT on Linux
had the same behavior as when run on ext4.  It is also not an issue with
lfilesrepo.status(), since that only calls the overridden implementation when
paths are passed to commit.  I dont have access to an OS X machine ATM to test
there.

Maybe there's a better way to do this.  But since the standin directory for the
first largefile was previously being added, and that caused the same walk in
status(), there's no preformance change to this.  There is no danger of
erroneously committing files in '.', because the original match function is
called, and if it fails, the lfutil.updatestandinsbymatch() tweaked matcher only
indicates a match if the file is in the list of standins- and '.' never is.  The
added tests confirm this.
2015-01-18 15:15:40 -05:00
Matt Harbison
29a41ca7e1 test-tools: update for platforms without symlink support after 8b3d80bb3890
The change was triggered by removing the 'baz' hardlink.
2015-01-18 16:38:56 -05:00