Commit Graph

23765 Commits

Author SHA1 Message Date
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
Augie Fackler
f4bab3a3b0 parsers: avoid leaking several PyObjects in index_stats
Found with cpychecker.
2015-01-23 15:55:36 -05:00
Augie Fackler
73a9456239 parsers: don't leak a reference to raise_revlog_error on success
Found with cpychecker.
2015-01-23 15:50:40 -05:00
Augie Fackler
97b88be1c1 parsers: don't leak a tuple in pack_dirstate
Spotted with cpychecker.
2015-01-23 15:48:18 -05:00
Augie Fackler
e20c9721be parsers.c: fix a memory leak in index_commonancestorsheads
Spotted with cpychecker.
2015-01-23 15:41:46 -05:00
Augie Fackler
4ef5247a75 parsers: avoid leaking obj in index_ancestors
PySequence_GetItem returns a new reference. Found with cpychecker.
2015-01-23 15:33:27 -05:00
Augie Fackler
b5ac153d88 parsers: don't leak references to sys et al in check_python_version
Found with cpychecker.
2015-01-23 15:30:21 -05:00
Augie Fackler
da503cae80 parsers: fix leak of err when asciilower hits a unicode decode error
This is one of many errors detected in parsers.c by cpychecker[1]. I
haven't gone through all of them yet.

1: https://gcc-python-plugin.readthedocs.org/en/latest/index.html
2015-01-23 15:19:04 -05:00
Mads Kiilerich
247f1e9aff largefiles: use 'default' path for pulling largefiles, not 'default-push'
The put parameter has been unused since day 0.
2015-01-23 18:41:37 +01:00
Mads Kiilerich
031d0b9afc osx: patch .pax.gz files in pkg bundles so they extract as root (issue4081)
The packages has to be installed by root but they would be installed
insecurely, owned by the uid of the unprivileged user that made the package.
The local user with that uid could thus write to /usr/local/bin/hg .

bdist_mpkg calls out to pax to create the package, but pax do apparently not
have the power to control what it is writing.

Instead, patch the pax files and set their uid fields to 0 before they are
wrapped in a dmg.
2015-01-23 06:28:28 +01: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
0ef76b45c5 check-code.py: avoid warning against "reverting subrepo ..." lines
Before this patch, "reverting subrepo subrepo/path" lines in *.t test
files require "(glob)", because such lines are recognized as
"reverting path/to/managed/file" by "check-code.py".

On the other hand, "(glob)" for such "reverting ..." line is
recognized as useless by "runt-tests.py", because subrepo paths shown
in such lines are always normalized by "util.pconvert". And this
causes "no result code from test" warning.

As a preparation for discarding "(glob)" from such lines in subsequent
patch, this patch avoids warning against them, by adding negative
lookahead assertion "(?!subrepo )" to the regexp.
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
Mads Kiilerich
e7afe1bb24 osx: use bdist_mpkg.script_bdist_mpkg module instead of bdist_mpkg command
It seems like a default installation of bdist_mpkg makes it available as
Python module, but the corresponding executable is placed in a location like
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/bin which is
not in $PATH and thus not directly available. 'make osx' would thus fail.

Instead, skip the bdist_mpkg executable and invoke it as a Python module. That
works out of the box here.
2015-01-21 05:04:48 +01:00
Mads Kiilerich
fc3f4381fd osx: don't launch installer after building it with bdist_mpkg
bdist_mpkg do for some reason default to use the parameter --show ("Open with
Installer.app after building") if no parameters are specified. We do not like
that.

All the important parameters to bdist_mpkg are already specified in setup.py
and we don't have any to specify in the Makefile.

Instead, specify the parameter '--' which do no harm but will disable the
default opening of the installer. This makes it possible to build packages
"silently".
2015-01-21 05:04:46 +01:00
Mads Kiilerich
509ce58a92 osx: update "Read Me" "Important Information" text in the package installer
Nothing fancy here, just making the text less specific and less wrong by not
mentioning OS X version and Python versions and wrong URLs.
2015-01-21 05:01:01 +01: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
Matt Mackall
edbd640549 merge with i18n 2015-01-20 14:51:11 -08:00
Matt Harbison
b0bba90545 convert: handle LookupError in mercurial_source.lookuprev()
This is in line with the documentation on the base class method, and is related
to issue4496 (but doesn't fix the reporter's problem of not mangling other data
that matches a revision pattern).  Now instead of aborting when there is an
ambiguous source rev, it simply won't update the commit comment.  A warning
message might be nice, but a None return masks whether the problem was no
matching revision, or more than one.

The only other caller of this is the logic that converts tags, but those are
never ambiguous since they are always 40 characters.

A test isn't feasible because there simply aren't enough commits in the test
suite repos to have an ambiguous identifier that is at least 6 characters long,
and it would be too easy for the ambiguity to disappear when unrelated changes
are made.  Instead, I simply ran 'hg --traceback log -r c' on the hg repo, and
handled the error it threw.
2015-01-18 22:21:53 -05:00
Sean Farley
ac6542ef7d color: add missing 'dim' in _effects
It seems that this has been missing for people running in 'ansi' mode.
2015-01-18 22:24:14 -08:00
Wagner Bruna
465fe55cbb i18n-pt_BR: synchronized with 962d40fe1951 2015-01-18 11:16:45 -02:00
Matt Mackall
0f21ce8a7b Added signature for changeset 962d40fe1951 2015-01-17 18:29:30 -08:00
Wagner Bruna
41a26dac7c messages: quote "hg help" hints consistently 2015-01-17 22:01:14 -02:00
Matt Mackall
50094eea66 bundle2: fix parttype enforcement
As spotted by Malte Helmert.
2015-01-17 18:08:47 -08:00
Matt Mackall
062f7143b4 test-tools: another vfat fix 2015-01-17 17:59:30 -08:00
Matt Mackall
6a5f375092 test-tools: check for unix permissions for hardlinking 2015-01-17 15:54:03 -08:00
Matt Mackall
a465711f55 tests: more fixes for f 2015-01-17 15:28:56 -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
Matt Harbison
7dc1c47caa tests: add "(glob)" to output in test-histedit-commute.t for Windows
This goes with the changes in 15651e6519fe.
2015-01-18 16:33:41 -05:00
Matt Mackall
733026a365 tests: teach f not to report symlink mode bits
They're not meaningful or portable
2015-01-17 13:53:56 -08:00
Matt Mackall
f958134a57 tests: teach f not to report directory size
It's not meaningful or portable
2015-01-17 13:53:16 -08:00
Matt Mackall
5a5c780e62 test-histedit-commute: call helper script with sh
Buildbot pointed out that this test wasn't passing on Linux+vfat
because there's no chmod for shell scripts.
2015-01-17 13:44:43 -08:00
Matt Mackall
43dd91c6b3 test-tools: fix portability issues 2015-01-17 13:38:17 -08:00
Solomon Matthews
e1cf94d870 progress: add a lock to prepare for introducing a thread 2015-01-17 13:13:16 -08:00
Solomon Matthews
1d635183e5 progress: move update check into helper method 2015-01-17 13:10:37 -08:00
Solomon Matthews
ba1de727b3 progress: move current topic to member variable 2015-01-17 13:09:33 -08:00
Solomon Matthews
45e1c600f4 progress: add try/finally to make the diffs for the next commit more readable
No change in behavior.
2015-01-15 20:03:28 -08:00
Pierre-Yves David
be1b3a5e03 transaction: include backup file in the "undo" transaction
Once the transaction is closed, we now write transaction related data for
possible future undo. For now, we only do it for full file "backup" because
their were not handle at all in that case. In the future, we could move all the
current logic to set undo up (that currently exists in localrepository) inside
transaction itself, but it is not strictly requires to solve the current
situation.
2015-01-16 18:34:14 -08:00
Pierre-Yves David
8984d47c1b transaction: pass the name of the "undo" journal to the transaction
It is time for the transaction to be responsible for setting up the
undo data. It is necessary to move this logic into the transaction
because many more files are handled now, and the transaction is the
object tracking them all.

The value can be set to None if no undo should be set.
2015-01-16 19:35:04 -08:00
Pierre-Yves David
8fe1e98490 rollback: have an empty entry for the vfsmap in rollback
This empty string key is used for the store. This will be needed to properly
rollback backup in a future changesets.
2015-01-16 19:29:16 -08:00
Pierre-Yves David
03d5cdc6b3 transaction: clarify the name of 'journal' argument for transaction
The argument is a string containing the journal name (used as prefix for all
other transaction file). This is not the transaction file itself. So we clarify
this.
2015-01-16 14:54:24 -08:00
Pierre-Yves David
09bcff37bf transaction: use 'util.copyfile' for creating backup
Using 'copyfile' (single file) instead of 'copyfiles' (tree) will ensures
destination file will be overwritten. This will prevent some abort if backup
file are left in place for random reason.

It also seems more correct.
2015-01-05 12:44:15 -08:00
Pierre-Yves David
71304e633e copyfile: allow optional hardlinking
Some code paths use 'copyfiles' (full tree) for a single file to take advantage
of the best-effort-hard-linking parameter. We add similar parameter and logic
to 'copyfile' (single file) for this purpose.

The single file version have the advantage to overwrite the destination file if
it exists.
2015-01-05 12:39:09 -08:00