Commit Graph

33655 Commits

Author SHA1 Message Date
Jun Wu
e2c4f27de2 run-tests: pre instantiate pygments objects
This speeds up run-tests.py diff output by 10x, which affects developer
experience significantly. As demonstrated by the following test:

```
#require pygments

  $ for i in `seq 1 200`; do
  >   echo '  $ echo '$i >> test-a.t
  >   echo '  wrong' >> test-a.t
  > done

  $ cat > walltime.py <<EOF
  > from __future__ import absolute_import, print_function
  > import os, sys, time
  > t1 = time.time()
  > os.system(' '.join(sys.argv[1:]) + ' >/dev/null 2>/dev/null')
  > t2 = time.time()
  > print('%0.2f' % (t2 - t1))
  > EOF

  $ $PYTHON walltime.py $TESTDIR/run-tests.py -l --color=never $TESTTMP/test-a.t
  0.24

Before this patch:

  $ $PYTHON walltime.py $TESTDIR/run-tests.py -l --color=always $TESTTMP/test-a.t
  2.46

After this patch:

  $ $PYTHON walltime.py $TESTDIR/run-tests.py -l --color=always $TESTTMP/test-a.t
  0.25
```
2017-07-21 08:43:39 -07:00
Augie Fackler
bb89feb159 contrib: drop Python 2.6 from manylinux1 wheel script 2017-07-19 13:44:22 -04:00
Augie Fackler
60b506ed63 contrib: make build-linux-wheels.sh executable 2017-07-19 13:45:06 -04:00
Siddharth Agarwal
71d0912db5 test-dirstate-race: hide irrelevant hg status output
See the explanation for more.

Differential Revision: https://phab.mercurial-scm.org/D153
2017-07-20 18:04:21 -07:00
Matt Harbison
771937deed test-commit: stabilize for filesystems without symlink support 2017-07-18 20:34:22 -04:00
Matt Harbison
cdf9eba4e7 test-https: properly conditionalize Windows vs non-Windows output
There's a bug in the (feature !) annotation, and this needs to be resolved
before fixing it.  Once fixed, the glob '*/missing' will match the output
'/missing' on non-Windows platforms, consuming the output line and leaving
nothing for the no-windows required line.

I probably should have made (foo !) match only the 'foo' feature, and be ignored
otherwise instead of optional.  (re) didn't work here, because the parenthesis
need to be escaped too.
2017-07-18 19:49:51 -04:00
Kevin Bullock
0a65c05074 Added signature for changeset c586a74f81b3 2017-07-19 07:58:03 -05:00
Rishabh Madan
923d0c8971 releasenotes: add custom admonitions support for release notes
By default, the extension has default sections like fix, feature, perf etc.. This
patch allow user to add support for custom admonition. In order to add a custom
admonition, one needs to have a .hgreleasenotes file inside the repository. All the
custom directive with name specified under the tag [sections] will be
usable by the extension. One important thing to keep in mind is if there exists any
custom admonitions with same key as default then they will override the default ones.
2017-07-18 23:04:08 +05:30
Ryan McElroy
5a6e1ad8d5 check-config: mention the file and line of the error
I used this to more quickly track down a failing test-check-config.t issue
in another repo. I thought it might be useful more generally, so I'm sending
it out in case others think it's a worthwhile change.
2017-07-18 06:27:36 -07:00
Durham Goode
7ab951502c rebase: add config to move rebase into a single transaction
This was previously landed as 507f16f4aa51 but backed out in a5abaa81fa because
it broke hook mid rebase and caused conflict resolution data loss in the event
of unexpected exceptions. This new version adds the behavior back but behind a
config flag, since the performance improvement is notable in large repositories.

The next patch adds a test covering this config.

The old commit message was:

Previously, rebasing would open several transaction over the course of rebasing
several commits. Opening a transaction can have notable overhead (like copying
the dirstate) which can add up when rebasing many commits.

This patch adds a single large transaction around the actual commit rebase
operation, with a catch for intervention which serializes the current state if
we need to drop back to the terminal for user intervention. Amazingly, almost
all the tests seem to pass.

On large repos with large working copies, this can speed up rebasing 7 commits
by 25%. I'd expect the percentage to be a bit larger for rebasing even more
commits.

There are minor test changes because we're rolling back the entire transaction
during unexpected exceptions instead of just stopping mid-rebase, so there's no
more backup bundle. It also leave an unknown file in the working copy, since our
clean up 'hg update' doesn't delete unknown files.
(grafted from cca36c7f35261b0e31beb226bf361067ef0e06ab)
(grafted from dc497d8705b71503e32e07bd33925c1e42cf9c9a)

Differential Revision: https://phab.mercurial-scm.org/D134
2017-07-18 07:47:28 -07:00
Martin von Zweigbergk
d1b1e4a13b run-tests: remove unnecessary 'with_color' variable
Its value is always the same as that of 'pygmentspresent'.

Differential Revision: https://phab.mercurial-scm.org/D118
2017-07-17 16:32:10 -07:00
Martin von Zweigbergk
63ec7f9083 run-tests: warn if --color=always and no pygments installed
Differential Revision: https://phab.mercurial-scm.org/D117
2017-07-17 16:27:13 -07:00
Martin von Zweigbergk
41812f06d0 run-tests: drop unnecessary check for pygmentspresent
47985606a0ae (run-tests: check if stream is a tty before using color,
2017-07-18) made the check redundant but forgot to remove it.

Differential Revision: https://phab.mercurial-scm.org/D116
2017-07-17 16:28:42 -07:00
Martin von Zweigbergk
b32f922e53 run-tests: pass color option via test case object , not global var
At first I updated the color field of the 'options' object (from the
CLI parser), but then I decided to put it directly on the test case
object itself to avoid mutating the shared object (even though all
tests would have the same value).

Differential Revision: https://phab.mercurial-scm.org/D114
2017-07-17 16:15:15 -07:00
Jun Wu
e1a6ae2bac rebase: remove rebaseset from _checkobsrebase
The parameter is not used. Therefore removed.

Differential Revision: https://phab.mercurial-scm.org/D85
2017-07-14 09:01:45 -07:00
Jun Wu
1b3b693903 phabricator: sanity check Differential Revision from commit message
Previously, we trust Differential Revision in commit message blindly. This
patch adds sanity check so a host name change will be detected and the
commit message will be ignored.

Differential Revision: https://phab.mercurial-scm.org/D35
2017-07-10 18:02:03 -07:00
Matt Harbison
4d8c9c4521 test-phases-exchange: properly conditionalize output
I forgot to invert the conditions, and the test runner didn't catch it[1].  But
since only '&&' is supported in the per-line feature tests, this won't work
anyway.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-July/101941.html
2017-07-18 08:14:10 -04:00
Pulkit Goyal
4d367c3543 commitextras: mark the extension as ADVANCED 2017-07-18 00:10:44 +05:30
Matthieu Laneuville
ab721e92b9 run-tests: check if stream is a tty before using color
Previous implementation (ccf66c9bf5af) checked only if sys.stderr was a tty
which was less general. Also makes sure that colors is never used if pygments is
not available, irrespective of --color flag value.
2017-07-18 07:19:26 +09:00
Martin von Zweigbergk
1e3b6847e6 tests: rewrite test-rebase-detach.t using drawdag
This makes it much clearer because each test case can have exactly the
graph it wants (no extra cruft just because other tests want it).

Differential Revision: https://phab.mercurial-scm.org/D94
2017-07-14 21:44:29 -07:00
Martin von Zweigbergk
916919f081 tests: simplify config in test-rebase-detach.t
Differential Revision: https://phab.mercurial-scm.org/D93
2017-07-14 23:09:17 -07:00
Martin von Zweigbergk
e2487147f4 drawdag: include files from both parents in merge commits
Consider a graph like this:

  D
  |\
  B C
  |/
  A

drawdag will add a file called A in commit A, file B in B, file C in
C. That's fine and expected. In merge commits like D, I would expect
the files and their contents to be taken from the parent commits, so
commit D in this example would have files A, B, and C. However,
drawdag will instead add the file D compared to the first
parent. Depending on whether B or C got a smaller nodeid, the contents
of D would be {A, B, D} or {A, C, D}. This patch changes it to to be
{A, B, C}.

Differential Revision: https://phab.mercurial-scm.org/D92
2017-07-14 22:32:58 -07:00
Gregory Szorc
21ad83cca7 gitweb: preserve whitespace in description
Without this, multiple spaces or tabs in the commit message aren't
preserved and things like tables don't align properly.

As part of adding the CSS rule, we had to cuddle the content
with the <div> to not introduce leading and trailing whitespace.
The "addbreaks" filter was also removed because it would insert
an additional newline, effectively double spacing content.

Differential Revision: https://phab.mercurial-scm.org/D113
2017-07-17 15:54:15 -07:00
Gregory Szorc
8509056f34 sparse: add a requirement when a repository uses sparse (BC)
The presence of a sparse checkout can confuse legacy clients or
clients without sparse enabled for reasons that should be obvious.

This commit introduces a new repository requirement that tracks
whether sparse is enabled. The requirement is added when a sparse
config is activated and removed when the sparse config is reset.

The localrepository constructor has been taught to not open repos
with this requirement unless the sparse feature is enabled. It yields
a more actionable error message than what you would get if the
lockout were handled strictly at the requirements verification phase.
Old clients that aren't sparse aware will see the generic
"repository requires features unknown to this Mercurial" error,
however.

The new requirement has "exp" in its name to reflect the
experimental nature of sparse. There's a chance that the eventual
non-experimental feature won't change significantly and we could
have squatted on the "sparse" requirement without ill effect. If
that happens, we can teach new clients to still recognize the old
name. But I suspect we'll sneak in some BC and we'll want a new
requirement to convey new meaning.

Differential Revision: https://phab.mercurial-scm.org/D110
2017-07-17 11:45:38 -07:00
Gregory Szorc
e4e4915b76 sparse: consolidate common code for writing sparse config
In 3 functions we were writing the sparse config and updating the
working directory. In two of them we had a transaction-like process
for restoring the sparse config in case of wdir update fail.

Because the pattern is common, we've already made mistakes, and the
complexity will increase in the near future, let's consolidate the
code into a reusable function.

As part of this refactor, we end up reading the "sparse" file twice
when updating it. This is a bit sub-optimal. But I don't think it
is worth the code complexity to pass around the variables to avoid
the redundancy.

Differential Revision: https://phab.mercurial-scm.org/D109
2017-07-17 11:21:23 -07:00
Gregory Szorc
64adaa7b62 revset: pass repo when passing ui
The repo instance is currently only used to provide a changeset
lookup function as part of parsing revsets. I /think/ this allows
node fragments to resolve. I'm not sure why we wouldn't want this
to always "just work" if parsing a revset string.

Plus, an upcoming commit will introduce a new consumer that needs a
handle on the repo. So passing it more often will make that code
work more.

Passing a repo instance in all callers of revset.match* results in
a bunch of test changes. Notably, branch and tags caches get
populated as part of evaluating revsets. I'm not sure if this is
desirable. So this patch takes the conservative approach and only
passes the repo if we're passing a ui instance.

Differential Revision: https://phab.mercurial-scm.org/D97
2017-07-15 15:51:57 -07:00
Kevin Bullock
bfa5943656 win32: copy-edit debugssl messages to match prevailing style 2017-07-17 13:22:59 -05:00
Pulkit Goyal
2ceeb040ad run-tests: make sure to check if pygments is installed before using it
e80041832e introduced support to color the output of tests but used pygments
without checking whether it's installed or not. That breaks test-run-tests.t for
machines which don't have pygments installed. This patch conditionalize the
color test in test-run-tests.t and also add a check to make sure pygments is
installed before using that.
2017-07-15 02:17:05 +05:30
Gregory Szorc
fde2177334 sparse: require [section] in sparse config files (BC)
Previously, [include] was implicit and pattern lines before a
[section] were added to includes.

Because the format may change in the future and explicit behavior,
well, more explicit, this commit changes the config parser to
reject pattern lines that don't occur in a [section].

Differential Revision: https://phab.mercurial-scm.org/D96
2017-07-15 13:21:23 -07:00
Gregory Szorc
edf6de3f78 sparse: use set for capturing profiles
Order doesn't need to be preserved. A set is acceptable.

Differential Revision: https://phab.mercurial-scm.org/D95
2017-07-15 13:07:57 -07:00
Alex Gaynor
088c6ecb28 util: remove dead code which used to be for old python2 versions
Differential Revision: https://phab.mercurial-scm.org/D107
2017-07-17 12:38:07 -04:00
Jun Wu
79f323ea22 rebase: remove revignored and nullmerge states
They are no longer necessary to make rebase behavior correct. Therefore
remove them to make the code cleaner and easier to reason about.

Differential Revision: https://phab.mercurial-scm.org/D26
2017-07-10 12:18:32 -07:00
Jun Wu
075caa84b6 rebase: remove messages for nullmerge and revignored (BC)
These states will be removed to make the code cleaner and more robust.
Remove their messages first to make review easier.

Differential Revision: https://phab.mercurial-scm.org/D25
2017-07-08 20:38:34 -07:00
Jun Wu
0f5023c94c rebase: remove revprecursor and revpruned states (BC)
Those states are no longer necessary for rebase to function properly. Remove
them to make the code cleaner.

Marked as BC because in a corner case where working parent is obsoleted, and
is skipped for rebase, we no longer move working parent after rebase
completes. That is better since if working parent is obsoleted, it should be
the user moving working parent back there (after a rebase) explicitly, in
that case, we shouldn't move working parent again.

Differential Revision: https://phab.mercurial-scm.org/D24
2017-07-08 20:38:34 -07:00
Jun Wu
d763d13686 rebase: move obsoleted not rebased messages earlier (BC)
A later patch will clean up those states. This patch moves the messages
earlier.

Marked as BC since the order of message has changed.

Differential Revision: https://phab.mercurial-scm.org/D23
2017-07-08 20:14:33 -07:00
Jun Wu
5fe54ecae3 rebase: extract ctx description logic to a function
The function will be used in a later patch.

Differential Revision: https://phab.mercurial-scm.org/D22
2017-07-08 20:05:52 -07:00
Augie Fackler
837cc32717 python3: whitelist another *13* tests that now pass
Differential Revision: https://phab.mercurial-scm.org/D302
2017-07-27 00:00:15 -04:00
Augie Fackler
a80f148d0c py3: introduce a wrapper for __builtins__.{raw_,}input()
In order to make this work, we have to wrap the io streams in a
TextIOWrapper so that __builtins__.input() can do unicode IO on Python
3. We can't just restore the original (unicode) sys.std* because we
might be running a cmdserver, and if we blindly restore sys.* to the
original values then we end up breaking the cmdserver. Sadly,
TextIOWrapper tries to close the underlying stream during its __del__,
so we have to make a sublcass to prevent that.

If you see errors like:

TypeError: a bytes-like object is required, not 'str'

On an input() or print() call on Python 3, the substitution of
sys.std* is probably the root cause.

A previous version of this change tried to put the bytesinput() method
in pycompat - it turns out we need to do some encoding handling, so we
have to be in a higher layer that's allowed to use
mercurial.encoding.encoding. As a result, this is in util for now,
with the TextIOWrapper subclass hiding in encoding.py. I'm not sure of
a better place for the time being.

Differential Revision: https://phab.mercurial-scm.org/D299
2017-07-24 14:38:40 -04:00
Augie Fackler
ac44b37ecd python3: whitelist four more passing tests
Differential Revision: https://phab.mercurial-scm.org/D298
2017-07-26 23:33:26 -04:00
Augie Fackler
a5ac7e4cdd extensions: don't give AttributeError bytes message on Python 3
Differential Revision: https://phab.mercurial-scm.org/D353
2017-08-11 15:09:54 -04:00
Augie Fackler
749c36880e extensions: if on py3 and propname is a bytestr, convert to sysstr
Property names are unicodes on Python 3.

Differential Revision: https://phab.mercurial-scm.org/D296
2017-07-25 22:49:43 -04:00
Pulkit Goyal
7d16e8a210 pushvars: add a coreconfigitem for push.pushvars.server
Differential Revision: https://phab.mercurial-scm.org/D359
2017-08-12 04:47:40 +05:30
Jun Wu
88987c3640 phabricator: add phabupdate command to update status in batch
Changing status (accept, etc) on the webpage is not very convenient -
currently there is no way to accept (or abandon etc.) a stack using a single
click or command.

This patch adds a `phabupdate` command that could be used to change status
in batch. It also supports `--comment` which will write a comment on the
last revision, which is similar to what we do using emails.

Differential Revision: https://phab.mercurial-scm.org/D127
2017-07-18 02:05:19 -07:00
Jun Wu
2891bb4274 phabricator: add status to revision query language
This patch adds status words (ex. `abandoned`, `accepted`, `needsreview`,
`needsrevision`, `closed`) to the revision query language so people can
select revision in a more flexible way.

Test Plan:
Try something like `phabread ':2 & accepted'`, `phabread ':105 - closed` and
make sure they have desired outputs.

Differential Revision: https://phab.mercurial-scm.org/D126
2017-07-18 01:34:55 -07:00
Jun Wu
99c3ae0727 phabricator: add a small language to query Differential Revisions
Previously, `phabread` can only be used to read a single patch, or a single
stack of patches. In the future, we want to have more complex queries like
filtering with status (open, accepted, closed, etc), or maybe more complex
like filtering by reviewers etc. The command line flag approach won't scale
with that.

Besides, we might want to have other commands to update Differential
Revision status in batch, like accepting a stack using a single command.

Therefore, this patch adds a small language. It has basic set operations:
`&`, `+`, `-` and an ancestor operator to support `--stack`.

Test Plan:
Try querying this Phabricator instance:

  hg phabread 1+2 # 1, 2
  hg phabread D2+D1 # 2, 1
  hg phabread ':118-115+:2-1' # 114, 116, 117, 118, 2
  hg phabread '((:118-(D115+117)))&:117' # 114, 116
  hg phabread ':2&:117' --debug # differential.query is called only once

Make sure the output is expected and prefetch works.

Differential Revision: https://phab.mercurial-scm.org/D125
2017-07-17 23:19:11 -07:00
Jun Wu
3cee5f17d5 phabricator: change "readpatch" to be more flexible
Previously, `readpatch` and `querydrev` take a same `params` and `stack`
parameters. This patch changes `readpatch` so it takes the output of
`querydrev`, not the input of `querydrev`. This makes the code more
flexible and cleaner.

Differential Revision: https://phab.mercurial-scm.org/D124
2017-07-17 23:14:06 -07:00
Phil Cohen
a35c75e991 filemerge: extract _picklabels as a helper function
This shortens `simplemerge()` and is a bit cleaner, IMO.

Differential Revision: https://phab.mercurial-scm.org/D376
2017-08-13 22:46:16 -07:00
Phil Cohen
69c81f7498 simplemerge: write merge result to the localctx, if passed
Differential Revision: https://phab.mercurial-scm.org/D375
2017-08-13 22:46:03 -07:00
Phil Cohen
567a5b0454 simplemerge: use contexts to read file data from, if passed
Differential Revision: https://phab.mercurial-scm.org/D374
2017-08-13 20:06:52 -07:00
Phil Cohen
2238445cd7 filemerge: pass contexts to simplemerge
Otherwise, this should be a no-op.

Differential Revision: https://phab.mercurial-scm.org/D373
2017-08-13 20:06:52 -07:00