Commit Graph

22913 Commits

Author SHA1 Message Date
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
Yuya Nishihara
740a18d819 revset: avoid O(n) lookup of invalid revision in rev()
0cc5c10d5dc7 was not the final version of that patch.  It was really slow
because `l not in repo.changelog` iterates revisions up to `l`.  Instead,
rev() should utilize spanset.__contains__().

revset #0: rev(210000)
0) wall 0.000039 comb 0.000000 user 0.000000 sys 0.000000 (best of 67978)
1) wall 0.002721 comb 0.000000 user 0.000000 sys 0.000000 (best of 1055)
2) wall 0.000059 comb 0.000000 user 0.000000 sys 0.000000 (best of 45599)
(0: 3.2-rc, 1: 0cc5c10d5dc7, 2: this patch)

Note that the benchmark result described in 0cc5c10d5dc7 is wrong because
it is the one of the initial version.
2014-10-23 21:53:37 +09:00
Matt Mackall
78b956ae0c run-tests: output diffs with only forward slashes
This removes some gratuitous variance when testing on Windows with
test-run-tests.t.
2014-10-23 13:44:34 -05:00
Wagner Bruna
779ceca4ff i18n: add hint to digest mismatch message 2014-10-23 12:35:10 -02:00
Wagner Bruna
6791cdb7aa help/config: fix typo 2014-10-23 12:28:00 -02:00
Wagner Bruna
8b3ed4dd05 files: fix example list syntax 2014-10-23 12:27:57 -02:00
Mads Kiilerich
20e288b0f3 parsers: use 'k' format for Py_BuildValue instead of 'n' because Python 2.4
'n' was introduced in Mercurial in 5d1adb6683fa and broke Python 2.4 support in
mysterious ways that only showed failure in test-glog.t. Py_BuildValue failed
because of the unknown format and a TypeError was thrown ... but it never
showed up on the Python side and it happily continued processing with wrong
data.

Quoting https://docs.python.org/2/c-api/arg.html :

  n (integer) [Py_ssize_t]
    Convert a Python integer or long integer to a C Py_ssize_t.
    New in version 2.5.

  k (integer) [unsigned long]
    Convert a Python integer or long integer to a C unsigned long without
    overflow checking.

This will use unsigned long instead of Py_ssize_t. That is not a good solution,
but good is not an option when we have to support Python 2.4.
2014-10-23 02:42:57 +02:00
Durham Goode
aea70fa3a4 rebase: improve base revset performance
The old revset had pretty terrible performance on large repositories (12+
seconds). This new revset achieves the same result in only 0.7s. As we improve
the underlying revset APIs we can probably get this revset down to 'only(base,
dest)::', but at the moment that version still takes 2s.
2014-10-20 18:50:09 -07:00
Ryan McElroy
365c7718eb amend: fix amending rename commit with diverged topologies (issue4405)
This addresses the bug described in issue4405: when obsolescence markers are
enabled, amending a commit with a file move can lead to the copy information
being lost.

However, the bug is more general and can be reproduced without obsmarkers as
well, as demonstracted by Pierre-Yves and put into the updated test.
Specifically, graph topology divergences between the filelogs and the changelog
can cause copy information to be lost during amends.
2014-10-16 06:35:06 -07:00
Augie Fackler
0e58e63b9c hgweb: disable SSLv3 serving (BC)
Because of recent attacks[0] on SSLv3, let's just drop support entirely.

0: http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
2014-10-21 17:09:37 -04:00
Augie Fackler
e19e1a783c sslutil: only support TLS (BC)
In light of the POODLE[0] attack on SSLv3, let's just drop the ability to
use anything older than TLSv1 entirely.

This only fixes the client side. Another commit will fix the server
side. There are still a few SSLv[23] constants hiding in httpclient,
but I'll fix those separately upstream and import them when we're not
in a code freeze.


0: http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
2014-10-21 17:01:23 -04:00
Mads Kiilerich
a195867192 eol: fix crash when handling removed files
ci --amend would in some cases fail after 2eef89bfd70d failed to refactor the
eol extension too.
2014-10-22 16:10:23 +02:00
Pierre-Yves David
ad1ec3399d bundle2: transmit exception during part generation
If an exception is raised during a bundle2 part payload generation it is now
recorded in the bundle. If such exception occurs, we capture it, transmit an
abort exception through the bundle, cleanly close the current part payload and
raise it again. This allow to generate valid bundle even in case of exception so
that the consumer does not wait forever for a dead producer. This also allow to
raise the exception during unbundling at the exact point it happened during
bundling make debugging easier.
2014-10-15 03:52:20 -07:00
Pierre-Yves David
38561c6027 bundle2: add a interrupt mechanism
It is now possible to emit a single part in the middle of a payload production.
This part will be processed with limitation (only access to a `ui` object). The
goal is to let the server raise exception and output while a part is being
processed. The source motivation is to transmit exception that occurs while
generating a part.

This change is was the motivation to bump the bundle2 format from HG2X to HG2Y.
Somehow, the format bump made it into 3.2 without it. So this change go on
stable. It is low risk as bundle2 is still disabled by default.
2014-10-14 10:47:47 -07:00
Durham Goode
fd796ba36d transactions: change backupfiles format to use newlines
Previously the journal.backupfiles file was delimited by \0. Now we delimit it
using \n (same as the journal file). This allows us to change the number of
values in each line more easily, rather than relying on the count of \0's.
2014-10-21 12:38:28 -07:00
Durham Goode
646f35dbec transactions: add version number to journal.backupfiles
The transaction format will be changing a bit over the next releases, so let's
go ahead and add a version number to make backwards compatibility easier. This
whole file format was broken prior to 3.2 (see previous patch), so changing it
now is pretty low risk.
2014-10-21 11:37:29 -07:00
Durham Goode
faf9d65282 transactions: fix hg recover with fncache backups
The transaction backupfiles logic was broken for 'hg recover'.  The file format
is XXX\0XXX\0YYY\0YYY\0 but the parser did a couple things wrong. 1) It went one
step beyond the final \0 and tried to read past the end of the array. 2)
array[i:i+1] returns a single item, instead of two items as intended.

Added a test to catch it, which turns out to be the first actual 'hg recover'
test.
2014-10-20 16:53:56 -07:00
Yuya Nishihara
bac0595bd4 revset: have rev() drop out-of-range or filtered rev explicitly (issue4396)
The recent optimization of "and" operation relies on the assumption that
the rhs set does not contain invalid revisions.  So rev() has to remove
invalid revisions.

This is still faster than using `.filter(lambda r: r == l)`.

revset #0: rev(25)
0) wall 0.026341 comb 0.020000 user 0.020000 sys 0.000000 (best of 113)
1) wall 0.000038 comb 0.000000 user 0.000000 sys 0.000000 (best of 66567)
2) wall 0.000062 comb 0.000000 user 0.000000 sys 0.000000 (best of 43699)
(0: 428fa22fb2d1^, 1: 3.2-rc, 2: this patch)
2014-10-19 16:48:33 +09:00
Matt Mackall
56b374dd4e revset: avoid recalculating filesets
This fixes a regression in ea41ca830940 that moved matcher building
into a callback, thus causing it be rebuilt for each revision matched
against.
2014-10-22 15:47:27 -05:00
FUJIWARA Katsunori
d10fadc61a tests: open file in binary mode to use POSIX end-of-line style anywhere
Before this patch, "test-context.py" fails on Windows environment,
because "diff" output contains unexpected "\r" character.

Opening the target file in text mode causes this automatic end-of-line
conversion.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
31d0ede415 tests: add "(glob)" for l10n messages in test-clone.t for Windows
This patch follows the style of other tests avoiding same kind of issue.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
7b2b4035f5 tests: add "(glob)" for l10n messages in test-largefiles-update.t for Windows
This patch follows the style of other tests avoiding same kind of issue.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
de521f3342 tests: add "(glob)" to paths in test-revset-outgoing.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
d3fe25b2c7 tests: add "(glob)" to paths in test-hgrc.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
94564038da tests: add "(glob)" to paths in test-url-rev.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
ebfa67e64d tests: adjust expected prompt choice outputs in test-record.t for Windows
Changeset d735f8a82023 introduced "showing prompt choice if input is
not a tty but is forced to be interactive" and adjusted expected
output in test-record.t.

But some tests for no-execbit platform (= Windows) were not adjusted
by d735f8a82023.

This causes unexpected failure of test-record on Windows environment.

This patch adds below to prompt lines for such tests:

  - prompt choice at the end of prompt line, and
  - empty line after prompt line
2014-10-20 22:08:08 +09:00
Yuya Nishihara
df336dc3c8 ui: separate option to show prompt echo, enabled only in tests (issue4417)
The problem in commandserver was addressed by 766cfbe766dc, but it is tricky
to reuse ui.nontty option to disable echo back.  Instead, this patch introduces
new option to enable echoing of prompt response.

Prompt echoing is changed to be off by default, which should avoid possible
breakage of output parsing in user scripts.

For now, this option is undocumented because it exists for internal use.
2014-10-21 23:16:46 +09:00
Matt Mackall
30f4018132 Added signature for changeset 49471449798d 2014-10-18 18:14:48 -05:00
Matt Mackall
600a8a1715 merge with i18n 2014-10-18 18:05:10 -05:00
Pierre-Yves David
b3b7700935 hook: schedule run "b2x-transactionclose" for after lock release
Hooks that run after the transaction need to be able to touch the
repository. So we need to run them after the lock release. This is
similar to what the "changegroup" hook is doing in the
`addchangegroup` function.
2014-10-17 02:17:36 -07:00
Pierre-Yves David
2658f42db0 repoview: issue a special message when filtering hidden changesets
Hidden changesets are by far the most common error case and is the only one[1]
that can reach the user. We move to a friendlier message with a hint about how
to access the data anyway. We should probably point to a help topic instead but
we do not have such a topic yet.

Example of the new output

  abort: hidden revision '4'!
  (use --hidden to access hidden revisions)


[1] Actually, filtering from "served" can also reach the user during certain
exchange operations.
2014-10-17 15:25:32 -07:00
Pierre-Yves David
1dd313bfc1 repoview: include the filter name in filtered revision error messages
This will help user to debug. A more precise message will be issued
for the most common case ("visible" filter) in the next changesets.

example output:

  -  abort: filtered revision '4'!
  +  abort: filtered revision '4' (not in 'visible' subset)!
2014-10-17 15:54:43 -07:00
Mads Kiilerich
c50760a39b largefiles: inline redundant toname function in status
Simpler and an optimization.
2014-10-15 05:08:56 +02:00
Mads Kiilerich
10316e128d largefiles: inline redundant inctx function in status 2014-10-15 05:08:56 +02:00
Mads Kiilerich
489de2727b ssl: only use the dummy cert hack if using an Apple Python (issue4410)
The hack for using certificate store in addition to the provided CAs resides in
Apple's OpenSSL. Apple's own Pythons will use it, but other custom built
Pythons might use a custom built OpenSSL without that hack and will fail when
exposed to the dummy cacert introduced in ee8b7fe5e119.

There do not seem to be a simple way to check from Python if we are using a
patched OpenSSL or if it is an Apple OpenSSL.

Instead, check if the Python executable resides in /usr/bin/python* or in
/System/Library/Frameworks/Python.framework/ and assume that all Pythons found
there will be native Pythons using the patched OpenSSL.

Custom built Pythons will not get the benefit of using the CAs from the
certificate store.
2014-10-17 18:56:12 +02:00
Mads Kiilerich
fa9ed50a56 largefiles: move initialization of standins variable to clarify its "scope" 2014-10-15 05:08:56 +02:00
Mads Kiilerich
3aa19a07d3 largefiles: the update override only needs lfdirstate and status for --check 2014-10-15 05:08:56 +02:00
Alexander Sauta
9578fc17f5 i18n-ru: synchronized with bc20b710d0da 2014-10-13 14:46:50 +01:00
Mads Kiilerich
3b22bfee79 largefiles: remove confusing rev parameter for lfdirstatestatus
Dirstate only works on the repo wctx.
2014-10-03 00:42:40 +02:00
Mads Kiilerich
2518387f43 largefiles: replace repo._isaddremove hack with a simple function parameter 2014-10-03 00:42:40 +02:00