rust-status: don't dispatch unknown file when traversing if not listing unknowns
This usually isn't a (functional) problem since we ignore the unknown files
anyway, but when specifically using `hg purge`, unknown files were iterated over
regardless of the option being true.
This is both more correct and more efficient.
Differential Revision: https://phab.mercurial-scm.org/D8517
status: update comment to reflect the more recent situation
This is a gratuitous cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8516
hooks: provide access to transaction changes for internal hooks
External hooks are skipped here as the environment often has a size
limit in the low MBs and that can easily be reached by larger
transactions.
Differential Revision: https://phab.mercurial-scm.org/D8490
rust-regex: add test for verbatim regex syntax
This makes sure it's not modified.
Differential Revision: https://phab.mercurial-scm.org/D8508
rust-regex: prevent nonsensical `.*.*` pattern from happening
Differential Revision: https://phab.mercurial-scm.org/D8507
rust-regex: fix issues with regex anchoring and performance
It turns out that the way I tried to work around `regex`'s behavior difference
with `re2` and Python's `re` was 1) buggy and 2) much more complicated than
needed.
In a few words:
`regex` adds `.*` on either side of patterns when no start or end anchor is
present. My previous workaround put `^` or `$` for every pattern, which is
wrong even without the other 2 bugs on top of it.
Using `^(?:<patterns>)` right at the end of the `regex` path fixes the issue.
I've opened an issue to get a build option instead:
https://github.com/rust-lang/regex/issues/675
Differential Revision: https://phab.mercurial-scm.org/D8506
diff: avoid going from contexts to nodes and back
This will allow us to pass in-memory contexts that may not have a
valid node to the diffing logic.
Differential Revision: https://phab.mercurial-scm.org/D8503
setup: raise minimum Python version to 2.7.4
On older Python versions, Mercurial is not really usable because of
https://bugs.python.org/
issue10211.
Recently someone reported a crash on the mailing list when running Mercurial
on Python 2.7.3. There was consensus that fixing compatibility for a Python
version more than 7 years old is not worth it. So, instead of making Mercurial
crash with an obscure exception, this patch raises the minimum Python version
to 2.7.4.
fsmonitor: coerce `clock` variable to byte-string (
issue6321)
Callers of `fsmonitor.state.setlastclock` pass their arguments
wrapped in `pycompat.sysbytes` to ensure the value is a `bytes`
on Python 3. However in `fsmonitor.poststatus.__call__`, if the
return value of `getlastclock()` is `None`, we use the value of
`fsmonitor.poststatus._startclock` instead, which is not converted
to a byte string in the same manner. This commit converts the
value of `startclock` to a byte string using `pycompat.sysbytes`
in the constructor for `poststatus`, to avoid the "`str` + `bytes`"
error from issue 6321.
Differential Revision: https://phab.mercurial-scm.org/D8573
py3: change default priority and length used for sorting hooks to be compatible with python 3
The call to `sorted(hooks.values())` can on line 213 of hooks.py can raise when using
python 3. For instance, when hooks.values is `[(0, 2, b'post-commit.check-status', b''),
(None, None, b'changegroup.app-hooks', <object object at 0x
7f5279885590>)]`, the error is
`TypeError: '<' not supported between instances of 'NoneType' and 'int'`
This fix keeps the same order that was used in python 2 without relying on comparison with
None.
Differential Revision: https://phab.mercurial-scm.org/D8527