Commit Graph

7731 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
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
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
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
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
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
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
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
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
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
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
Martin von Zweigbergk
7eeee3a877 status: add more complete tests for --rev
The 'status --rev' code is not very well tested, which has bitten us
as recently as in issue4321. Let's add some more tests, some of which
uncover bugs. Remove the few existing tests that are now covered in a
more thorough and consistent way.
2014-10-12 22:23:43 -07:00
Yuya Nishihara
a9b00f4522 cmdserver: include pid of server handling requests in hello message
Because unix-mode server forks child process per connection, client does not
know the pid of the server that will handle requests.  The pid is necessary
to interrupt hung process:

 1. client connects to socket server
 2. server accepts the connection, forks, and tells pid
 3. client requests "runcommand pull"
    .. hung ..
 4. client sends SIGINT to the (forked) server
 5. server returns from I/O wait

Note that getsockopt(SO_PEERCRED) of Linux cannot be used because the server
fork()s after accept().
2014-10-18 12:24:50 +09:00
Yuya Nishihara
f15ba4e058 run-tests: clean up unused globals that were removed by tests-refactor series
They were demoted to instance variables by bd9cce5752d6, c59bb1e35f8c,
12bbe81716c1, b9b6ea3c673c, ac4e4d32cde4 and 7212772d393e.
2014-10-18 21:52:11 +09:00
Siddharth Agarwal
146e346b87 lock: while releasing, unlink lockfile even if the release function throws
Consider a hypothetical bug in the release function that causes it to raise an
exception. Also consider the bisect command, which saves its state in a finally
clause. Saving the state requires acquiring the wlock.

If we don't unlink the lockfile when the exception is thrown, we'll try to
acquire the wlock again. We're going to try and acquire a lock again while our
old lockfile is on disk. The PID on disk is our own, and of course we're still
running, so we won't take over the lock. Hence we'll be stuck waiting for a
lock that we left behind ourselves.

To avoid this, always unlink the lockfile. This preserves the invariant that
self.held > 0 is equivalent to the lockfile existing on disk.
2014-10-16 19:15:51 -07: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
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
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
Pierre-Yves David
15397993b6 bundle2: change header size and make them signed (new format)
We are changing all integers that denote the size of a chunk to read to int32.
There are two main motivations for that.

First, we change everything to the same width (32 bits) to make it possible for
a reasonably agnostic actor to forward a bundle2 without any extra processing.
With this change, this could be achieved by just reading int32s and forwarding
chunks of the size read. A bit a smartness would be logic to detect the end of
stream but nothing too complicated.

Second, we need some capacity to transmit special information during the bundle
processing. For example we would like to be able to raise an exception while a
part is being read if this exception happend while this part was generated.
Having signed integer let us use negative numbers to trigger special events
during the parsing of the bundle.

The format is renamed for B2X to B2Y because this breaks binary
compatibility. The B2X format support is dropped. It was experimental to
allow this kind of things. All elements not directly related to the binary
format remain flagged "b2x" because they are still compatible.
2014-10-01 23:40:23 -05:00
Pierre-Yves David
9fbd0c37ca bundle2: add a test for exceptions raised during the generation process
We would like exceptions raised during the generation process to be gracefully
handled on the receiver side. We add a test for it. It shows that we are not
doing it yet.
2014-10-14 13:23:03 -07:00
Pierre-Yves David
2c1a6817be pull: call the b2x-transactionclose hook when closing the transaction
We need a wider set of hooks to process all the changes that happened during the
pull transaction. We reuse the experimental `b2x-transactionclose` hook set
from server's unbundle for consistency. This hook is experimental and will not
remains as-is forever, but this will open the door for experimentation in 3.2.
2014-10-15 04:19:37 -07:00
Yuya Nishihara
0baf7a676d cmdserver: add service that listens on unix domain socket and forks process
Typical use case of 'unix' mode is a background hg daemon.

    $ hg serve --cmdserver unix --cwd / -a /tmp/hg-`id -u`.sock

Unlike 'pipe' mode in which parent process keeps stdio channel, 'unix' server
can be detached.  So clients can freely connect and disconnect from server,
saving Python start-up time.

It might be better to write "--cmdserver socket -a unix:/sockpath" instead
of "--cmdserver unix -a /sockpath" in case hgweb gets the ability to listen
on unix domain socket.
2014-10-04 16:46:50 +09:00
Pierre-Yves David
830b7b0082 pull: add source information to the transaction
The source information can, should be applied once when opening the transaction
for the pull. This will lets element processed within a bundle2 be aware of them
and open the door to running a set of hooks when closing this pull transaction.

This is similar to what is done in server's unbundle call.
2014-10-14 01:40:04 -07:00
Pierre-Yves David
03cb1a74e8 changegroup: store source and url in the hookargs dict
We store the source and url of the current data into `transaction.hookargs` this
let us inherit it from upper layers that may have created a much wider
transaction. We have to modify bundle2 at the same time to register the source
and url in the transaction. We have to do it in the same patch otherwise, the
`addchangegroup` call would fill these values and the hook calling will crash
because of the duplicated 'source' and 'url' arguments passed to the hook call.
2014-10-14 00:06:46 -07:00
Pierre-Yves David
9e19dbeaf9 addchangegroup: get the node argument of incoming hook from transaction
The transaction is now carrying hook-related informations. So we use it to
retrieve the `node` argument. This will also carry around all kinds of other useful
informations (like: "are we in a bundle2 processing")
2014-10-14 00:03:03 -07:00
Martin von Zweigbergk
11304c2090 dicthelpers: delete now that they are no longer used 2014-10-14 23:53:35 -07:00
Mike Hommey
9962a81363 bundle2: merge return values when bundle contains multiple changegroups
A bundle2 may contain multiple parts adding changegroups, in which case there
are multiple operation records for changegroups, each with its own return
value. Those multiple return values are aggregated in a single cgresult value
for the whole operation.

As can be seen in the associated test case, the situation with hooks is not
really the best, but without deeper thoughts and changes, we can't do much
better. Hopefully, things will be improved before bundle2 is enabled by default.
In the meanwhile, multiple changegroups is not expected to be in widespread
use, and even less expected to be used for pushes. Also, not many clients
cloning or pulling bundle2 with multiple changesets are not expected to have
changegroup hooks anyways.
2014-10-16 16:03:04 +09:00
Mike Hommey
14669879bf changegroup: use a copy of hookargs when invoking the changegroup hook
addchangegroup creates a runhook function that is used to invoke the
changegroup and incoming hooks, but at the time the function is called,
the contents of hookargs associated with the transaction may have been
modified externally. For instance, bundle2 code affects it with
obsolescence markers and bookmarks info.

It also creates problems when a single transaction is used with multiple
changegroups added (as per an upcoming change), whereby the contents
of hookargs are that of after adding a latter changegroup when invoking
the hook for the first changegroup.
2014-10-16 15:54:53 +09:00
Mike Hommey
7dcde933f1 tests: pull common http server setup out of individual tests
There are currently two different tests using roughly the same code to
create temporary scripts acting as HTTP servers. As there is going to
be at least one more in an upcoming change, factor those out in a
standalone dumbhttp.py script.
2014-10-16 13:48:51 +09:00
Pierre-Yves David
35dd781a8f test-bundle2-exchange: do not drop HG_NODE from the hook output
HG_NODE is precisely something we would like to test.
2014-10-16 03:22:51 -07:00
Durham Goode
34fbe659db obsolete: update test-commit-amend to use obsolete option
This test actually used the obs.py file as part of the test, so we need to fix
up the test a little more than usual to work with the new obsolete option flags.
2014-10-14 13:34:57 -07:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Durham Goode
122b7f93b8 obsolete: add readonly flag to obstore constructor
Previously, obstore read the obsolete._enabled flag to determine whether to
allow writes to the obstore. Since obsolete._enabled will be moving into a repo
specific config, we can't read it globally, and therefore must pass the
information into the constructor.
2014-10-14 13:20:31 -07:00