Commit Graph

33645 Commits

Author SHA1 Message Date
Phil Cohen
0f74021391 simplemerge: use ctx.decoddeddata() instead of repo.wreaddata
This eliminates the need for the `repo` object.

Differential Revision: https://phab.mercurial-scm.org/D435
2017-08-24 21:26:40 -07:00
Phil Cohen
8d78fdd90e context: add decodeddata() to basefilectx
This will be used as an abstraction by simplemerge to get the data it used to
read off the filesystem.

Differential Revision: https://phab.mercurial-scm.org/D434
2017-08-24 21:26:40 -07: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
Augie Fackler
33d314f3e6 demandimportpy3: update to pass import checker 2017-08-22 14:14:34 -04:00
Augie Fackler
e5f807b019 contrib: always treat importlib.* as stdlib 2017-08-22 16:02:57 -04:00
Augie Fackler
5a65defa9b hg: update top-level script to use modern import conventions 2017-08-22 14:14:19 -04:00
Augie Fackler
455b926bc2 simplemerge: update to conform with modern import conventions 2017-08-22 14:13:13 -04:00
Augie Fackler
77ae4c9284 contrib: inform import checker that __builtin__ is a thing 2017-08-22 14:12:37 -04:00
Augie Fackler
ec8689fc6d contrib: allow importing "symbols" from mercurial 2017-08-22 14:12:21 -04:00
Augie Fackler
edacb19438 hgperf: update to conform with import style checks 2017-08-22 14:12:03 -04:00
Augie Fackler
3990642074 contrib: update hg-ssh to conform with import style checks 2017-08-22 14:11:48 -04:00
Augie Fackler
ed0ae6fd2e contrib: have import-checker work mostly with native strings for mod names
Module names are a bit awkward to deal with portably otherwise.
2017-08-22 12:59:21 -04:00
Durham Goode
8075a9d667 bundlerepo: move bundle2 part handling out to a function
This moves the bundle2 part handling for bundlerepo out to a separate function
so extensions can participate in bundlerepo setup when using bundle2 bundles.

Differential Revision: https://phab.mercurial-scm.org/D290
2017-08-23 12:35:03 -07:00
Durham Goode
22fc2e18a8 bundle2: seek part back during iteration
Previously, iterparts would yield the part to users, then consume the part. This
changed the part after the user was given it and left it at the end, both of
which seem unexpected.  Let's seek back to the beginning after we've consumed
it. I tried not seeking to the end at all, but that seems important for the
overall bundle2 consumption.

This is used in a future patch to let us move the bundlerepo
bundle2-changegroup-part to be handled entirely within the for loop, instead of
having to do a seek back to 0 after the entire loop finishes.

Differential Revision: https://phab.mercurial-scm.org/D289
2017-08-23 12:35:03 -07:00
Durham Goode
538824ea3e bundlerepo: move temp bundle creation to a separate function
A future patch will refactor certain parts of bundlerepo initiatlization such
that we need to create temp bundles from another function. Let's move this to
another function to support that.

Differential Revision: https://phab.mercurial-scm.org/D288
2017-08-23 12:34:56 -07:00
Martin von Zweigbergk
7603f48c32 exchange: don't attempt phase exchange if phase-heads was in bundle
The Mercurial core server doesn't yet include phase-heads parts in the
bundle, but our Google-internal server wants to do
that. Unfortunately, the usual exchange still happens even if
phase-heads part is included (including the short-circuited one for
old/publishing servers). That means that even if our server (again,
the Google-internal one, but also future Mercurial core servers)
includes a phase-heads part to indicate that some heads should be
drafts, that would still get overwritten by the phase updating that
happens after. So let's fix that by marking the phase step done if we
receive at least one phase-heads part in the bundle.

Differential Revision: https://phab.mercurial-scm.org/D440
2017-08-17 13:04:47 -07: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
Alex Gaynor
df2c1417e6 bundle2: fixed usage of an attribute that was removed in py3k
Differential Revision: https://phab.mercurial-scm.org/D482
2017-08-23 01:09:08 +00:00
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
Gábor Stefanik
2431ab3a7d copies: fix misaligned lines 2017-08-22 16:16:39 +02:00
Gábor Stefanik
a4ce7f6a87 copies: fix typo in comment
"will not be limited" was meant to be "will not be visited". I missed this
when writing the original graft-through-rename patch series.
2017-08-22 16:08:31 +02:00
Augie Fackler
bfabad4e98 python3: whitelist test-imports-checker.t, which now passes 2017-08-22 11:00:46 -04:00
Augie Fackler
f7c4bd058e contrib: make import checker always think in terms of bytes
The doctests now do some regrettable things, but they'll always work
since we're dealing with ASCII module names etc.
2017-08-22 12:58:28 -04:00
Augie Fackler
4ece1bb8b2 contrib: work around some modules not existing on Py3 in import checker 2017-08-22 10:58:29 -04:00
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
Augie Fackler
4927f52889 undumprevlog: update to valid Python 3 syntax
I didn't do anything to ensure correctness here, just enough to avoid
tracebacks in the import checker, which uses the native ast module to
try and parse all our Python files.
2017-08-22 12:58:51 -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
Yuya Nishihara
5b29c5b3bd copies: use intersectmatchers() in non-merge p1 optimization
This enables the optimization introduced by b8d938230143 for non-rebase cases.
Before, the match couldn't be narrowed if it was e.g. alwaysmatcher.

The logic is copied from fca0d99edf8e.
2017-08-19 11:23:33 +09: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
Nathan Goldbaum
0de8be7e62 log: mention ui.logtemplate in the help text 2017-08-16 10:24:49 -05: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
Tristan Seligmann
0fee28d767 hg: tolerate long vs. int in test-context.py
The file times here can be longs instead of ints on some platforms, which will
cause a test failure due to these printing with an L suffix; instead always
format with %d which will produce the same output in either case.

Differential Revision: https://phab.mercurial-scm.org/D361
2017-08-12 14:24:25 +02:00
Jun Wu
d84c305f2a rebase: only change self.state when collapsing in _finishrebase
When the code executes to _finishrebase, self.state should be populated with
correct destinations and do not need to be written to a node. The code was
introduced by 8dc45c9059, which seems to avoid setting state values to None
but it didn't provide more details.

Differential Revision: https://phab.mercurial-scm.org/D346
2017-08-11 01:34:11 -07:00
Jun Wu
13f8aae09c rebase: choose merge base without unwanted revisions
Previously, when there are 2 merge base candidates, we choose p1 blindly,
which may make the merge result to have "unwanted content". This patch makes
rebase smarter - choose a merge base that does not have "unwanted revs" if
possible. Since we don't really have a good solution when there are
"unwanted revs", abort in that case.

Differential Revision: https://phab.mercurial-scm.org/D340
2017-08-10 22:17:15 -07:00
Jun Wu
3e05e789bc demandimport: disable if chg is being used
In chg's case, making modules lazily loaded could actually slow down things
since chg pre-imports them. Therefore disable demandimport if chg is being
used.

This is not done by setting `HGDEMANDIMPORT` chg client-side because that
has side-effects on child processes (hooks, etc).

Differential Revision: https://phab.mercurial-scm.org/D351
2017-08-16 10:44:06 -07:00
Jun Wu
e60bc9fd17 demandimport: move HGDEMANDIMPORT test to __init__.py
The logic is now shared between demandimport{2,3}.

Differential Revision: https://phab.mercurial-scm.org/D445
2017-08-18 11:08:17 -07:00
Danny Hooper
54e3286e1e log: add a "graphwidth" template variable
Wrapping text in templates for 'hg log --graph' can't be done very well,
because the template doesn't know how wide the graph drawing is. The edge
drawing function needs to know the number of lines in the template output, so
we need to also determine how wide that drawing would be before we call the
edgefn or evaluate the template.

This patch makes edgefn compute the graph width and pass it into the template
so that we can do something like this:

COLUMNS=10 hg log --graph --template "{fill(desc, termwidth - graphwidth)}"
@  a a a a
|  a a a a
|  a a a a
o    a a a
|\   a a a
| |  a a a
| |  a a a

Using extensions to do this would be relatively complicated due to a lack of
hooks in this area of the code.

In the future it may make sense to have a more generic "textwidth" that tells
you how many columns you can expect to fill without causing the terminal to
wrap your output. I'm not sure there are other situations to motivate this yet,
or if it is entirely feasible.

Differential Revision: https://phab.mercurial-scm.org/D360
2017-08-15 10:15:31 -07:00
Boris Feld
76d1768227 obsmarker: fix precnode deprecation
The deprecation message for marker.precnode was wrong. Fix the typo.

Differential Revision: https://phab.mercurial-scm.org/D413
2017-08-16 10:18:57 +02:00