Commit Graph

32461 Commits

Author SHA1 Message Date
Pierre-Yves David
3324c6b39d perfbranchmap: add an option to purge the revbranch cache
The perf extension needs to be able to reflect this reality too. (eg: 4s vs 60s
on a Million-ish revisions repository).
2017-06-05 16:24:01 +01:00
Pierre-Yves David
a74c131fb4 push: add a way to allow concurrent pushes on unrelated heads
Client has a mechanism for the server to check that nothing changed server side
since the client prepared a push. That check is wide and any head changed on
the server will lead to an aborted push. We introduce a way for the client to
send a less strict checking. That logic will check that no heads impacted by
the push have been affected. If other unrelated heads (including named branches
heads) have been affected, the push will proceed.

This is very helpful for repositories with high developers traffic on different
heads, a common setup.

That behavior is currently controlled by an experimental option. The config
should live in the "server" section but bike-shedding of the name will happen
in the next changesets. Servers advertise this capability through a new bundle2
capability 'checkeads', using the value 'related'.

The 'test-push-race.t' is updated to check that new capabilities on the
documented cases.
2017-05-29 05:53:58 +02:00
Pierre-Yves David
995a8250c6 headsummary: expose the 'discardedheads' set in the headssummary
That information will be useful to detect push race on related part of the
history.

See next changeset for details.
2017-05-29 05:52:13 +02:00
Pierre-Yves David
03a21b39f6 checkheads: perform obsolescence post processing directly in _headssummary
The goal is to have the function directly return something meaningful and
useful for the whole pull.

Note: we skip adding post-processing in '_oldheadssummary' because if a client
is too old for branchmap it will be too old for obsolescence too.
2017-05-29 05:47:27 +02:00
Pierre-Yves David
d0a234e185 headssummary: directly feed the function with the 'pushop' object
Our goal is to be able to perform the post processing directly into the
'_headssummary' function. However before this patch the '_headsummary' function
only had access to repo, remote, outgoing while the '_postprocessobsolete'
function takes a 'pushop' object.  Experience shows that having the 'pushop'
object helps extensions so we update '_headssummary' to take a pushop
object as argument.
2017-05-29 10:56:00 +02:00
Pierre-Yves David
7d1cdfda7e checkheads: gather the postprocessing with other obsolescence specific code
We extract this function from the loop and gather it with the rest of the
obsolescence specific code. That will help to clarify the move of the whole logic
inside the "heads summary" computation.
2017-05-29 05:45:59 +02:00
Siddharth Agarwal
d9e3c09954 run-tests: add a way to list tests, with JSON and XUnit support
Some test runners are interested in listing tests, so they can do their own
filtering on top (usually based on attributes like historically observed
runtime). Add support for that.
2017-06-06 14:38:59 -07:00
Siddharth Agarwal
edb24a5486 run-tests: install hg after computing tests to run
We're going to add a way to list tests, and we don't need to install hg for
that.
2017-06-06 13:56:53 -07:00
Siddharth Agarwal
6f1897a3a9 run-tests: make time field optional for xunit report
We're going to use XUnit to list tests, and we don't have a time field in that
case.
2017-06-06 13:52:25 -07:00
Siddharth Agarwal
7e8e3a62b8 run-tests: factor out json write code into another method
We're going to use this code to output a JSON-formatted listing of tests.
2017-06-06 13:10:55 -07:00
Siddharth Agarwal
24946b1477 run-tests: factor out xunit write code into another method
We're going to use this code to output an XUnit-formatted listing of tests.
2017-06-06 13:10:55 -07:00
David Soria Parra
0e29dd10bc revset: lookup descendents for negative arguments to ancestor operator
Negative offsets to the `~` operator now search for descendents. The search is
aborted when a node has more than one child as we do not have a definition for
'nth child'. Optionally we can introduce such a notion and take the nth child
ordered by rev number.

The current revset language does provides a short operator for ancestor lookup
but not for descendents. This gives user a simple revset to move to the previous
changeset, e.g. `hg up '.~1'` but not to the 'next' changeset. With this change
userse can now use `.~-1` as a shortcut to move to the next changeset.
This fits better into allowing users to specify revisions via revsets and
avoiding the need for special `hg next` and `hg prev` operations.

The alternative to negative offsets is adding a new operator. We do not have
many operators in ascii left that do not require bash escaping (',', '_', and
'/' come to mind). If we decide that we should add a more convenient short
operator such as ('/', e.g. './1') we can later add it and allow ascendents
lookup via negative numbers.
2017-05-27 10:25:09 -07:00
Pulkit Goyal
f8b6f67b7a update: show the commit to which we updated in case of multiple heads (BC)
Currently when we have multiple heads on the same branch, update tells us that
there some more heads for the current branch but does not tells us the head to
which the repository has been updated to. It makes more sense showing the
head we updated to and then telling there are some more heads.
2017-06-06 22:17:39 +05:30
Gregory Szorc
efbb740737 revlog: skeleton support for version 2 revlogs
There are a number of improvements we want to make to revlogs
that will require a new version - version 2. It is unclear what the
full set of improvements will be or when we'll be done with them.
What I do know is that the process will likely take longer than a
single release, will require input from various stakeholders to
evaluate changes, and will have many contentious debates and
bikeshedding.

It is unrealistic to develop revlog version 2 up front: there
are just too many uncertainties that we won't know until things
are implemented and experiments are run. Some changes will also
be invasive and prone to bit rot, so sitting on dozens of patches
is not practical.

This commit introduces skeleton support for version 2 revlogs in
a way that is flexible and not bound by backwards compatibility
concerns.

An experimental repo requirement for denoting revlog v2 has been
added. The requirement string has a sub-version component to it.
This will allow us to declare multiple requirements in the course
of developing revlog v2. Whenever we change the in-development
revlog v2 format, we can tweak the string, creating a new
requirement and locking out old clients. This will allow us to
make as many backwards incompatible changes and experiments to
revlog v2 as we want. In other words, we can land code and make
meaningful progress towards revlog v2 while still maintaining
extreme format flexibility up until the point we freeze the
format and remove the experimental labels.

To enable the new repo requirement, you must supply an experimental
and undocumented config option. But not just any boolean flag
will do: you need to explicitly use a value that no sane person
should ever type. This is an additional guard against enabling
revlog v2 on an installation it shouldn't be enabled on. The
specific scenario I'm trying to prevent is say a user with a
4.4 client with a frozen format enabling the option but then
downgrading to 4.3 and accidentally creating repos with an
outdated and unsupported repo format. Requiring a "challenge"
string should prevent this.

Because the format is not yet finalized and I don't want to take
any chances, revlog v2's version is currently 0xDEAD. I figure
squatting on a value we're likely never to use as an actual revlog
version to mean "internal testing only" is acceptable. And
"dead" is easily recognized as something meaningful.

There is a bunch of cleanup that is needed before work on revlog
v2 begins in earnest. I plan on doing that work once this patch
is accepted and we're comfortable with the idea of starting down
this path.
2017-05-19 20:29:11 -07:00
Danek Duvall
e90fa83ca6 check-code: ban grep's context flags (-A/-B/-C) since they're not on Solaris 2017-06-06 08:58:27 -07:00
David Demelier
cdeab8bd8c patchbomb: avoid -r and -B options at the same time 2017-06-06 08:52:51 +02:00
Danek Duvall
9231e311ce debugbundle: add --part-type flag to emit only named part types
This removes the need in the tests for grep -A, which is not supported on
Solaris.
2017-06-05 16:19:41 -07:00
Matt Harbison
c1192b9b13 test-obsolete-bundle-strip: add globs for Windows 2017-06-05 20:37:45 -04:00
Jun Wu
7dac9c0bba obsstore: move header encoding to a separate function
This patch moves encodeheader from encodemarkers. So markers and header
could be encoded separately.
2017-06-04 00:38:11 -07:00
Jun Wu
ed047705d9 obsstore: move _version to a propertycache
This makes sure _version is correct even if "_all" is not called.
2017-06-04 08:49:15 -07:00
Jun Wu
3835d8bd52 obsstore: separate marker parsing from obsstore reading
This allows us to get raw obsstore content without parsing any markers.
Reading obsstore is much cheaper than parsing markers.
2017-06-02 20:38:01 -07:00
Jun Wu
4c6d8665c7 obsstore: move marker version reading to a separate function
This allows us to read marker version without reading markers.
2017-06-02 19:34:56 -07:00
Jun Wu
d9a63e5be4 obsstore: minor optimization for the obsolete revset
Use local variables in a loop.
2017-06-02 19:32:27 -07:00
Yuya Nishihara
02355fbadc dispatch: do not close stdout and stderr, just flush() instead
Since 348863ccec7e "util: always force line buffered stdout when stdout is
a tty", we have two file objects attached to the same STDOUT_FILENO. If one
is closed, the underlying file descriptor is also closed, and writing to
the other file object would crash the Python interpreter in a hard way, at
least on Windows.

So, it seems safer to not close the standard streams. This also matches
the behavior of the default sys.stdout/stderr.close(), which never close
the FILE* streams in C layer.

https://hg.python.org/cpython/file/v2.7.13/Python/sysmodule.c#l1401
2017-04-23 00:31:29 +09:00
Yuya Nishihara
74b8d80dfc windows: do not close stdout on flush() failure
It's been there since 84af5a079c7d (2007-02-19), but seems wrong since any
I/O operations to a closed file would raise ValueError, not IOError. We should
keep the file object open even if the underlying file descriptor is half dead.
2017-06-05 23:36:35 +09:00
Yuya Nishihara
2a6bbffb41 test-obsolete-bundle-strip: do not include \n in filename (issue5586) 2017-06-05 23:23:03 +09:00
Yuya Nishihara
685172007c revlog: add support for partial matching of wdir node id
The idea is simple. If the given node id prefix is 'ff...f', add +1 to the
number of matches (e.g. ambiguous if partial + maybewdir > 1).

This patch also fixes id() revset and shortest() template since _partialmatch()
can raise WdirUnsupported exception.
2016-08-19 18:26:04 +09:00
Yuya Nishihara
09869bc4c0 revset: add support for branch(wdir()) and wdir() & branch() 2016-08-20 18:15:19 +09:00
Siddharth Agarwal
b1a08c7ef4 dirstate: add docstring for invalidate
This always confuses me, and we already have a docstring on
localrepo.invalidatedirstate.
2017-06-04 16:08:50 -07:00
Martin von Zweigbergk
8a01c6200d tests: simplify and clarify test-obsolete-bundle-strip.t a little 2017-06-02 23:05:03 -07:00
Martin von Zweigbergk
14d7cb9694 tests: add missing parens in test-obsolete-bundle-strip.t
The "(not ${revs})" was missing parens around ${revs}, so when revs
was "A + B", it became "(not A + B)" when actually "(not (A + B))" was
intended. Fixing that leads to some more testing of strip.

Similarly, the parens were missing in "${revs}::", making it "A + B::"
instead of "(A + B)::". Thanks to Yuya for noticing this part. This
did not affect any existing tests.
2017-06-02 23:29:20 -07:00
Matt Harbison
eac709d9da test-clonebundles: conditionalize output for Windows
This was the fallout from 87957da1ca0b (on stable).  Now that individual lines
can be conditionalized, it seems better to be explicit, rather than mash all of
this into one regex.  "getaddrinfo failed" was added in efd8ac31a7e2 to support
Windows.
2017-06-04 20:37:32 -04:00
Matt Harbison
d898f4f6e4 tests: adjust recent output changes for Windows 2017-06-04 20:11:59 -04:00
Matt Harbison
66cdc3e9cb killdaemons: close pid file before killing processes
With #serve enabled on Windows, I was getting occasional stacktraces like this:

  Errored test-hgweb-json.t: Traceback (most recent call last):
    File "./run-tests.py", line 724, in run
      self.tearDown()
    File "./run-tests.py", line 805, in tearDown
      killdaemons(entry)
    File "./run-tests.py", line 540, in killdaemons
      logfn=vlog)
    File "...\tests\killdaemons.py", line 94, in killdaemons
      os.unlink(pidfile)
  WindowsError: [Error 32] The process cannot access the file because it is
     being used by another process: '...\\hgtests.zmpqj3\\child80\\daemon.pids'

Adrian suggested using util.posixfile, which works.  However, the 'mercurial'
package isn't in sys.path when invoking run-tests.py, and it isn't clear that
hacking[1] it in is a good thing (especially for test-run-tests.t, which uses an
installation in a temp folder).

I tried using ProcessMonitor to figure out what the other process is, but that
monitoring slows things down to such a degree that the issue doesn't occur.  I
was ready to blame the virus scanner, but it happens without that too.

Looking at the code, I don't see anything that would have the pid file open.
But I was able to get through about 20 full test runs without an issue with this
minor change, whereas before it was pretty certain to hit this at least once in
two or three runs.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097907.html
2017-05-22 21:45:02 -04:00
Matt Harbison
482ee81f5d win32: drop a py26 daemonizing hack
I'm not sure what the referenced hang specifically was, but the whole test suite
(with #serve) still runs on python 2.7.13.  Aside from no longer prepending
"cmd.exe /c", this backs out a2700a095510.

I'm trying to track down a rare failure of TerminateProcess() with an access
error, and I've seen random extra python processes hanging around after running
tests sometimes, so this might help.

However, c9d78bd0980d forces this change.  Since the pid object is no longer
converted to a string, the cmd.exe pid was being saved instead of the hg pid,
and none of the daemons were being killed.
2017-05-21 18:58:51 -04:00
Pierre-Yves David
92378aada1 checkheads: simplify the code around obsolescence post-processing
The 'discardedheads' return become unused and the relationship between newheads
and newhs can be clarified. Our next goal here is to be able to extract the
_postprocessobsolete call outside of the loop.

We keep returning the 'discardedheads' because we'll start using it again soon
in this series.
2017-05-29 05:23:30 +02:00
Pierre-Yves David
8ab44eb083 checkheads: drop now unused filtering of 'unsyncedheads'
Now that unsynced heads are no longer in the function inputs or returns, we can
simplify the code a bit.
2017-05-29 05:21:38 +02:00
Pierre-Yves David
12e4c6dacb checkheads: clarify that we no longer touch the head unknown locally
Since b5554fb97d46, heads unknown locally no longer get any post processing
from obsolescence markers. We clarify this fact by only feeding the list of
locally known new heads to the function. This simplification of the input will
help moving that post-processing earlier in the function.
2017-05-29 05:20:09 +02:00
Pierre-Yves David
25c3e1db72 headssummary: ensure all returned lists are sorted
This is a simple step that will help to keep a stable output in coming
refactoring.
2017-05-29 05:33:59 +02:00
Pierre-Yves David
20859d5371 discovery: also use lists for the returns of '_oldheadssummary'
The '_headssummary' function is documenting and using list objects in its
return.  We now use them in _oldheadssummary too for consistency. This does not
affect any usages of these values.
2017-05-29 05:37:19 +02:00
Pierre-Yves David
b4a185b2cf test: add a push race case where the updated head is obsoleted
This is the mirror of the previously added case. We check the case where the
racing-push obsoletes a head while the raced-push updates that same head.
2017-05-29 05:53:51 +02:00
Pierre-Yves David
da1588880d test: add a push race case where obsoleted head is updated
We check the case where the raced-push obsoletes a head while the racing-push
updates that same head.
2017-05-29 05:53:24 +02:00
Kyle Lippincott
91ebfaffc5 keepalive: set buffering=True to do more efficient reads of headers
Support for buffering was added to python in d09d6fe31b61, first released with
python2.7.  Without this, the entirety of the response headers is read
byte-by-byte (it does more efficient reads when it gets to the non-header part
of the response).
2017-06-02 14:08:26 -07:00
Kyle Lippincott
01d7c04db6 keepalive: pass the correct arguments to HTTPResponse
python2.7's httplib.HTTPResponse takes the arguments in the following order:
    sock, debuglevel, strict, method, buffering

This was previously passing them in as positional and skipped strict, so we set
strict=method.  I'm explicitly setting strict=True now to preserve the previous
behavior that has been there since this file was created.
2017-06-01 18:23:20 -07:00
Matt Harbison
fd4c90025c help: update the color documentation for Windows 10 ANSI support
It looks like only the initial release of Windows 10 lacked support for this
functionality. [1][2]  Since that build is no longer supported, I didn't bother
getting very specific, to keep the help text less cluttered.

[1] https://github.com/symfony/symfony/issues/17499#issuecomment-243481052
[2] https://en.wikipedia.org/wiki/Windows_10_version_history
2017-05-22 22:32:59 -04:00
Matt Harbison
2671b24110 color: enable ANSI support on Windows 10
This will display color if "color.mode=ansi", and default to 'ansi' if the mode
is set to 'auto'.  The 'debugcolor' command also reflects this policy.
Previously, "color.mode=ansi" on Windows printed jibberish around the normal
text.  Using ANSI color is better, as it avoids the normal loss of color when
the default pager is enabled on Windows.  See also issue5570.

When the underlying function fails (e.g. when run on older Windows), 'auto'
still falls back to 'win32'.  Apparently, Microsoft originally had this feature
turned on by default, and then made it opt-in[1].  Therefore, not enabling it
unconditionally seems safer.  Instead, only do it after processing the existing
check for support in a Unix-like environment.

[1] https://github.com/symfony/symfony/issues/17499#issuecomment-243481052
2017-05-22 22:20:38 -04:00
Matt Harbison
8487f39227 win32: add a method to enable ANSI color code processing on Windows 10
SetConsoleMode() fails with an invalid parameter error if given this option
prior to Windows 10, so indicate that to the caller instead of doing explicit
version checks.
2017-05-22 22:00:56 -04:00
Kevin Bullock
b00d7583d8 merge with stable 2017-06-04 08:57:37 -05:00
Kevin Bullock
37a82e2a00 Added signature for changeset 28e02e510eac 2017-06-04 08:16:37 -05:00
Yuya Nishihara
d2ef5f6afb export: map wctx.node() to 'ff...' node id (issue5438) 2017-06-03 19:17:19 +09:00