Commit Graph

11374 Commits

Author SHA1 Message Date
Yuya Nishihara
afe324b8ba revset: filter first/last members by __and__ operation
This replaces 'if y in subset' with '& subset'. first(null) and last(wdir())
are fixed thanks to fullreposet.__and__.

This also revealed that first() and last() don't follow the order of the
input set. 'ls & subset' is valid only if the ordering requirement is 'define'
or 'any'.

No performance regression observed:

  revset #0: limit(0:9999, 100, 9000)
  0) 0.001164
  1) 0.001135
  revset #2: 9000 & limit(0:9999, 100, 9000)
  0) 0.001224
  1) 0.001181
  revset #3: last(0:9999, 100)
  0) 0.000237
  1) 0.000199
2017-06-10 19:41:42 +09:00
Yuya Nishihara
1912966e67 revset: reject negative number to select first/last n members
Negative 'lim' doesn't make sense here, and it makes things complicated
when using list[:lim].
2017-06-10 18:35:11 +09:00
Yuya Nishihara
352ebafde5 revset: fix order of last() n members where n > 1 (BC)
last() is implemented using a reversed iterator, so the result should be
reversed again.

I've marked this as BC since it's quite old bug seen in 3.0. The first bad
revision is 1ef0875a62f8 "revset: changed last implementation to use lazy
classes."
2017-06-10 18:04:56 +09:00
Yuya Nishihara
2fce781b0d debugrevspec: add option to suppress list of computed revisions
Test will be added later.
2017-06-10 20:14:23 +09:00
Yuya Nishihara
3299c032dd debugrevspec: add option to print representation of smartset object
It's possible by -v, but -v also prints a parsed tree. Test will be added
later.
2017-06-10 20:03:35 +09:00
Pierre-Yves David
81c8d3b7b6 profile: support --profile in alias and abbreviated version (--prof)
We now process the "--profile" a second time after alias has been processed and
the command argument fully parsed. If appropriate we enable profiling at that
time.

In these situation, the --profile will cover less than if the full --profile
flag was passed on the command line. This is better than the previous behavior
(flag ignored) and still fullfil multiple valid usecases.
2017-06-09 12:36:07 +01:00
Matt Harbison
402bd4d6c2 test-hardlinks: stabilize for Windows
This broke in db26e1073a5f, which breaks hardlinks when the executable bit is
toggled.
2017-06-10 00:06:57 -04:00
Rishabh Madan
085efcbf00 releasenotes: add more tests for formatting and merging of release notes 2017-06-04 00:16:45 +02:00
Gregory Szorc
f086e3d59e releasenotes: command to manage release notes files
Per discussion on the mailing list, we want better release notes
for Mercurial.

This patch introduces an extension that provides a command for
producing release notes files. Functionality is implemented
as an extension because it could be useful outside of the
Mercurial project and because there is some code (like rst
parsing) that already exists in Mercurial and it doesn't make
sense to reinvent the wheel.

The general idea with the extension is that changeset authors
declare release notes in commit messages using rst directives.
Periodically (such as at publishing or release time), a project
maintainer runs `hg releasenotes` to extract release notes
fragments from commit messages and format them to an auto-generated
release notes file. More details are explained inline in docstrings.

There are several things that need addressed before this is ready
for prime time:

* Moar tests
* Interactive merge mode
* Implement similarity detection for individual notes items
* Support customizing section names/titles
* Parsing improvements for bullet lists and paragraphs
* Document which rst primitives can be parsed
* Retain arbitrary content (e.g. header section/paragraphs)
  from existing release notes file
* Better error messages (line numbers, hints, etc)
2017-06-02 23:33:30 +02:00
Siddharth Agarwal
6e165aa389 test-dirstate-race: ensure that a isn't in the lookup set at the end
We're going to rely on this in upcoming patches.
2017-06-10 14:07:31 -07:00
Siddharth Agarwal
1d32a76696 hghave: add test for whether fsmonitor is enabled
This uses the HGFSMONITOR_TESTS environment variable that
fsmonitor-run-tests.py adds.
2017-06-10 14:07:31 -07:00
Siddharth Agarwal
a90fb2f356 tests: add a wrapper to run fsmonitor tests
This script does a bunch of non-trivial configuration work: in particular, it
sets up an isolated instance of Watchman which isn't affected by global state
and can be torn down on completion.

This script also sets the HGFSMONITOR_TESTS environment variable, which hghave
will use in the next patch to allow gating on whether fsmonitor is enabled.

With fsmonitor enabled, there appear to be a number of failures in the test
suite. It's not yet clear to me why they're happening, but if someone would
like to jump in and fix some of them I hope this will be helpful for that.
2017-06-10 14:07:30 -07:00
Pierre-Yves David
c82b13f1cf setdiscovery: improves logged message
The 'srvheads' list contains all server heads including the common ones. We
adjust 'ui.log' message to provide more useful information about server heads
locally unknown. The performance impact of turning the list to set is
negligible (about 1e-4s) compared to the rest of the discovery cost, so I'm
taking the easy path.
2017-06-10 18:47:09 +01:00
Augie Fackler
e82e3401a1 tests: handle variation between pure and normal output in annotate --skip
I'm pretty sure that both results are valid, depending on how you
slice the edits.
2017-06-10 10:46:06 -04:00
Brandon McCaig
0309412bc4 bisect: improve option validation message 2017-06-09 20:12:39 -04:00
Gregory Szorc
fa21f12af8 hgweb: refresh styling of gitweb's search form
gitweb was missing the hint hover box. So that was added.

Also, the positioning of the form was absolute and it didn't
vertically align on all pages. The element has been moved inline
with the navigation links (which now are contained in a div) and
flexbox is used to obtain sane alignment of the navigation links
and search form. For those new to flexbox,
"justify-content: space-between" basically says to maximize space
elements. You can use it to easily get left and right justified
containers without having to worry about width, floating, etc.
"align-items: center" centers all items in a cross-axis. I've
literally wasted hours trying to figure out both these problems
before flexbox. Flexbox is amazing.

Flexbox has been supported by Chrome and Firefox for a few years.
But it is only supported by IE 11. I'm willing to wager that
people using this either won't be using IE or will be using IE 11.
So I'm willing to be a bit aggressive in adopting flexbox because
it makes CSS alignment so much easier.
2017-06-09 13:55:51 -07:00
Gregory Szorc
1e2e56cc41 hgweb: consistently add search form to all gitweb pages
Paper has it on all pages. Not sure why gitweb doesn't. I think it
should be everywhere because it is a useful feature.

Also, we weren't consistently adding the HTML in the same place. This
was OK since the element is absolutely positioned. But this bothered
me a bit, so I went ahead and fixed it.
2017-06-09 13:45:36 -07:00
Gregory Szorc
4d72365e92 hgweb: consolidate search form for gitweb 2017-06-09 13:42:38 -07:00
Gregory Szorc
734d5b7555 hgweb: consolidate search form for monoblue
Same deal as for paper.
2017-06-09 13:41:10 -07:00
Gregory Szorc
3816d83a29 hgweb: consolidate search form for paper
AFAICT this was mostly a bunch of copy pasta. The only variation is
some pages defined a "value" attribute. The "query" variable will
just be empty on pages that don't accept it. So let's consolidate
the template and remove the redundancy.
2017-06-09 13:59:13 -07:00
Matt Harbison
10ea5ea0de test-extension: fix load path for Windows
The previous code was trying to load the extension from /tmp/hgtests.xxx/...,
but the actual path for tests is C:\Users\...\Temp\hgtests.xxx\...  I assume
that the former is an MSYS path that maps somewhere under C:\MinGW.
2017-06-09 23:56:50 -04:00
Matt Harbison
71414924c3 test-setdiscovery: stabilize for Windows
Windows wants double quotes here.
2017-06-10 00:11:54 -04:00
Matt Harbison
5eb7c3a833 convert: correct the documentation about whitespace in branchmap branches
Might as well let the users know they can get rid of branch names with spaces.
2017-06-10 02:20:14 -04:00
FUJIWARA Katsunori
457ca6840f context: avoid writing outdated dirstate out (issue5584)
Before this patch, workingctx.status() may cause writing outdated
dirstate out, if:

  - .hg/dirstate is changed simultaneously after last loading it,
  - there is any file, which should be dirstate.normal()-ed

Typical issue case is:

  - the working directory is updated by "hg update"
  - .hg/dirstate is updated in background (e.g. fsmonitor)

This patch compares identities of dirstate before and after
acquisition of wlock, and avoids writing outdated dirstate out, if
change of .hg/dirstate is detected.
2017-06-09 13:07:49 +09:00
FUJIWARA Katsunori
72d07d2573 tests: factor external procedures out for portability
Fortunately, "&&" is treated as "execute next, if previous doesn't
fail" both on POSIX and Windows. But keeping portability of
"dirstaterace.command" manually is troublesome.

This patch factors external procedures out as a shell script for
portability. "sh SCRIPT" always allows scripting in POSIX style.

This change is also for convenience. Fixed script name can reduce
command line arguments.

"r" prefix is needed for "sh '$TESTTMP/dirstaterace.sh'", because
$TESTTMP contains backslash on Windows.
2017-06-09 13:07:49 +09:00
Gregory Szorc
c8a15a9f84 debugcommands: issue warning when repo has secret changesets (issue5589)
This seems like a prudent thing to do. As the inline comment says,
we may want to make this abort once the functionality is stabilized
as part of `hg bundle`. Let's save that debate for another day.
2017-06-09 10:42:19 -07:00
Gregory Szorc
bc8582fc01 streamclone: consider secret changesets (BC) (issue5589)
Previously, a repo containing secret changesets would be served via
stream clone, transferring those secret changesets. While secret
changesets aren't meant to imply strong security (if you really
want to keep them secret, others shouldn't have read access to the
repo), we should at least make an effort to protect secret changesets
when possible.

After this commit, we no longer serve stream clones for repos
containing secret changesets by default. This is backwards
incompatible behavior. In case anyone is relying on the behavior,
we provide a config option to opt into the old behavior.

Note that this defense is only beneficial for remote repos
accessed via the wire protocol: if a client has access to the
files backing a repo, they can get to the raw data and see secret
revisions.
2017-06-09 10:41:13 -07:00
Yuya Nishihara
91bdea4c9e json: pass formatting options recursively
This bug was introduced in 469914605447. It's okay to escape <>, but is
unnecessary for command output.
2017-06-09 21:33:15 +09:00
Yuya Nishihara
9446b4d29d test-obsolete: include <> in user field to check JSON escapes
I found json() filter doesn't pass formatting options recursively. That's
why <> are escaped.
2017-06-09 21:45:22 +09:00
Pierre-Yves David
c876bd5bd3 bookmarks: explicitly convert to 'node' during initialization
We know the content of the file is supposed to be full hex. So we can do the
translation ourselves and directly check if the node is known.

As nice side effect we now have proper error handling for invalid node value.

Before:
! wall 0.021580 comb 0.020000 user 0.020000 sys 0.000000 (best of 134)

After:
! wall 0.009342 comb 0.010000 user 0.010000 sys 0.000000 (best of 302)
2017-06-07 22:26:43 +01:00
Pierre-Yves David
78ab1d5356 perf: add a perfbookmarks command
A new command dedicated to benchmark of bookmark initialization.
2017-06-07 18:22:11 +01:00
Augie Fackler
b311f3befb tests: add a test for installing hg with pip in a virtualenv
Since we're doing so much clever junk in our setup.py, let's have a
test that exercises it.

Thanks to Matt Harbison for testing this on Windows and verifying that
installenv/*/hg would work as a way to work around bin being called
Scripts on Windows.
2017-06-06 11:16:38 -04:00
Augie Fackler
3ec7cf5f67 hghave: add check for virtualenv 2017-06-06 11:16:10 -04:00
Augie Fackler
19e290eb76 extensions: catch uisetup and extsetup failures and don't let them break hg
Otherwise users of the patience diff extension will be unable to run
anything at all in hg 4.3 until they figure out what's broken.
2017-06-06 10:09:48 -04:00
Augie Fackler
eefe0d8d81 tests: add test demonstrating how broken third-party extensions can get
I intend to fix this, but will do the fix as a separate change to make
the behavior change obvious. This was inspired by some users having
the patience diff extension, which broke when we moved bdiff.so so
thoroughly the users can't even run 'hg debuginstall'.
2017-06-06 10:03:16 -04:00
Koen Van Hoof
587e5d1c67 chmod: create a new file when flags are set on a hardlinked file
For performance reasons we have several repositories where the files in the working
directory of 1 repo are hardlinks to the files of the other repo
When an update in one repo results in a chmod of a such a file, the hardlink
has to be deleted and replaced by a regular file to make sure that the change
does not happen in the other repo
2017-04-26 16:05:22 +02:00
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