Commit Graph

11338 Commits

Author SHA1 Message Date
Siddharth Agarwal
1a9dd59bc4 run-tests: make --restart work with output dir 2017-06-07 21:17:24 -07:00
Siddharth Agarwal
dc354fabde run-tests: output coverage to output dir
There do not appear to be any tests for this, and I've never used either of
these options before, but this works.
2017-06-07 21:17:06 -07:00
Siddharth Agarwal
7a8b4a7007 run-tests: write JSON reports to output dir 2017-06-07 20:46:43 -07:00
Siddharth Agarwal
8cbca49faa run-tests: write test times to output dir 2017-06-07 20:32:11 -07:00
Siddharth Agarwal
3c77851e4b run-tests: allow specifying an output dir to write .errs to
I'm trying to use run-tests.py on a read-only file system. This series allows
that to happen.
2017-06-07 20:30:08 -07:00
Siddharth Agarwal
7eab0d3988 run-tests: add information about skipped tests to XUnit output
The XUnit spec supports skipped tests.
2017-06-07 15:47:06 -07:00
Siddharth Agarwal
1c6373299a run-tests: wrap failures in an XUnit 'failure' element
This is closer to what most XUnit consumers can understand.
2017-06-07 15:47:06 -07:00
Pierre-Yves David
ef5b27290d discovery: log discovery result in non-trivial cases
We log the discovery summary, the number of roundtrips and the elapsed time.
This is useful to understand where slow push might come from when lloking at
the blackbox.
2017-06-07 10:44:11 +01:00
Pierre-Yves David
4db3d34a4b discovery: include timing in the debug output
Having such date easily available is useful. It also prepare the inclusion of
some discovery related data in blackbox.
2017-06-07 10:29:39 +01:00
Augie Fackler
19a29b2751 tests: remove sys.executable from "required tools"
In practice this doesn't appear to have been true for some time - we
reference Python using the $PYTHON variable in all the tests now
(which we have to for PyPy and Python 3), and I've been using
~/.../python.exe to test with tip of the cpython 3.6 release branch
while working on manifest tests in Python 3 and everything seems to be
just fine. The only real observable difference from this change is
that I stop getting a warning about python.exe not being a thing on
$PATH, which seems like an improvement.
2017-05-28 21:33:33 -04: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
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
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
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
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
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
Yuya Nishihara
d2ef5f6afb export: map wctx.node() to 'ff...' node id (issue5438) 2017-06-03 19:17:19 +09:00
Yuya Nishihara
00d9212898 revset: add support for integer and hex wdir identifiers
As I said before, partial 'ff...' hash isn't supported yet.
2017-06-03 20:39:33 +09:00
Yuya Nishihara
b42457ae0a revlog: map rev(wdirid) to WdirUnsupported exception
This will allow us to map repo["ff..."] to workingctx. _partialmatch() will
be updated later. I tried "return wdirrev" in place of raising the exception,
but earlier exception seemed better.
2016-08-20 22:37:58 +09:00
Augie Fackler
9a722d4382 merge with stable 2017-06-03 16:33:28 -04:00
Siddharth Agarwal
41dae969eb status: don't crash if a lookup file disappears
This can happen if another process (even another hg process!) comes along and
removes the file at that time.

This partly resolves issue5584, but not completely -- a bogus dirstate update
can still happen. However, the full fix is too involved for stable.
2017-06-02 22:27:52 -07:00
Yuya Nishihara
f1b986c603 annotate: restructure formatter output to be nested list (BC)
Annotate data should be in [(file, [line...])...] form, but there was no
API to represent such data structure when I ported it to formatter. Now
we have fm.nested() and the -T option is still experimental, so we can fix
the data format.
2017-06-03 00:25:24 +09:00
Kyle Lippincott
8175ca534f zsh_completion: install as _hg not hg
The contrib/zsh_completion file itself says to name it _hg.

With a name like `hg`, if the user has a line like `autoload ${^fpath}/*(N-.:t)`
in their zshrc, it will create a shell function named `hg` that will hide the
actual hg command and make hg unusable.

Separately from that though, the underscore prefix makes it actually work. The
zsh man page states:

    The convention for autoloaded functions used in completion is that they
    start with an underscore

This does not seem to just be a "convention", though. With the ill-advised line
removed from my zshrc and the file named
`/usr/local/share/zsh/site-functions/hg` (without the underscore), these
completions did not seem to get loaded and the ones from the zsh installation
were loaded instead.  If I renamed them to be
`/usr/local/share/zsh/site-functions/_hg`, however, they were loaded.

I manually tested the above statement by starting a new zsh instance with the
file in `/usr/local/share/zsh/site-functions` with the following names:
- As `hg`, `which _hg_labels` did not show anything
- As `_hg`, `which _hg_labels` showed the expected function.
2017-05-26 13:24:07 -07:00
Augie Fackler
8e4d9f1f1d osx: override default exclude filter for pkgbuild
To quote `man 1 pkgbuild`:

     --filter filter-expression
                 By default, --root will include the entire contents of the
                 given root-path in the package payload, except for any .svn
                 or CVS directories, and any .DS_Store files. You can override
                 these default filters by specifying one or more --filter
                 options. Each filter-expression is an re_format(7)
                 ``extended'' expression: any path in the root which matches
                 any of the given expressions will be excluded from the pack-
                 age payload. (Note that specifying even one --filter inhibits
                 the default filters, so you must respecify the default fil-
                 ters if you still want them to be used.)

It turns out the default filter these days *also* includes .git and
.hg. Notice how that filter expression is a regular expression?  That
(presumably unintentionally) prevents a file named "chg" or "_hg" from
getting included in the distribution. Many many thanks to spectral@
for trying to include a _hg file which led us to figure this bug out.

Bug filed with Apple for this as rdar://problem/32437369, mentioning
both the gap in documentation and the wrong defaults.
2017-05-26 20:03:05 -04:00
Pierre-Yves David
970619c327 hghave: prefill more version of Mercurial
The previous code was unable to go above version 4.0.
2017-05-09 15:08:47 +02:00
Mads Kiilerich
d682210796 graft: fix graft across merges of duplicates of grafted changes
Graft used findmissingrevs to find the candidates for graft duplicates in the
destination. That function operates with the constraint:

  1. N is an ancestor of some node in 'heads'
  2. N is not an ancestor of any node in 'common'

For our purpose, we do however have to work correctly in cases where the graft
set has multiple roots or where merges between graft ranges are skipped. The
only changesets we can be sure doesn't have ancestors that are grafts of any
changeset in the graftset, are the ones that are common ancestors of *all*
changesets in the graftset. We thus need:

  2. N is not an ancestor of all nodes in 'common'

This change will graft more correctly, but it will also in some cases make
graft slower by making it search through a bigger and unnecessary large sets of
changes to find duplicates. In the general case of grafting individual or
linear sets, we do the same amount of work as before.
2017-05-11 17:18:40 +02:00
Mads Kiilerich
cfae38ec31 graft: test coverage of grafts and how merges can break duplicate detection
This demonstrates unfortunate behaviour: extending the graft range cause the
graft to behave differently. When the graft range includes a merge, we fail to
detect duplicates that are ancestors of the merge.
2017-05-09 00:11:30 +02:00
Gregory Szorc
3ffdc76e66 sslutil: reference fingerprints config option properly (issue5559)
The config option is "host:fingerprints" not "host.fingerprints".

This warning message is bad and misleads users.
2017-05-08 09:30:26 -07:00
Pulkit Goyal
0f2add9f8b py3: add test to show hg update and hg identify works on Python 3 2017-06-01 02:41:19 +05:30
Pulkit Goyal
51e63cb94e py3: add a test to show hg diff works on Python 3 2017-06-02 10:14:00 +05:30
Yuya Nishihara
6a634dc263 largefiles: make sure debugstate command is populated before wrapping
Copied the hack from 8fe57ad06da4, which seemed the simplest workaround.
Perhaps debugcommands.py should have its own commands table.
2017-05-04 15:23:51 +09:00
FUJIWARA Katsunori
b7a92ca8d3 help: describe about choice of :prompt as a fallback merge tool explicitly
"merge-tools" help topic has described that the merge of the file
fails if no tool is found to merge binary or symlink, since
9da9bced2226 (or Mercurial 1.7), which based on (already removed)
MergeProgram wiki page.

But even at that revision, and of course now, merge of the file
doesn't fail automatically for binary/symlink. ":prompt" (or
equivalent logic) is used, if there is no appropriate tool
configuration for binary/symlink.
2017-05-06 02:33:00 +09:00
Matt Harbison
44c7a911a4 help: spelling fixes 2017-05-03 22:07:47 -04:00
Matt Harbison
eef0589d4f test-diff-color: disable pager for expected output on Windows (issue5555)
Windows uses `more.com`, which unhelpfully adds an extra trailing line
consisting only of '\r'.  It also converts tab characters to spaces, which
throws off the last two tests.

Setting the 'ui.formatted' option is what allowed the pager to be used by these
tests in the first place.
2017-05-02 22:26:09 -04:00
Pierre-Yves David
bf9fa9e05b pager: rename 'pager.enable' to 'ui.paginate'
This aligns with what we do for color (see cea7a760c58d). Pager is a central
enough notion that having the master config in the [ui] section makes senses. It
will helps with consistency, discoverability. It will also help having a simple
and clear example hgrc mentioning pager.

The previous form of the option had never been released in a non-rc version but
we keep it around for convenience. If both are set, 'ui.pager' take priority.
2017-05-01 16:36:50 +02:00