Commit Graph

22967 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
bcb1d86a49 tests: introduce "checkeditform-n-cat.sh" script to invoke "cat" in it safely
Before this patch, a part of "test-transplant.t" fails unexpectedly on
Windows environment, because semicolon (";") in HGEDITOR isn't
recognized as the command separator by "cmd.exe".

This patch newly introduces "checkeditform-n-cat.sh" script to invoke
"cat" in it safely anywhere.
2014-10-28 00:19:18 +09:00
Jordi Gutiérrez Hermoso
d3b97d5baf doc: change 'revision or range' to 'revision or revset'
The phrase "revision or range" comes from a pre-revset era. Since the
documentation for ranges now is under the revset docs, and as a
helpful hint nudging users towards revsets, I think it's better to say
"revision or revset"
2014-10-24 13:50:00 -04:00
FUJIWARA Katsunori
f6257de7a8 largefiles: add examination of exec bit in "hg status --rev REV" case
Before this patch, "hg status --rev REV" doesn't list largefiles up
with "M" mark, even if exec bit of them is changed, because
"lfilesrepo.status" doesn't examine exec bit in such case.
2014-10-28 01:14:12 +09:00
FUJIWARA Katsunori
6a795d6783 largefiles: ignore removal status of files not managed in the target context
Before this patch, "hg status --rev REV" listed largefiles removed in
the working directory up with "R" mark, even if they aren't managed in
the REV. Normal files aren't listed up in such case.

When "lfilesrepo.status" is invoked for "hg status --rev REV", it
treats files on conditions below as "removed" (to avoid manifest full
scan in "ctx.status" ?):

  - marked as "R" in lfdirstate, or

  - files managed in the target revision but unknown in the manifest
    of the working context (= not including "R" files)

But the former can include files not managed in the target context.

To ignore removal status of files not managed in the target context,
this patch drops files unknown in the target revision from "removed"
list.
2014-10-28 01:14:11 +09:00
Mads Kiilerich
9a3561b211 changelog: use headrevsfiltered
5d1adb6683fa introduced use of the new filtering headrevs C implementation. It
caught TypeError to detect when to fall back to the implementation that was
compatible with old extensions. That method was however not reliable.

Instead, use the new headrevsfiltered function when passing a filter. It will
reliably fail with AttributeError when an old extension that predates
headrevsfiltered is used.
2014-10-26 12:14:12 +01:00
Mads Kiilerich
40c407ae08 parsers: introduce headrevsfiltered in C extension
All extensions that have this function do support filtering. The existing
headrevs function may support filtering but we cannot reliably detect whether
it does.
2014-10-26 12:14:10 +01:00
Matt Harbison
e8e311feb1 httppeer: close the temporary bundle file after two-way streaming it
This fixes several push tests in test-bundle2-exchange.t that were failing on
Windows with messages like the following:

   $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 \
        --bookmark book_32af
   pushing to http://localhost:$HGPORT2/
   searching for changes
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
   remote: 1 new obsolescence markers
   updating bookmark book_32af
   abort: The process cannot access the file because it is being used by another
            process: 'C:\path\to\tmp\bundle.hg'
   [255]
2014-10-25 21:34:49 -04:00
Martin von Zweigbergk
a97f944a97 status: make 'hg status --rev' faster when there are deleted files
In order not to avoid listing files as both added and deleted, for
example, we check for every file in the manifest if it is in the
_list_ of deleted files. This can get quite slow when there are many
deleted files. Change it to a set to make the containment check
faster. On a somewhat contrived example of the Mozilla repo with the
entire testing/ directory deleted (~14k files), this makes
'hg status --rev .^' go from 26s to 2s.
2014-10-24 14:24:28 -07:00
Pierre-Yves David
e107a615ed setdiscovery: limit the size of the initial sample (issue4411)
The set discovery start by sending a "known" command with all local heads. When
the number of local heads is massive (eg: using hidden changesets) such request
becomes too large. This lead to 414 error over http, aborting the whole
process.

We limit the size of the sample used by the first query to fix this.

The test are impacted because they do test massive number of heads. But they do
not test it over real world http setup.
2014-10-27 17:52:33 +01:00
Pierre-Yves David
d1263d8d84 setdiscovery: extract sample limitation in a _limitsample function
We need to reuse this logic for the initial query. We extract it in a function
to unsure sample limiting is applied consistently in all cases.
2014-10-27 17:40:32 +01:00
Gregory Szorc
d0818afbd4 exchange: don't report failure from identical bookmarks
48062b2d0f30 regressed the behavior of pushing an unchanged bookmark to
a remote. Before that commit, pushing a unchanged bookmark would result
in "exporting bookmark @" being printed. After that commit, we now see
an incorrect message "bookmark %s does not exist on the local or remote
repository!"

This patch fixes the regression introduced by 48062b2d0f30 by having
the bookmark error reporting code filter identical bookmarks and adds
a test for the behavior.
2014-10-24 17:24:46 -05:00
Gregory Szorc
ae20b321ce bookmarks: explicitly track identical bookmarks
bookmarks.compare() previously lumped identical bookmarks in the
"invalid" bucket. This patch adds a "same" bucket.

An 8-tuple for holding this state is pretty gnarly. The return value
should probably be converted into a class to increase readability. But
that is beyond the scope of a patch intended to be a late arrival to
stable.
2014-10-24 10:40:37 -07:00
Martin von Zweigbergk
061743c247 context.status: remove incorrect swapping of added/removed in workingctx
The comment in workingctx.status() says that "calling 'super' subtly
reveresed the contexts", but that is simply not true, so we should not
be swapping added and removed fields.
2014-10-24 15:52:20 -05:00
Martin von Zweigbergk
f5a6951636 keyword: use parent of working copy as base for status
Instead of calling repo[None].status(), use the more common form that
uses the parent of the working copy as the base:
repo['.'].status(). Note that the former defaults to comparing to
revision '.', while the latter defaults to revision None, so the
contexts being compared are the same.

It might seem like this would result in a reverse diff, but it turns
out that workingctx.status() incorrectly reverses the result. That bug
will be fixed in a later commit.
2014-10-23 13:17:37 -07:00
Anton Shestakov
1119de7215 hgweb: refresh hgweb.repo on phase change (issue4061)
Make hgweb.refresh() also look at phaseroots file (in addition to 00changelog.i
file) and reload the repo when os.stat returns different mtime or size than
cached, signifying the file was modified.

This way if user changes phase of a changeset (secret <-> draft), there's no
need to restart hg serve to see the change.
2014-09-27 21:59:55 +09:00
Matt Mackall
5f07bb0a47 help: fix typo in log examples 2014-09-29 16:42:12 -05:00
Wagner Bruna
e7e5f8b6c3 i18n-pt_BR: synchronized with 7bd2f92d9634 2014-09-22 15:39:21 -03:00
Anton Shestakov
20c415845d hgweb: fail if an invalid command was supplied in url path (issue4071)
Traditionally, the way to specify a command for hgweb was to use url query
arguments (e.g. "?cmd=batch"). If the command is unknown to hgweb, it gives an
error (e.g. "400 no such method: badcmd").

But there's also another way to specify a command: as a url path fragment (e.g.
"/graph"). Before, hgweb was made forgiving (looks like it was made in
cd356f4efd91) and user could put any unknown command in the url. If hgweb
couldn't understand it, it would just silently fall back to the default
command, which depends on the actual style (e.g. for paper it's shortlog, for
monoblue it's summary). This was inconsistent and was breaking some tools that
rely on http status codes (as noted in the issue4071). So this patch changes
that behavior to the more consistent one, i.e. hgweb will now return "400 no
such method: badcmd".

So if some tool was relying on having an invalid command return http status
code 200 and also have some information, then it will stop working. That is, if
somebody typed foobar when they really meant shortlog (and the user was lucky
enough to choose a style where the default command is shortlog too), that fact
will now be revealed.

Code-wise, the changed if block is only relevant when there's no "?cmd" query
parameter (i.e. only when command is specified as a url path fragment), and
looks like the removed else branch was there only for falling back to default
command. With that removed, the rest of the code works as expected: it looks at
the command, and if it's not known, raises a proper ErrorResponse exception
with an appropriate message.

Evidently, there were no tests that required the old behavior. But, frankly, I
don't know any way to tell if anyone actually exploited such forgiving behavior
in some in-house tool.
2014-09-22 23:46:38 +09:00
Mike Hommey
d177b1d78f keepalive: fix how md5 is used
The code in keepalive dates from when it was importing the md5 module directly
and uses md5.new. Since then, what 'md5' means has been changed from an import
of the md5 module to being a function using the right module between hashlib
and md5, so the md5.new idiom doesn't work anymore.
2014-09-24 15:52:40 +09:00
Pierre-Yves David
d0e7545de8 revset: add an optimised baseset.__contains__ (issue4371)
The baseset class is based on a python list. This means that base.__contains__
was absolutely as crappy as list.__contains__. We now rely on __contains__ from
the underlying set.

This will avoid having to explicitly convert the baseset to a set (using
baseset.set()) whenever one want fast membership test.

Apparently there is already code that forgot to do such conversions since we
observe a massive speedup in some test.

revset #25: roots((0::) - (0::tip))
0) wall 2.079454 comb 2.080000 user 2.080000 sys 0.000000 (best of 5)
1) wall 0.132970 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

No regression is observed in benchmarks.

This change improve the issue4371 back to acceptable situation (but are still
slower than manual substraction)
2014-09-16 23:59:29 -07:00
Matt Mackall
2f833205d7 help: mention mode in hg log --removed help (issue4381) 2014-09-21 10:31:34 -05:00
Matt Mackall
4afe2f8b38 commit: catch changed exec bit on files from p1 (issue4382) 2014-09-21 10:07:06 -05:00
FUJIWARA Katsunori
d8d8f99761 mq: examine "pushable" of already applied patch correctly
Before this patch, "hg qselect" with --pop/--reapply may pop patches
unexpectedly, even when all of patches applied before "qselect" are
still pushable.

Strictly speaking about the condition of this issue:

  - before "qselect"
    - there are N applied patches
    - the index of the guarded patch X in the series is less than N

  - after "qselect"
    - X is still guarded, and
    - all of applied patched are still pushable

In the case above, "hg qselect" should keep current status, but it
actually tries to pop patches because of X.

The index in "the series" should be used to examine "pushable" of a
patch by "mq.pushablek()", but the index in "applied patches" is used,
and this may cause unexpected examination of guarded patch.

To examine "pushable" of already applied patch correctly, this patch
uses "mq.applied[i].name": "pushable" is the function introduced by
the previous patch, and it returns "mq.pushable(mq.applied[i].name)[0]".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
396a8e0831 mq: pop correct patches when changing pushable-ness of already applied ones
Before this patch, "hg qselect" with --pop/--reapply may pop incorrect
patches, because the index in "applied patches" is used to pop patches
by "mq.pop()", even though the index in "the series" should be used.

For example, when the already applied patch becomes guarded and it
follows the already guarded (= not yet applied) one, "hg qselect" is
aborted, because it tries to pop to guarded one.

This patch uses "mq.applied[i - 1].name" to pop to the patch, of which
the index in the "applied ones" is "i - 1".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
3efcc894d8 mq: use "mq.applied[i].name" instead of "mq.appliedname(i)" for safety
Before this patch, "hg qselect --reapply" is aborted when "--verbose"
is specified, because "mq.appliedname()" returns "INDEX PATCHNAME"
instead of "PATCHNAME" in such case and "mq.push" can't accept the
former as the name of patch.

This patch uses "mq.applied[i].name" instead of "mq.appliedname(i)" as
the name of the patch to be pushed for safety.

Now, there is no code path using "mq.appliedname()", and it should be
removed to prevent developers from using it in the wrong way like this
issue.
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
5e22c34bd1 mq: report correct numbers for changing "number of guarded, applied patches"
Before this patch, "hg qselect" may report incorrect numbers for
"number of guarded, applied patches has changed", because it examines
"pushable" of patches by the index not in "the series" but in "applied
patches", even though "mq.pushable()" expects the former.

To report correct numbers for changing "number of guarded, applied
patches", this patch uses the name of applied patch to examine
pushable-ness of it.

This patch also changes the result of existing "hg qselect" tests,
because they doesn't change pushable-ness of already applied patches.

This patch assumes that "hg qselect" focuses on changing pushable-ness
only of already applied patches, because:

  - the report message uses not "previous" (in the series) but
    "applied"

  - the logic to pop patches for --pop/--reapply examines
    pushable-ness only of already applied ones (in fact, there are
    some incorrect code paths)
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
0d1dc1fcfa dispatch: check shell alias again after loading extensions (issue4355)
Before this patch, the shell alias causes failure when it takes its
specific (= unknown for "hg") options in the command line, because
"_parse()" can't accept them.

This is the regression introduced by 7849ac1dbc57.

It fixed the issue that ambiguity between shell aliases and commands
defined by extensions was ignored. But it also caused that ambiguous
shell alias is handled in "_parse()" even if it takes specific options
in the command line.

To avoid such failure, this patch checks shell alias again after
loading extensions.

All aliases and commands (including ones defined by extensions) are
completely defined before the 2nd (= newly added in this patch)
"_checkshellalias()" invocation, and "cmdutil.findcmd(strict=False)"
can detect ambiguity between them correctly.

For efficiency, this patch does:

  - omit the 2nd "_checkshellalias()" invocation if "[ui] strict= True"

    it causes "cmdutil.findcmd(strict=True)", of which result should
    be equal to one of the 1st invocation before adding aliases

  - avoid removing the 1st "_checkshellalias()" invocation

    it causes "cmdutil.findcmd(strict=True)" invocation preventing
    shell alias execution from loading extensions uselessly
2014-09-10 00:41:44 +09:00
FUJIWARA Katsunori
906133d681 dispatch: make "_checkshellalias" reusable regardless of adding aliases
To reduce changes in the subsequent patch fixing issue4355, this patch
makes "_checkshellalias" reusable regardless of adding aliases.

In this patch, alias definitions are added and restored, only when
"precheck=True".
2014-09-10 00:41:44 +09:00
Siddharth Agarwal
ca3e00a8e3 histedit: abort gracefully on --continue/--abort with no state
Previously we'd print an ugly message saying that the histedit-state file
doesn't exist in the repo.
2014-09-03 20:42:51 +02:00
Matt Mackall
01496efef0 Added signature for changeset c2e80605b621 2014-09-02 03:41:01 +02:00
Matt Mackall
8d49d252a8 merge with i18n 2014-09-01 23:43:33 +02:00
Wagner Bruna
aef4c89e3e i18n-pt_BR: synchronized with 359fb11497a4 2014-09-01 10:57:27 -03:00
Wagner Bruna
3853b731ce merge with i18n 2014-09-01 10:54:49 -03:00
FUJIWARA Katsunori
645a149940 i18n-ja: synchronized with 86be79fee795 2014-08-31 20:49:13 +09:00
Gregory Szorc
a57721695a help: only call doc() when it is callable
`hg help -k` on my machine was aborting because the hg-prompt extension
was inserting a string and not a function into help.helptable and help
was blindly calling it.

This patch changes keyword searching to be more robust against
unexpected types.
2014-08-30 20:06:24 +02:00
Mike Hommey
edf6a59652 repoview: fix typo in repoview.changelog
Incidentally, this avoids the changelog cache being invalidated each time
it's accessed on a repoview.

On a filtering experiment on a repository the size of mozilla-central,
this makes a significant difference:

Before, running hg log -l 10 --time with about 8k changesets filtered out:
time: real 1.490 secs (user 1.450+0.000 sys 0.040+0.000)

After:
time: real 0.540 secs (user 0.530+0.000 sys 0.010+0.000)
2014-08-31 19:43:03 +09:00
Yuya Nishihara
e7ee70da05 util.system: avoid buffering of subprocess output when it is piped
util.system() copies subprocess' output through pipe if output file is not
stdout.  Because a file iterator has internal buffering, output won't be
flushed until enough data is available.  Therefore, it could easily miss
important messages such as "waiting for lock".
2014-08-30 17:38:14 +02:00
Mike Hommey
a290d1f800 bundle2: client side support for a part to import external bundles
Bundle2 opens doors to advanced features allowing to reduce load on
mercurial servers, and improve clone experience for users on unstable or
slow networks.

For instance, it could be possible to pre-generate a bundle of a
repository, and give a pointer to it to clients cloning the repository,
followed by another changegroup with the remainder. For significantly
big repositories, this could come as several base bundles with e.g. 10k
changesets, which, combined with checkpoints (not part of this change),
would prevent users with flaky networks from starting over any time
their connection fails.

While the server-side support for those features doesn't exist yet, it
is preferable to have client-side support for this early-on, allowing
experiments on servers only requiring a vanilla client with bundle2
enabled.
2014-10-17 09:57:05 +09:00
Mike Hommey
541e928ae7 bundle2: remove _getbundleextrapart
Extensions can now add new part generators with the getbundle2partsgenerator
decorator instead.
2014-09-25 11:53:28 +09:00
Matt Mackall
be7ae55914 glossary: add deprecated and experimental 2014-10-17 12:34:27 -05:00
Martin von Zweigbergk
bb819d311b test-merge5: remove obsolete '-y' and its motivating comment
The '-y' in 'hg update -y' was once needed to answer questions about
modify/delete conflicts. That is no longer needed, so remove the '-y'
and the comment justifying its use.
2014-10-09 16:57:45 -07:00
Augie Fackler
bc9dc896c1 test-resolve.t: use redirection to /dev/null instead of grep -q 2014-10-17 11:01:05 -04:00
Martin von Zweigbergk
6d828e9c66 resolve: run happily after conflict-free merge 2014-10-08 22:30:04 -07:00
Martin von Zweigbergk
3fff17492d test-resolve: add tests for re-merge 2014-10-08 22:16:18 -07:00
Martin von Zweigbergk
9791d9b4dc test-resolve: add more tests for in conflict-free states
We already have a test for 'hg resolve -m' when there is no merge in
progress. Add one for 'hg resolve --all' as well.

Also add tests for both --all and -m when there is a merge without
conflicts in progress. They should both be successful, just as if
there had been conflicts that had been marked resolved. However, that
is currently broken, so mark the tests broken for now. The behavior
will be fixed in a later patch.
2014-10-08 22:19:08 -07:00
Martin von Zweigbergk
1645eb5e43 test-resolve: add test resolving one of two files
The tests for resolve are missing a lot of cases. Let's start by
adding another file to the test repo, so we can test resolving one of
two files.
2014-10-08 21:07:30 -07:00
Martin von Zweigbergk
362a7efc7a test-resolve: clarify test descriptions and consistently use "should" 2014-10-08 21:19:31 -07:00
Pierre-Yves David
0d2e3a1dee revset-phases: prefetch attributes in phasesrelated revsets
Pre-fetching attributes gives a significant performance boost. Such is Python.


draft()
0) wall 0.011661 comb 0.010000 user 0.010000 sys 0.000000 (best of 205)
1) wall 0.009804 comb 0.000000 user 0.000000 sys 0.000000 (best of 231)

draft() - ::bookmark()
0) wall 0.014173 comb 0.010000 user 0.010000 sys 0.000000 (best of 177)
1) wall 0.012966 comb 0.010000 user 0.010000 sys 0.000000 (best of 182)
2014-10-16 17:46:58 -07:00
Pierre-Yves David
8347f164c0 revset-phases: do not cache phase-related filters
The phase retrieval is fast enough to not require caching the result of the
functions.

draft()
0) wall 0.017209 comb 0.020000 user 0.020000 sys 0.000000 (best of 149)
1) wall 0.011654 comb 0.010000 user 0.010000 sys 0.000000 (best of 186)

public()
0) wall 0.018687 comb 0.010000 user 0.010000 sys 0.000000 (best of 128)
1) wall 0.013290 comb 0.010000 user 0.010000 sys 0.000000 (best of 181)

secret()
0) wall 0.017464 comb 0.020000 user 0.020000 sys 0.000000 (best of 127)
1) wall 0.011499 comb 0.000000 user 0.000000 sys 0.000000 (best of 196)

draft() - ::bookmark()
0) wall 0.020099 comb 0.020000 user 0.020000 sys 0.000000 (best of 127)
1) wall 0.014399 comb 0.020000 user 0.020000 sys 0.000000 (best of 169)
2014-10-11 01:21:47 -07:00
Pierre-Yves David
7fc829de42 changectx: issue a FilteredRepoLookupError when applicable
We capture FilteredxxxError and issue a FilteredRepoLookupError instead with a
sightly different messsge. The message will likely get more improvement in the
future.

    error: filtered revision '4'
2014-10-15 20:37:44 -07:00