- 06 Jul, 2020 4 commits
-
-
Manuel Jacob authored
All users have been changed to use procutil.{stdin,stdout,stderr}, which provide consistent behavior across platforms and Python versions.
-
Manuel Jacob authored
On Python 3, pycompat.{stdin,stdout,stderr} are usually block-buffered even if connected to a TTY. procutil.{stdin,stdout,stderr} provide consistent behavior across platforms and Python versions.
-
Antoine Cezar authored
Differential Revision: https://phab.mercurial-scm.org/D8692
-
Jörg Sonnenberger authored
Differential Revision: https://phab.mercurial-scm.org/D8683
-
- 03 Jul, 2020 1 commit
-
-
Pierre-Yves David authored
The merge 78cafd48b9b2 had a small error and wrongly dropped the output updated from one side of the merge. This changeset re-install it. Differential Revision: https://phab.mercurial-scm.org/D8678
-
- 06 Jul, 2020 1 commit
-
-
Antoine Cezar authored
Differential Revision: https://phab.mercurial-scm.org/D8682
-
- 07 Jul, 2020 1 commit
-
-
Antoine Cezar authored
Clap has been choosen for argument parsing for the following reasons: - it's a wildly used and maintained crate - it can deal with OS encoding making it suitable for any encoding - it supports nonambiguous prefix matching as already available in hg - it will soon allow for structopts-style declarative pattern instead of the currently used builder pattern Differential Revision: https://phab.mercurial-scm.org/D8613
-
- 05 Jun, 2020 1 commit
-
-
Antoine Cezar authored
The println macro is not used to avoid string usage. Dealing only with bytes allows us to be compatible with any encoding and not just UTF8. Later on, format macro will be made to have more readable code. Differential Revision: https://phab.mercurial-scm.org/D8612
-
- 07 Jul, 2020 1 commit
-
-
Augie Fackler authored
-
- 05 Jul, 2020 2 commits
-
-
Manuel Jacob authored
For most Mercurial code, it doesn’t make a difference, as the ui object flushes stderr explicitly (after the change, we could get rid of the explicit flush). One example where it makes a observable difference is mercurial.util.timed(). Without the patch, the time is not immediately shown on Python 3. With the patch, it’s shown immediately on all Python versions and platforms.
-
Manuel Jacob authored
-
- 04 Jul, 2020 4 commits
-
-
Manuel Jacob authored
Windows doesn’t support line buffering. Previously, we worked around that by setting the stream unbuffered. Instead, we can use our own line buffering we already use on Python 3.
-
Manuel Jacob authored
Besides making the code clearer, it will reduce the diff in the next patch.
-
Manuel Jacob authored
Doing reassignments is an anti-pattern IMHO, but I see how it makes sense here. When first looking at this code after jumping here with ctags, I missed the fact that stdout was reassigned. To make the code clearer, the assignments should be as close as possible to the reassignments.
-
Manuel Jacob authored
At the same time, document the logic and generalize it to work on all Python versions.
-
- 02 Jul, 2020 1 commit
-
-
Manuel Jacob authored
There’s nothing Python 3-only about LineBufferedWrapper. In the future, we may want to use it on Windows, to work around missing line-buffering support.
-
- 04 Jul, 2020 1 commit
-
-
Manuel Jacob authored
-
- 02 Jul, 2020 2 commits
-
-
Manuel Jacob authored
Not that it makes a big difference, but using `p` instead of `x` is clearer to me.
-
Manuel Jacob authored
It was not immediately obvious to me, when first seeing this, why a list was created. It needed a second look to understand that the purpose was to check whether the condition is true for any of the parents. Using any() for that is clearer.
-
- 03 Jul, 2020 1 commit
-
-
Pulkit Goyal authored
According to issue6330, running chg on heavy loaded systems can lead to following error: ``` Traceback (most recent call last): File "path-to-hg/mercurial/commandserver.py", line 650, in _acceptnewconnection self._runworker(conn) File "path-to-hg/mercurial/commandserver.py", line 701, in _runworker prereposetups=[self._reposetup], File "path-to-hg/mercurial/commandserver.py", line 470, in _serverequest sv.cleanup() File "path-to-hg/mercurial/chgserver.py", line 381, in cleanup self._restoreio() File "path-to-hg/mercurial/chgserver.py", line 444, in _restoreio os.dup2(fd, fp.fileno()) OSError: [Errno 16] Device or resource busy ``` [man dup2] indicates that, on Linux, EBUSY comes from a race condition between open() and dup2(). However it's not clear why open() race occurred for newfd=stdin/out/err. We suppress the OSError in _restoreio() since the forked worker process will finish anyway and add some logging. Thanks to Mitchell Plamann for a detailed bug description and Yuya Nishihara for suggesting the fix.
-
- 02 Jul, 2020 1 commit
-
-
Jörg Sonnenberger authored
Differential Revision: https://phab.mercurial-scm.org/D8675
-
- 03 Jul, 2020 1 commit
-
-
Manuel Jacob authored
`socket.getfqdn()` assumes that the name is passed as `str` on Python 3 and always returns `str` in this case. Mercurial passed `bytes` (but still expected a `str` result), which worked by chance in many cases, except for e.g. b'0.0.0.0', which was returned unchanged, breaking later code. Instead of calling `socket.getfqdn()`, we can also use `self.server_name` from the base `HTTPServer` class, which already stores the FQDN of the locally-bound socket name (see `BaseHTTPServer.py` in the Python 2 stdlib and `http/server.py` in the Python 3 stdlib).
-
- 01 Jul, 2020 2 commits
-
-
Augie Fackler authored
-
Axel Hecht authored
Return strings from _findprogram as all callers expect unicode strings. Previously the check in _usecorrectpython agains sysexecutable was always false on Python 3. Differential Revision: https://phab.mercurial-scm.org/D8674
-
- 29 Jun, 2020 1 commit
-
-
Jörg Sonnenberger authored
Differential Revision: https://phab.mercurial-scm.org/D8672
-
- 01 Jul, 2020 2 commits
-
-
Pulkit Goyal authored
-
Pulkit Goyal authored
-
- 30 Jun, 2020 1 commit
-
-
Manuel Jacob authored
75b59d221aa3 added most of the code that gets removed by this patch. It helped making progress on Python 3, but the reasoning was wrong in many ways. I tried to retract it while it was queued, but it was too late. Back then, I was asssuming that what happened on Python 2 (preserving bytes) is correct and my Python 3 change is a hack. However it turned out that Subversion interprets percent-encoded bytes as UTF-8. Accepting the same format as Subversion is a good idea. Consistency with urlreq.pathname2url() (as described in the removed comment) doesn’t matter because that function is only used for passing paths to urllib. This is not a backwards-incompatible change because before 5c0d5b48e58c, non-ASCII filenames didn’t work at all on Python 2. When the locale encoding is ISO-8859-15, `svn` accepts `file:///tmp/a%E2%82%AC` for `/tmp/a€`. Before this patch, this was the case for this extension on Python 3, but not on Python 2. This patch makes it work like with `svn` on both Python 2 and Python 3.
-
- 18 Jun, 2020 1 commit
-
-
Jörg Sonnenberger authored
Differential Revision: https://phab.mercurial-scm.org/D8640
-
- 29 Jun, 2020 1 commit
-
-
Yuya Nishihara authored
-
- 28 Jun, 2020 2 commits
-
-
Manuel Jacob authored
As Yuya Nishihara pointed out, setting LC_CTYPE changes the behavior of some str methods on Python 2.
-
Manuel Jacob authored
The changeset was based on a25343d16ebe, which will be backed out, too. Another fix for the problem will be resubmitted to the stable branch.
-
- 25 Jun, 2020 5 commits
-
-
Julien Cristau authored
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 authored
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 authored
Differential Revision: https://phab.mercurial-scm.org/D8669
-
Martin von Zweigbergk authored
Differential Revision: https://phab.mercurial-scm.org/D8668
-
Martin von Zweigbergk authored
Differential Revision: https://phab.mercurial-scm.org/D8667
-
- 28 Jun, 2020 1 commit
-
-
Matt Harbison authored
External extensions can be assigned any name, but presumably most enabled extensions will be internal ones and having them sorted makes it easier to find specific ones if the list is long. The lists in `hg help extensions` are already sorted. Differential Revision: https://phab.mercurial-scm.org/D8671
-
- 27 Jun, 2020 1 commit
-
-
Manuel Jacob authored
The original import of crecord in 2008 already said "I have no idea if wcurses works with crecord...". The last reference to a Python package called wcurses is https://web.archive.org/web/20101025073658/http://adamv.com/dev/python/curses/. However, the Python package from there is called "curses" and not "wcurses". I didn’t find any evidence that it ever worked.
-
- 30 Jun, 2020 1 commit
-
-
Manuel Jacob authored
The function is unusual for a bytes-handling function in Mercurial because it can’t handle arbitrary bytes. Therefore we should document this fact. Pointed out by Yuya Nishihara while reviewing e3b19004087a.
-