Augie Fackler <augie@google.com> [Tue, 10 Sep 2019 09:41:58 -0400] rev 42926
cleanup: fix leakage of dirstate._map to client code
We already had proper accessors for most of the behavior of
dirstate._map that callers cared about exposed in the actual dirstate
class as public methods. Sigh.
There are two remaining privacy violations in the codebase after this change:
1) In the perf extension, which I suspect has to stick around because
it's really testing the dirstate implementation directly
2) In largefiles, where we deal with standins and mutating status. Looking at
this, I _strongly_ suspect a formal dirstate interface would allow
this to work via composition instead of inheritance and
monkeypatching. Fortunately, such wins are a part of my motivation
for this work. I anticipate we'll come back to this in due time.
Differential Revision: https://phab.mercurial-scm.org/D6837
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Sun, 08 Sep 2019 20:26:36 -0400] rev 42925
exchange: convert bookmark nodes from hex to bin ASAP
Differential Revision: https://phab.mercurial-scm.org/D6831
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Sun, 08 Sep 2019 20:10:32 -0400] rev 42924
exchange: avoid unnecessary conversion of bookmark nodes to hex (API)
Differential Revision: https://phab.mercurial-scm.org/D6830
Connor Sheehan <sheehan@mozilla.com> [Mon, 09 Sep 2019 14:26:43 -0400] rev 42923
highlight: fix encoding issues to enable Py3 compatibility
This commit fixes various encoding issues with the `highlight` extension
to enable compatibility with Python 3. Python `.encode()` and `.decode()`
requires the target encoding to be passed as a `str`, so the value of
`mercurial.encoding.encoding` must be converted before passing to the
function. Pygments also assumes the `str` type for values it works with,
so we must perform conversions before and after receiving values from its
APIs.
After applying this patch, `test-highlight.t` passes under Python 3. We
add it to `python3-whitelist` as well.
Tested with Pygments 2.4.2.
Differential Revision: https://phab.mercurial-scm.org/D6832
Connor Sheehan <sheehan@mozilla.com> [Tue, 10 Sep 2019 12:32:07 -0400] rev 42922
hgweb: add a `message` attribute to `hgweb.common.ErrorResponse`
This fixes a Python 3 bug where hgweb assumes an Exception
subclass will have a `.message` attribute after running
`Exception.__init__`.[1] The Python 3 way to get this info would
be `e.args[0]`, but adding a new named attribute is more
ergonomic in my view.
[1] https://www.mercurial-scm.org/repo/hg-committed/file/
6ccf539aec71/mercurial/hgweb/hgwebdir_mod.py#l459
Differential Revision: https://phab.mercurial-scm.org/D6840
Matt Harbison <matt_harbison@yahoo.com> [Tue, 10 Sep 2019 22:52:04 -0400] rev 42921
uncommit: make -D/--date and -U/--user mutually exclusive
This is how amend and graft work (but not MQ). I'm not sure why this didn't
work for me when I first tried it.
Differential Revision: https://phab.mercurial-scm.org/D6842
Matt Harbison <matt_harbison@yahoo.com> [Tue, 10 Sep 2019 22:04:22 -0400] rev 42920
uncommit: drop the hyphen from --current-user and --current-date
I didn't pay enough attention to these long forms- graft, amend and MQ already
use the old style naming. It's probably more important to be consistent than
modern. The hypenated style came from evolve.
Yuya mentioned this naming discrepancy in
4145fd3569c3, but it didn't attract
any discussion[1]. There's also a bit of inconsistency in that the default
parameter for `currentdate` is `False` for graft, and `None` for the rest.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-January/126767.html
Differential Revision: https://phab.mercurial-scm.org/D6841
Connor Sheehan <sheehan@mozilla.com> [Mon, 09 Sep 2019 13:25:00 -0400] rev 42919
hgweb: fix websub regex flag syntax on Python 3
The `websub` config section for hgweb is broken under Python 3
when using regex flags syntax (ie the optional `i` in the example
from `hg help config.websub`:
patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
Flags are pulled out of the specified byte-string using a regular
expression, and uppercased. The flags are then iterated over and
passed to the `re` module using `re.__dict__[item]`, to get the
object attribute of the same name from the `re` module. So on Python
2 if the `il` flags are passed, this transition looks like:
`'il'` -> `'IL'` -> `'I'` -> `re.__dict__['I']` -> `re.I`
However on Python 3, these are bytes objects. When we iterate over
a bytes object in Python 3, instead of getting the individual characters
in the string as string objects of length one, we get the integer \
value corresponding to that byte. So the same transition looks like:
`b'il'` -> `b'IL'` -> `73` -> `re.__dict__[73]` -> `KeyError`
This commit fixes the type mismatch by converting the bytes to a
system string before iterating over each element to pass to `re`.
The transition will now look like:
`b'il'` -> `u'IL'` -> `u'I'` -> `re.__dict__[u'I']` -> `re.I`
In addition we expand `test-websub.t` to cover the regex flag case
(for both the `websub` section and `interhg`).
Differential Revision: https://phab.mercurial-scm.org/D6788
Augie Fackler <augie@google.com> [Mon, 09 Sep 2019 17:26:17 -0400] rev 42918
merge with stable
Ian Moody <moz-ian@perix.co.uk> [Sat, 07 Sep 2019 14:35:21 +0100] rev 42917
phabricator: don't abort if property writing fails during amending
Currently if one of the writediffproperty calls fails due to network issues
during the amending of commit messages to include the Diff. Rev. line, the
transaction is aborted and rolled back. This means that the associations
between the commits and the DREVs are lost for any already amended commits
because the removal of the local tags isn't covered by the rollback.
Differential Revision: https://phab.mercurial-scm.org/D6835