tests: show that in-memory rebase leaves state when working copy is dirty
When in-memory rebase falls back to on-disk rebase, it checks if the
working copy is dirty. If it is, it aborts the rebase. However, it
leaves the rebase state on disk. I broke it in
feffeb18d412 (rebase:
teach in-memory rebase to not restart with on-disk rebase on conflict,
2020-09-18).
Differential Revision: https://phab.mercurial-scm.org/D9508
extensions: avoid a crash when the version isn't properly byteified on py3
We already force bytestr on the `testedwith` and `buglink` attributes in
dispatch.py when generating a bug report with a similar comment about not
every extension being ported to py3. We should do the same here, so the
function can be properly typed.
Differential Revision: https://phab.mercurial-scm.org/D9433
ui: ensure `getpass()` returns bytes
Previously, this could return either bytes or str. I'm not sure which direction
we should go in, but since the input is bytes, I guess bytes makes sense as
output. `debuguigetpass` crashed because it assumed bytes would be returned,
`sslcontext.load_cert_chain()` is happy with bytes or str if the type info in
PyCharm is correct, and `smtplib.SMTP.login()` wants str.
I couldn't figure out how to test this, because the test stalls for input with
`echo test | hg debuguigetpass --config ui.interactive=1`, likely because it
drains stdin before prompting. The custom input reading with `ui.nontty=1` does
not.
I'm also a bit concerned with all of this encoding/decoding. The existing code
in the mail module uses `encoding.strfromlocal()`, but the username and password
are ascii encoded/decoded in `mercurial.url.passwordmgr.find_user_password()`
with `pycompat.{str,bytes}url()`. I'm not sure if this inconsistency could
cause subtle compatability issues.
Differential Revision: https://phab.mercurial-scm.org/D9375
packaging: regenerate the Windows requirements manifest on Windows
SecretStorage is a Linux package, and the other stuff removed is a dependency of
it. I assume this was last generated on Linux, and noticed this trying to add
another package and regenerating on Windows.
Differential Revision: https://phab.mercurial-scm.org/D9404
pyoxidizer: point to the py3 requirements instead of py2 on Windows
Differential Revision: https://phab.mercurial-scm.org/D9406
extensions: gracefully warn when doing min version check with no local version
After doing a `make clean`, I started getting cryptic failures to import
extensions with the `minimumhgversion` attribute on py3:
*** failed to import extension evolve: '>' not supported between instances of 'int' and 'NoneType'
*** failed to import extension topic: '>' not supported between instances of 'int' and 'NoneType'
This now handles the `(None, None)` tuple before comparing, and disables the
extension with the same friendly message as in py2.
Differential Revision: https://phab.mercurial-scm.org/D9363
diff: do not concatenate immutable bytes while building a/b bodies (
issue6445)
Use bytearray instead. I don't know what's changed since Python 2, but bytes
concatenation is 100x slow on Python 3.
% python2.7 -m timeit -s "s = b''" "for i in range(10000): s += b'line'"
1000 loops, best of 3: 321 usec per loop
% python3.9 -m timeit -s "s = b''" "for i in range(10000): s += b'line'"
5 loops, best of 5: 39.2 msec per loop
Benchmark using tailwind.css (measuring the fast path, a is empty):
% HGRCPATH=/dev/null python2.7 ./hg log -R /tmp/
issue6445 -p --time \
--color=always --config diff.word-diff=true >/dev/null
(prev) time: real 1.580 secs (user 1.560+0.000 sys 0.020+0.000)
(this) time: real 1.610 secs (user 1.570+0.000 sys 0.030+0.000)
% HGRCPATH=/dev/null python3.9 ./hg log -R /tmp/
issue6445 -p --time \
--color=always --config diff.word-diff=true >/dev/null
(prev) time: real 114.500 secs (user 114.460+0.000 sys 0.030+0.000)
(this) time: real 2.180 secs (user 2.140+0.000 sys 0.040+0.000)
Benchmark using random tabular text data (not the fast path):
% dd if=/dev/urandom bs=1k count=1000 | hexdump -v -e '16/1 "%3u," "\n"' > ttf
% hg ci -ma
% dd if=/dev/urandom bs=1k count=1000 | hexdump -v -e '16/1 "%3u," "\n"' > ttf
% hg ci -mb
% HGRCPATH=/dev/null python2.7 ./hg log -R /tmp/
issue6445 -p --time \
--color=always --config diff.word-diff=true >/dev/null
(prev) time: real 3.240 secs (user 3.040+0.000 sys 0.200+0.000
(this) time: real 3.230 secs (user 3.070+0.000 sys 0.160+0.000)
% HGRCPATH=/dev/null python3.9 ./hg log -R /tmp/
issue6445 -p --time \
--color=always --config diff.word-diff=true >/dev/null
(prev) time: real 44.130 secs (user 43.850+0.000 sys 0.270+0.000)
(this) time: real 4.170 secs (user 3.850+0.000 sys 0.310+0.000)