Commit Graph

11777 Commits

Author SHA1 Message Date
Augie Fackler
71f181153f tests: update test-eol to pass our import checker 2017-08-22 15:51:06 -04:00
Augie Fackler
84bc4fa4db tests: update test-dirstate to pass our import checker 2017-08-22 15:50:59 -04:00
Augie Fackler
9767738e92 tests: update test-debugcommands to pass our import checker 2017-08-22 15:50:35 -04:00
Augie Fackler
e85cf68cd1 tests: update test-convert-clonebranches to pass our import checker 2017-08-22 15:50:27 -04:00
Augie Fackler
07679f3f36 tests: update test-commit to pass our import checker 2017-08-22 15:50:01 -04:00
Augie Fackler
3bf0b90e12 tests: update test-command-template to pass our import checker 2017-08-22 15:49:54 -04:00
Augie Fackler
bfd5f74f29 tests: update test-chg to pass our import checker 2017-08-22 15:49:20 -04:00
Augie Fackler
3260906bb2 tests: update test-bundle2-format to pass import checker 2017-08-22 15:05:51 -04:00
Augie Fackler
ee537483fc tests: update test-bundle2-pushback to pass the import checker 2017-08-22 15:04:36 -04:00
Augie Fackler
f8d9a41b22 tests: update test-bookmarks to pass the import checker 2017-08-22 15:04:14 -04:00
Augie Fackler
fca8e3aefa tests: update test-bisect to pass our module import checker 2017-08-22 14:58:39 -04:00
Augie Fackler
070f42ffe6 tests: update test-archive to pass our module import checker 2017-08-22 14:58:21 -04:00
Augie Fackler
abb025bbdf tests: update test-annotate to pass our module import checker 2017-08-22 14:58:10 -04:00
Rishabh Madan
f35bfd559f releasenotes: view admonition titles using -l flag
Since this extension is fairly new for almost all the contributors, remembering
the admonition (with titles) is difficult. The list (-l) flag provides
a list of all the active admonitions along with titles.

For usage, hg releasenotes -l returns the list.

Differential Revision: https://phab.mercurial-scm.org/D454
2017-08-28 04:11:58 +05:30
Martin von Zweigbergk
732c66f9a9 tests: move baduisetup test inside "#if demandimport"
The test case depends on the failure happening not at import time, but
at uisetup() time, so it doesn't make sense when demandimport is
disabled.

There was already a section for testing demandimport stuff, so I moved
it inside that existing section. As part of the move, I enabled the
extension using '--config' so subsequent tests don't get the bad
extension enabled.

Differential Revision: https://phab.mercurial-scm.org/D526
2017-08-26 16:00:07 -07:00
Jun Wu
6d78156438 test-casecollision-merge: fix the test
D30 (43976dd8adc8) makes the error message unpredictable, therefore the fix.

Differential Revision: https://phab.mercurial-scm.org/D494
2017-08-23 11:30:25 -07:00
Jun Wu
0d6dfaec17 run-tests: make per-line condition support testcase names
7340465bd added multiple test cases support. The latter has a problem -
output lines cannot be made conditional with `#if`:

```
  # COUNTEREXAMPLE: DOES NOT WORK
  #testcases A B
    $ command-foo
    common ouput
  #if A
    A's ouput
  #else
    B's ouput
  #endif
    common ouput
```

That's not trivial to fix (even if it works in test, `run-tests.py -i` may
be suboptimal because diff algorithm does not know how to skip the `#if`
lines, even if it does, it may have trouble figuring out whether a changed
line belongs to inside a `#if` block or outside).

Matching output lines conditionally is useful. 4eec2f04a added per-line
condition support for hghave. This patch extends that to also support test
case names.

Differential Revision: https://phab.mercurial-scm.org/D466
2017-08-20 09:46:27 -07:00
Yuya Nishihara
14e0bb89bd run-tests: pass unicode to Pygments
This is required on Python 3, and is more correct on Python 2 because
Pygments is a unicode library.
2017-08-24 22:20:02 +09:00
Yuya Nishihara
d5420b90d5 run-tests: factor out highlight functions 2017-08-24 22:15:40 +09:00
Yuya Nishihara
622a04a8fa run-tests: include "\n" in formatted message instead of calling writeln()
So we don't have to strip "\n" from pygments output.
2017-08-24 22:09:57 +09:00
Yuya Nishihara
a5ae36fcb1 encoding: add fast path of from/toutf8b() for ASCII strings
See the previous patch for why.

The added test seems not making much sense because ASCII strings should
never contain "\xed" and be valid UTF-8.

  (with mercurial repo)
  $ export HGRCPATH=/dev/null HGPLAIN=
  $ hg log --time --config experimental.stabilization=all -Tjson > /dev/null

  (original)
  time: real 6.830 secs (user 6.740+0.000 sys 0.080+0.000)
  time: real 6.690 secs (user 6.650+0.000 sys 0.040+0.000)
  time: real 6.700 secs (user 6.640+0.000 sys 0.060+0.000)

  (fast jsonescape)
  time: real 5.630 secs (user 5.550+0.000 sys 0.070+0.000)
  time: real 5.700 secs (user 5.650+0.000 sys 0.050+0.000)
  time: real 5.690 secs (user 5.640+0.000 sys 0.050+0.000)

  (this patch)
  time: real 5.190 secs (user 5.120+0.000 sys 0.070+0.000)
  time: real 5.230 secs (user 5.170+0.000 sys 0.050+0.000)
  time: real 5.220 secs (user 5.150+0.000 sys 0.070+0.000)
2017-04-23 13:08:58 +09:00
Yuya Nishihara
42ccee312b encoding: add fast path of from/tolocal() for ASCII strings
This is micro optimization, but seems not bad since to/fromlocal() is called
lots of times and isasciistr() is cheap and simple.

We boldly assume that any non-ASCII characters have at least one 8-bit byte.
This isn't true for some email character sets (e.g. ISO-2022-JP and UTF-7),
but I believe no such encodings are used as a platform default. Shift_JIS,
a major crap, is okay as it should have a leading byte in 0x80-0xff range.

  (with mercurial repo)
  $ export HGRCPATH=/dev/null HGPLAIN=
  $ hg log --time --config experimental.stabilization=all > /dev/null

  (original)
  time: real 7.460 secs (user 7.420+0.000 sys 0.030+0.000)
  time: real 7.670 secs (user 7.590+0.000 sys 0.080+0.000)
  time: real 7.560 secs (user 7.510+0.000 sys 0.040+0.000)

  (this patch)
  time: real 7.340 secs (user 7.260+0.000 sys 0.060+0.000)
  time: real 7.260 secs (user 7.210+0.000 sys 0.030+0.000)
  time: real 7.310 secs (user 7.260+0.000 sys 0.060+0.000)
2017-04-23 13:06:23 +09:00
Yuya Nishihara
a22ffac20b encoding: add function to test if a str consists of ASCII characters
Most strings are ASCII. Let's optimize for it.

Using uint64_t is slightly faster than uint32_t on 64bit system, but there
isn't huge difference.
2017-04-23 12:59:42 +09:00
Augie Fackler
38d077eb1e tests: update test-commandserver to pass our import checker 2017-08-22 14:26:25 -04:00
Augie Fackler
c781a5f62e tests: add blank output lines to test-commandserver
This helps the import checker notice when a Python heredoc has
ended. It's not perfect, but it gets nasty quick and I think the
better fix would be to add a real parser for .t-tests, which will have
to wait.
2017-08-22 16:37:56 -04:00
Augie Fackler
f804840943 tests: ensure demandimport test uses absolute_import 2017-08-22 15:50:53 -04:00
Augie Fackler
eaa8880ff9 tests: blacklist test-demandimport from test-check-module-imports
It just does too much weird import stuff to have a hope of passing the
checks.
2017-08-22 15:16:58 -04:00
Augie Fackler
2fbfd450ea tests: sort excluded test files in test-check-module-imports 2017-08-22 15:16:09 -04:00
Augie Fackler
c154e0a746 tests: blacklist some more entries in module import checks 2017-08-22 14:15:16 -04:00
David Demelier
f57348c7a4 bookmarks: allow deleting active bookmark using '.' 2017-08-24 09:23:06 +02:00
Boris Feld
e5f84ad7bf template: add minimal obsfate template function
The goal of this series is to have templates capable of displaying the
evolution of a changeset in a clean and human-readable way.

Add the succsandmarkers template return successors and markers so it can be
used separately like this:

> {succsandmarkers % "{get(succsandmarkers, "markers")|json};"}

The following patches will add template functions that takes successors and
markers as inputs and compute various obsfate fields from them.
2017-08-17 18:26:11 +02:00
David Demelier
fbe91693e0 bookmarks: allow renaming active bookmark using '.' 2017-08-21 08:52:46 +02:00
Augie Fackler
beda3d5545 i18n: update check-translation script to pass import checker 2017-08-22 14:14:52 -04:00
Jun Wu
10555b029c pushvars: do not mangle repo state
Setting `repo._shellvars` works but is not a clean way to pass the pushvars
information from the push command to the exchange operation. Therefore
change it to actually pass `pushvars` as a push operation argument instead.

This makes third party extension like remotenames easier to support pushvars
cleanly. The key value parsing and verification code has been moved to a
lower level so it's harder to be bypassed and easier to be used in
remotenames which could replace `push` command entirely.

Differential Revision: https://phab.mercurial-scm.org/D423
2017-08-16 15:48:48 -07:00
Pulkit Goyal
444d924446 morestatus: check whether the conflict message is None before printing
There are cases like bisect when the conflict message can be None. So we make
sure that we don't print None in that case.

Thanks to Martin for catching this.

Differential Revision: https://phab.mercurial-scm.org/D461
2017-08-21 16:43:37 +05:30
Rishabh Madan
973eda14de releasenotes: add check flag for use of admonitions and its validity
While using releasenotes extension, we will be using admonitions in commit messages.
The check (-c) flag will look for an admonition within the message. If it exists, it will
verify if it is stated under default or custom admonition. The check fails if the
admonition is not present in any of them. It also suggests similar admonitions
in case the admonition is invalid.

Differential Revision: https://phab.mercurial-scm.org/D368
2017-08-13 19:58:45 +05:30
Augie Fackler
b564e23b12 tests: stop using old except syntax in test-bundle2-format 2017-08-22 15:05:07 -04:00
Augie Fackler
28ce6eb339 tests: update test-archive to always use hashlib
We don't need the fallback to the old modules anymore.
2017-08-22 14:57:52 -04:00
Augie Fackler
99e384c15a md5sum: assume hashlib exists now that we're 2.7 only 2017-08-22 14:57:10 -04:00
Alex Gaynor
3b5dc143a9 tests: fixed a bytes/unicode confusion in the test runner
Differential Revision: https://phab.mercurial-scm.org/D483
2017-08-23 01:08:09 +00:00
Martin von Zweigbergk
43011a8bd8 run-tests: remove unused pygments token type
Differential Revision: https://phab.mercurial-scm.org/D478
2017-08-22 10:01:27 -07:00
Martin von Zweigbergk
7366797b32 run-tests: also highlight .py test files in summary messages
With the .t files highlighted, it's very easy to not even notice
failed .py tests.

Differential Revision: https://phab.mercurial-scm.org/D471
2017-08-21 22:13:51 -07:00
Jun Wu
d1a219dc9f test-revset: make it work with chg
chg currently triggers `reposetup` as a side effect of `hg serve` command.
Therefore change the test to not output during `reposetup` to be compatible
with chg.

Differential Revision: https://phab.mercurial-scm.org/D455
2017-08-20 10:55:05 -07:00
Matthieu Laneuville
f835a7751f run-tests: pre instantiate pygments objects
Pre instantiate pygments objects to minimize overhead (cf. 50fbad9bb2af)
2017-08-22 11:00:00 +02:00
Sean Farley
e18a90ab08 merge with stable 2017-08-21 21:35:06 -07:00
Martin von Zweigbergk
7cd70adbc1 templatekw: choose {latesttag} by len(changes), not date (issue5659)
As Augie reported in the bug, the current heuristic of choosing the
best tag of a merge commit by taking the one with newest tag (in terms
of tagging date) currently fails in the Mercurial repo itself. Copying
the example from Yuya:

  $ hg glog -T '{node|short} {latesttag}+{latesttagdistance}\n' \
    -r '4.2.3: & (merge() + parents(merge()) + tag())'
  o    cc59efae4cc0 4.2.3+5
  |\
  | o    06f60e88fc3a 4.2.3+4
  | |\
  | | o  c191a9eb0b10 4.3-rc+109
  | | |
  | | ~
  o |  49ada93fdc10 4.3.1+2
  : |
  o |  229937197835 4.3.1+0
  |/
  o    6a83ad94c0f2 4.2.3+3
  |\
  | ~
  o  8e9dcdd1de74 4.2.3+2
  :
  o  525f2b18248f 4.2.3+0
  |
  ~

It seems to me like the best choice is the tag with the smallest
number of changes since it (across all paths, not the longest single
path). So that's what this patch does, even though it's
costly. Best-of-5 timings for Yuya's command above shows a slowdown
from 1.293s to 1.610s. We can optimize it later.

Differential Revision: https://phab.mercurial-scm.org/D447
2017-08-15 23:23:55 -07:00
Martin von Zweigbergk
8bb8bc19bb tests: use graph log in {latesttag} tests
The tests are much easier to read if one does not have to re-read the
setup part all the time to understand the graph shape.

Differential Revision: https://phab.mercurial-scm.org/D446
2017-08-18 12:50:26 -07:00
Gregory Szorc
8e7a19b422 ui: restore behavior to ignore some I/O errors (issue5658)
45345e9870c3 and b30126fa95bc refactored ui methods to no longer
silently swallow some IOError instances. This is arguably the
correct thing to do. However, it had the unfortunate side-effect
of causing StdioError to bubble up to sensitive code like
transaction aborts, leading to an uncaught exceptions and failures
to e.g. roll back a transaction. This could occur when a remote
HTTP or SSH client connection dropped. The new behavior is
resulting in semi-frequent "abandonded transaction" errors on
multiple high-volume repositories at Mozilla.

This commit effectively reverts 45345e9870c3 and b30126fa95bc to
restore the old behavior.

I agree with the principle that I/O errors shouldn't be ignored.
That makes this change... unfortunate. However, our hands are tied
for what to do on stable. I think the proper solution is for the
ui's behavior to be configurable (possibly via a context manager).
During critical sections like transaction rollback and abort, it
should be possible to suppress errors. But this feature would not
be appropriate on stable.
2017-08-15 13:04:31 -07:00
Gregory Szorc
e98da01acf tests: test behavior of IOError during transactions (issue5658)
ui._write(), ui._write_err(), and ui.flush() all trap IOError and
re-raise as error.StdioError. If a caller doesn't catch StdioError
when writing to stdio, it could bubble all the way to dispatch.

This commit adds tests for I/O failures around various transaction
operations.

The most notable badness is during abort. Here, an uncaught StdioError
will result in incomplete transaction rollback, requiring an
`hg rollback` to recover. This can result in a client "corrupting"
a remote repo via terminated HTTP and SSH socket.
2017-08-14 13:12:40 -07:00
Tristan Seligmann
0428b15b61 hg: avoid relying on errno numbers / descriptions
A few tests hardcode errno numbers and/or descriptions in the output, causing
test failures on platforms where these values are different.

Differential Revision: https://phab.mercurial-scm.org/D362
2017-08-12 14:29:22 +02:00