Commit Graph

29829 Commits

Author SHA1 Message Date
Simon Farnsworth
3622717b76 merge: add conflict labels to merge command
Now that we present the conflict labels in prompts, it's useful to have
better names than "local" and "other" for every command.
2016-10-07 08:51:50 -07:00
Mathias De Maré
ffcbeb8c14 check-commit: allow underscore as commit topic
It's currently not possible to commit with a changeset topic
like 'bash_completion'. This change fixes that.
2016-10-05 15:28:34 +02:00
Simon Farnsworth
dfbb92b63b merge: use labels in subrepo merge
This is the last place that doesn't respect conflict labels in merge output.
Teach subrepos to use subrepo merge output too.
2016-10-08 01:25:28 -07:00
Augie Fackler
2943f5ca36 registrar: make format strings unicodes and not bytes
Fixes issues on Python 3, wherein docstrings are unicodes. Shouldn't
break anything on Python 2.
2016-10-07 08:32:18 -04:00
Jun Wu
af2ff7c3d4 extensions: move the "import" logic out from "load"
The "load" method does too many things: on-demand import and check version.
This patch moves the import logic out from "load" so it could be wrapped to
change the import behavior, for example, chg will use it to pre-import
extensions.
2016-10-03 03:37:10 +01:00
Augie Fackler
8facc4e910 hgmanpage: stop using raw-unicode strings
These don't exist in Python 3, and this ends up looking a little more
explicit to Martijn and me anyway.
2016-10-07 07:43:04 -04:00
Augie Fackler
a4faa822dc revset: define _symletters in terms of _syminitletters 2016-10-07 08:09:23 -04:00
Augie Fackler
71a3469685 revset: remove doubled space 2016-10-07 08:03:30 -04:00
Augie Fackler
2b99f3fc25 util: use string.hexdigits instead of defining it ourselves
This resolves some Python 3 weirdness.
2016-10-07 08:58:23 -04:00
Augie Fackler
ef318ea690 util: correct check of sys.version_info
sys.version is a string, and shouldn't be compared against a tuple for
version comparisons. This was always true, so we were never disabling
gc on 2.6.

>>> (2, 7) >= '2.7'
True
>>> (2, 6) >= '2.7'
True
2016-10-07 08:01:16 -04:00
Pulkit Goyal
924bdac6e1 py3: switch to .items() using transformer
.iteritems() don't exist in Python 3 world. Used the transformer
to replace .iteritems() to .items()
2016-10-07 15:29:57 +02:00
Pulkit Goyal
757d64b218 py3: handle multiple arguments in .encode() and .decode()
There is a case and more can be present where these functions have
multiple arguments. Our transformer used to handle the first argument, so
added a loop to handle more arguments if present.
2016-10-07 14:04:49 +02:00
Pulkit Goyal
3a0ce3bcba py3: convert to unicode to pass into encode()
encoding.encoding is bytes, we need to pass it to encode() which accepts
unicodes in py3, so used pycomapt.sysstr() Also this can't be done using
transformer as that only transforms the string values not variables.
2016-10-07 12:13:28 +02:00
Anton Shestakov
64aa0688e0 templater: use "needle" and "haystack" as (meta-)variables for ifcontains()
It wasn't immediately clear if it's supposed to look for "search" in "thing" or
"thing" in "search".
2016-10-01 09:55:32 +08:00
Gábor Stefanik
5a7c7889a5 copies: mark checkcopies as internal with the _ prefix 2016-10-03 13:24:56 +02:00
Gábor Stefanik
6f3ec7c4c3 copies: split u1/u2 to u1u/u2u and u1r/u2r
These will be made different in case of grafts by another patch in this series.
2016-10-03 13:23:19 +02:00
Gábor Stefanik
88c9737beb copies: style fixes and add comment 2016-10-03 13:18:31 +02:00
Gábor Stefanik
846bad50ac copies: limit is an optimization, and doesn't provide guarantees 2016-10-03 16:19:55 +02:00
Yuya Nishihara
7078b29941 revset: do not rewrite ':y' to '0:y' (issue5385)
That's no longer valid since the revision 0 may be hidden. Bypass validating
the existence of '0' and filter it by spanset.
2016-10-01 20:20:11 +09:00
Yuya Nishihara
b94864e756 revset: extract function that creates range set from computed revisions
So we can pass m=0 to _makerangeset() even if the revision 0 is hidden.
Hidden revisions are filtered by spanset.
2016-10-01 20:11:48 +09:00
Maciej Fijalkowski
6efacdd6af lazymanifest: write a more efficient, pypy friendly version of lazymanifest 2016-09-12 13:37:14 +02:00
Gregory Szorc
f91c7e8491 hg: set default path correctly when doing a clone+share (issue5378)
Before, if performing a clone+share from a repo that was itself
using shared storage, the share code would copy paths.default from
the underlying repo being shared, not from the source given by
the user.

This patch teaches hg.clonewithshare to resolve paths.default
and pass it to share so it can be written to the hgrc accordingly.
2016-10-02 22:34:40 -07:00
Jun Wu
5ca5bb4a7c annotate: calculate line count correctly
Before this patch, the "lines" function inside "annotate" returns 1 for
empty text (''). This patch makes it 0. Because the function should match
mdiff.splitnewlines (used by mdiff.allblocks), or s.splitlines (used at the
end of the "annotate" method). Both len(mdiff.splitnewlines('')) and
len(''.splitlines(True)) are 0.

This issue was discovered while testing fastannotate [1].

I could not find a test case to reveal this issue. However in theory this
could reduce memory usage a little bit, and avoids surprises when people
are touching this area in the future.

[1]: https://bitbucket.org/facebook/hg-experimental/commits/525b3b98e93a
2016-10-01 14:18:58 +01:00
Pulkit Goyal
8ae574b546 py3: use unicode in is_frozen()
imp.is_frozen() doesnot accepts bytes on Python 3.
It does accept both bytes and strings on Python 2.
2016-10-02 05:29:17 +05:30
Pulkit Goyal
93ca2d7cd6 py3: use unicodes in __slots__
__slots__ doesnot accepts bytes on Python 3.
2016-10-02 03:38:14 +05:30
Augie Fackler
8bed0bf30f merge with stable 2016-10-01 15:10:38 -04:00
Augie Fackler
a7fccde07e Added signature for changeset 6c105ed84c14 2016-10-01 15:00:23 -04:00
Yuya Nishihara
f3a42c7e9f url: fix crash by empty path with #fragments
Before, "#foo" paths made hg crash. We've moved the #fragment parsing at
246862840084, but we shouldn't set path to None too early. This patch just
removes the "if not path:" block since that's checked a few lines later.
2016-09-30 21:38:47 +09:00
Yuya Nishihara
19a513c19c py3: make i18n use encoding.environ 2016-09-28 20:07:32 +09:00
Yuya Nishihara
52ffc6a5bd py3: provide encoding.environ which is a dict of bytes
This can't be moved to pycompat.py since we need encoding.tolocal() to
build bytes dict from unicode os.environ.
2016-09-28 20:05:34 +09:00
Yuya Nishihara
d71e06adf5 py3: convert encoding name and mode to str
Otherwise tolocal() and fromlocal() wouldn't work on Python 3. Still tolocal()
can't make a valid localstr object because localstr inherits str, but it can
return some object without raising exceptions.

Since Py3 bytes() behaves much like bytearray() than str() of Py2, we can't
simply do s/str/bytes/g. I have no good idea to handle str/bytes divergence.
2016-09-28 20:39:06 +09:00
Yuya Nishihara
fd6ad62876 pycompat: extract function that converts attribute or encoding name to str
This will be used to convert encoding.encoding to a str acceptable by
Python 3 functions.

The source encoding is changed to "latin-1" because encoding.encoding can
have arbitrary bytes. Since valid names should consist of ASCII characters,
we don't care about the mapping of non-ASCII characters so long as invalid
names are distinct from valid names.
2016-09-28 22:32:09 +09:00
Yuya Nishihara
7c03e0d6ba pycompat: provide 'ispy3' constant
We compare version_info at several places, which seems enough to define
a constant.
2016-09-28 20:01:23 +09:00
Pierre-Yves David
cefbc74b98 extensions: add a note about debug output during extensions search
These messages do not show up when one use '--debug'. This is quite confusing so
we clarify the situation next to the 'ui.debug' call.
2016-09-30 00:27:35 +02:00
Pierre-Yves David
9680f282d3 extensions: fix a debug message when searching for extensions
The "next" value was wrong. When 'hgext.NAME' is not found we now search for
'hgext3rd.NAME'.
2016-09-30 00:25:15 +02:00
Augie Fackler
1fc82bbf21 py3: update test expectation on stable 2016-09-23 14:37:15 -04:00
Kevin Bullock
9eb7f2dc02 grep: rewrite help to better document current (confusing) behavior 2016-09-23 12:45:10 -05:00
timeless
aa2c0ad5a3 crecord: properly handle files with No newline at eof (issue5268)
Yes, this bug was a single character with the wrong case...
2016-09-02 20:15:37 +00:00
Jun Wu
a5ec43fe40 annotate: pre-calculate the "needed" dictionary (issue5360)
The "needed" dict is used as a reference counter to free items in the giant
"hist" dict. However, currently it is not very accurate and can lead to
dropping "hist" items unnecessarily, for example, with the following DAG,

       -3-
      /   \
  0--1--2--4--

The current algorithm will visit and calculate rev 1 twice, undesired. And
it tries to be smart by clearing rev 1's parents: "pcache[1] = []" at the
time hist[1] being accessed (note: hist[1] needs to be used twice, by rev 2
and rev 3). It can result in incorrect results if p1 of rev 4 deletes chunks
belonging to rev 0.

However, simply removing "needed" is not okay, because it will consume 10x
memory:

  # without any change
  % HGRCPATH= lrun ./hg annotate mercurial/commands.py -r d130a38 3>&2 [1]
  MEMORY   49074176
  CPUTIME  9.213
  REALTIME 9.270

  # with "needed" removed
  MEMORY   637673472
  CPUTIME  8.164
  REALTIME 8.249

This patch moves "needed" (and "pcache") calculation to a separate DFS to
address the issue. It improves perf and fixes issue5360 by correctly reusing
hist, while maintaining low memory usage. Some additional attempt has been
made to further reduce memory usage, like changing "pcache[f] = []" to "del
pcache[f]". Therefore the result can be both faster and lower memory usage:

  # with this patch applied
  MEMORY   47575040
  CPUTIME  7.870
  REALTIME 7.926

[1]: lrun is a lightweight sandbox built on Linux cgroup and namespace. It's
     used to measure CPU and memory usage here. Source code is available at
     github.com/quark-zju/lrun.
2016-09-02 15:20:59 +01:00
Kevin Bullock
5101bf4c23 Added signature for changeset 8ac1b6da0c44 2016-09-01 14:01:43 -05:00
Akihiko Odaki
82bf519632 bundle2: localize handleoutput remote prompts
Code archaeology suggests that there was no good reason for this not to
be localized. 'remote: ' is already localized elsewhere.
2016-09-01 13:16:55 -05:00
Wagner Bruna
511ad6839c i18n-pt_BR: synchronized with 9c29cf2af0ce 2016-08-31 13:58:33 -03:00
Mateusz Kwapich
016e1e5ef8 dirstate: rebuild should update dirstate properly
Updating dirstate by simply adding and dropping files from self._map doesn't
keep the other maps updated (think: _dirs, _copymap, _foldmap, _nonormalset)
thus introducing cache inconsistency.

This is also affecting the debugstate tests since now we don't even try to set
correct mode and mtime for the files because they are marked dirty anyway and
will be checked during next status call.
2016-08-30 15:16:28 -07:00
Martin von Zweigbergk
cb58483f81 histedit: avoid converting nodeid to context and back again
It looks like this became unnecessary in 8166e7073157 (histedit: fix
preventing strips during histedit, 2015-04-04).
2016-09-27 22:09:28 -07:00
Augie Fackler
8843ab4c98 help: mark boolean flags with [no-] to explain that they can be negated
That is, help gets tweaked thus:

  global options ([+] can be repeated):
   -v --[no-]verbose      enable additional output


Other proposals have included:

  global options ([+] can be repeated, options marked [?] are boolean flags):
   -v --verbose[?]        enable additional output

and

  global options ([+] can be repeated, options marked [^] are boolean flags):
   -v --verbose[^]        enable additional output

which avoid the unfortunate visual noise in this patch. In this
version's favor, it's consistent with what I'm used to seeing in man
pages and similar documentation venues.
2016-09-13 22:58:12 -04:00
Philippe Pepiot
f0ea56f87f mdiff: remove unused parameter 'refine' from allblocks() 2016-09-27 14:46:34 +02:00
Yuya Nishihara
09cf7ebffd demandimport: error out early on missing attribute of non package (issue5373)
If the parent module isn't a package, all valid attributes must be obtained
from it. We can raise ImportError early if any attributes not found.
2016-09-26 23:28:57 +09:00
Yuya Nishihara
fb41ba9d77 demandimport: add 'nt' to ignore list (issue5373)
pathlib2 tries to import nt. Since it is a built-in module, there should be
no performance penalty.

https://github.com/mcmtroffaes/pathlib2/blob/release/2.2.0/pathlib2.py#L33
2016-09-27 21:56:00 +09:00
Yuya Nishihara
fa872505e9 demandimport: add '_ctypes.pointer' to ignore list on PyPy
The pointer module is shadowed by a subsequent import. Our demand importer
can't handle this because both sub modules and attributes live in the same
namespace.

https://bitbucket.org/pypy/pypy/src/release-5.0.1/lib_pypy/_ctypes/__init__.py#__init__.py-5
2016-09-27 22:36:00 +09:00
Anton Shestakov
9edbb61202 hgweb: make anchor name actually match its href on help index page 2016-09-26 16:12:40 +08:00