Manuel Jacob <me@manueljacob.de> [Tue, 30 Jun 2020 04:55:52 +0200] rev 45020
convert: bail out in Subversion source if encountering non-ASCII HTTP(S) URL
Before this patch, in the tested case, urllib raised `httplib.InvalidURL: URL
can't contain control characters. '/\xff/!svn/ver/0/.svn' (found at least
'\xff')`, which resulted in that the URL was never recognized as a Subversion
repository.
This patch adds a check that bails out if the URL contains non-ASCII characters.
The warning is not overly user-friendly, but giving the user something to type
into a search engine is definitively better than not explaining why the
repository was not recognized.
We could support non-ASCII chracters by quoting them before passing them to
urllib. However, we would want to be compatible with what the `svn` command
does, which converts the URL from the locale encoding to UTF-8, percent-encodes
it and sends it to the server. If the locale encoding is not UTF-8, the
behavior is IMHO not very intuitive, as the `svn` command may send different
(percent-encoded) octets than what was passed on the console. Instead of
copying this behavior, we better leave it forbidden.
Yuya Nishihara <yuya@tcha.org> [Mon, 29 Jun 2020 20:53:32 +0900] rev 45019
merge with stable
Manuel Jacob <me@manueljacob.de> [Sun, 28 Jun 2020 17:52:29 +0200] rev 45018
compat: back out
a25343d16ebe (initialize LC_CTYPE locale on all Python ...)
As Yuya Nishihara pointed out, setting LC_CTYPE changes the behavior of some
str methods on Python 2.
Manuel Jacob <me@manueljacob.de> [Sun, 28 Jun 2020 17:49:14 +0200] rev 45017
curses: back out
d2227d4c9e6b (do not initialize LC_ALL to user settings)
The changeset was based on
a25343d16ebe, which will be backed out, too.
Another fix for the problem will be resubmitted to the stable branch.
Julien Cristau <jcristau@debian.org> [Thu, 25 Jun 2020 11:22:34 +0200] rev 45016
test: redirect stderr so warning messages don't change output (
issue6237)
clone and commit race for the lock, and if commit has to wait more than
a second it prints a warning to stderr. Since this is somewhat expected
here, silence it.
Differential Revision: https://phab.mercurial-scm.org/D8664
Martin von Zweigbergk <martinvonz@google.com> [Thu, 25 Jun 2020 12:02:34 -0700] rev 45015
locks: expect repo lock, not wlock, when writing to .hg/strip-backup/
There should be no need for a working copy lock when creating (or
reading) bundles in `.hg/strip-backup/` since they don't affect the
working copy.
I noticed this because we have an extension that tries to strip some
revisions while holding only a repo lock. I guess we have no such
cases in core, which seems a bit surprising. Maybe we always take a
wlock at a higher level so the working copy is not updated while the
target commit is being stripped.
Differential Revision: https://phab.mercurial-scm.org/D8666
Martin von Zweigbergk <martinvonz@google.com> [Thu, 25 Jun 2020 13:37:56 -0700] rev 45014
graft: leverage cmdutil.check_incompatible_arguments() for --abort/--stop
Differential Revision: https://phab.mercurial-scm.org/D8669
Manuel Jacob <me@manueljacob.de> [Mon, 29 Jun 2020 02:05:12 +0200] rev 45013
run-tests: fix escapes with conditions
Before this fix, escapes with conditions in tests failed like this on Python 3:
$ $PYTHON -c 'from mercurial.utils.procutil import stdout; stdout.write(b"\xff")'
- \xff (no-eol) (esc) (true !)
+ \xff (no-eol) (esc)
The unicode_escape encoding decodes br'\xff' to u'\xff'. To convert the first
256 code points to bytes with the same ordinal, the latin-1 encoding must be
used.
Escapes without conditions already worked before on Python 3, but not through
`el == l` a few lines below the changed line in run-tests.py. I didn’t
investigate further.
Manuel Jacob <me@manueljacob.de> [Sun, 28 Jun 2020 18:02:45 +0200] rev 45012
convert: set LC_CTYPE around calls to Subversion bindings
The Subversion bindings require that LC_CTYPE is set. However, we don’t want to
set it all the time, as it changes the behavior of str methods on Python 2. The
taken approach is hopefully fine-grained enough to not trigger any
locale-specfic behavior of the str methods and coarse-grained enough to not
clutter the code.
Emulating the with-statement behavior in before() and after() should be safe, as
after() is always called when before() is called. hgext.convert.hg takes a
similar approach.
Manuel Jacob <me@manueljacob.de> [Sun, 28 Jun 2020 18:02:45 +0200] rev 45011
curses: do not initialize LC_ALL to user settings (
issue6358)
701341f57ceb moved the setlocale() call to right before curses was used. This
didn’t fully solve the problem it was supposed to solve (locale-dependent
functions, like date formatting/parsing and str methods on Python 2), but only
postponed it.
Initializing LC_CTYPE seems to be sufficient for curses to work correctly.
Therefore LC_CTYPE is set while curses is used and reset afterwards. Some
locale-dependent str methods might behave differently on Python 2 while curses
is used, but that shouldn’d be a problem.