Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 22:31:21 -0800] rev 43698
py3: use '%d' for formatting a revnum in `hg co --date` code
Differential Revision: https://phab.mercurial-scm.org/D7429
Raphaël Gomès <rgomes@octobus.net> [Mon, 18 Nov 2019 17:37:59 +0100] rev 43697
py3: send bytes from Rust-created warning patterns
Python code expects bytes in both Python 2 and Python 3, so we should send
bytes.
Differential Revision: https://phab.mercurial-scm.org/D7454
Raphaël Gomès <rgomes@octobus.net> [Mon, 18 Nov 2019 17:34:44 +0100] rev 43696
py3: pass bytes to `configint` and `configbool`
Both functions require bytes, even in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D7453
Martin von Zweigbergk <martinvonz@google.com> [Fri, 15 Nov 2019 10:16:27 -0800] rev 43695
templates: make {indent("", " ")} be empty
indent() is documented to indent all non-empty lines, but it made an
exception for the first line, which always got indented. I also made
indent() not indent the first line even if an indent override was
given for the first line. I think that is what one would usually want.
Differential Revision: https://phab.mercurial-scm.org/D7432
Martin von Zweigbergk <martinvonz@google.com> [Fri, 15 Nov 2019 10:16:22 -0800] rev 43694
tests: document behavior of indent() with empty first line
indent() is documented to indent all non-empty lines, but it still
indents the first line even if it's empty. Let's have tests for that.
Differential Revision: https://phab.mercurial-scm.org/D7431
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 16 Nov 2019 12:08:02 -0800] rev 43693
tests: check for Windows line endings
We shouldn't generally be using Windows line endings in files
under version control. I've accidentally committed a few files
with Windows line endings recently. So let's add a test for
this.
Differential Revision: https://phab.mercurial-scm.org/D7448
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 16 Nov 2019 11:54:39 -0800] rev 43692
tests: verify that Python scripts are blackened
Scripts are Python too. They should be blackened.
(As suggested by Pierre-Yves in D7420.)
Differential Revision: https://phab.mercurial-scm.org/D7447
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 16 Nov 2019 11:53:47 -0800] rev 43691
black: blacken scripts
These scripts weren't blackened. I found these as part of adding
script checking to test-check-format.t.
# skip-blame black
Differential Revision: https://phab.mercurial-scm.org/D7446
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 16 Nov 2019 11:59:22 -0800] rev 43690
doc: don't use mutable default arguments
It appears our mutable default arguments checker doesn't find
arguments not on the first line of a function definition :(
The arguments aren't used, so the default value is irrelevant.
I found this when blackening this script in a future commit.
Differential Revision: https://phab.mercurial-scm.org/D7445
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 21:58:36 -0800] rev 43689
tags: don't check for clean files when checking for dirty working copy
We didn't request status for clean files so there should never be any
entries in the list of clean files (at least not since
dd773340a085),
but it's misleading to check the list.
Differential Revision: https://phab.mercurial-scm.org/D7428
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 21:13:46 -0800] rev 43688
branchmap: make "closed" a set from beginning instead of converting from list
Differential Revision: https://phab.mercurial-scm.org/D7427
Matt Harbison <matt_harbison@yahoo.com> [Sun, 17 Nov 2019 01:34:52 -0500] rev 43687
debugextensions: gracefully handle missing __file__ attributes
This was crashing PyOxidizer.
Differential Revision: https://phab.mercurial-scm.org/D7452
Matt Harbison <matt_harbison@yahoo.com> [Sun, 17 Nov 2019 01:00:06 -0500] rev 43686
debuginstall: gracefully handle missing __file__ attributes
This was crashing PyOxidizer. While here, point "Python lib" and "installed
modules" to the oxidized binary when read from memory instead of pretending
their location is unknown.
Differential Revision: https://phab.mercurial-scm.org/D7451
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 16:25:28 +0900] rev 43685
typing: add pseudo localstr.__init__() to help pytype
Apparently, pytype failed to parse localstr.__new__()? This fixes the
following errors:
line 126, in __hash__: No attribute '_utf8' on localstr [attribute-error]
line 188, in tolocal: Function localstr.__init__ was called with the wrong
arguments [wrong-arg-types]
Expected: (self, string: str, ...)
Actually passed: (self, string: bytes, ...)
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 15:24:49 +0900] rev 43684
typing: fix argument type of encoding.localstr()
It takes both utf-8 and local strings in bytes type.
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 16:09:39 +0900] rev 43683
typing: suppress error of py2 encoding.strtolocal() and .strfromlocal()
I don't know how to conditionally get rid of these py2/py3 overloads from
.pyi file. Instead, this patch makes pytype ignore the false-positives:
line 271, in strtolocal: bad option in return type [bad-return-type]
Expected: bytes
Actually returned: str
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 15:34:47 +0900] rev 43682
typing: constrain argument/return types of encoding.toutf8b()
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 15:27:12 +0900] rev 43681
typing: fix argument type of encoding.tolocal() and .fromutf8b()
Fixes various pytype errors.
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 15:10:41 +0900] rev 43680
typing: fix forward reference in _Tlocalstr type bound
AFAIK, a quoted string in type position is translated to its ForwardRef.
https://github.com/python/typing/issues/34
This fixes the following error:
File "mercurial/encoding.py", line 38, in <module>: Name 'localstr' is not
defined [name-error]
Yuya Nishihara <yuya@tcha.org> [Sat, 16 Nov 2019 15:43:21 +0900] rev 43679
encoding: make getcols() raise exception explicitly
This helps pytype.
File "mercurial/encoding.py", line 329, in getcols: bad option in return
type [bad-return-type]
Expected: bytes
Actually returned: None
Matt Harbison <matt_harbison@yahoo.com> [Sat, 16 Nov 2019 12:19:43 -0500] rev 43678
setup: conditionalize access to `sys.dllhandle` when building extensions
This code is only run on Windows, and was crashing PyOxidizer when running in
`setup-py-install` mode. Now an oxidized binary can be built by simply pointing
to setup.py.
Something is slightly different now that it's not being built from a virtualenv.
Previously, `hg version` could print to the screen, but now it aborts saying
"Incorrect function". But I can see the output if redirected to a file, and
it's not complaining about missing C extensions, so I think those are loading
now (unlike from the virtualenv). The interesting this about this incorrect
function output is that it failed when initially built. I then went back and
did a `make clean` and `make local` with py3 and then py2 to ensure I didn't
break the existing code. At that point I ran the oxidized executable again and
it was able to print to the screen normally! So I ran `pyoxidizer build` again,
it only output the following, and then running the executable failed to output
again:
(pyO2_venv) C:\Users\Matt\hg3\hg_pyO2>pyoxidizer build
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
packaging application into C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
purging C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
copying C:/Users/Matt/hg3/hg_pyO2\build\target\x86_64-pc-windows-msvc\debug\hg_pyO2.exe to
C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug\hg_pyO2.exe
resolving packaging state...
writing license for [...]
hg_pyO2 packaged into C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
executable path: C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug\hg_pyO2.exe
Differential Revision: https://phab.mercurial-scm.org/D7444
Kim Alvefur <zash@zash.se> [Wed, 13 Nov 2019 22:40:32 +0100] rev 43677
zeroconf: fix traceback under py3
hg serve under py3 caused
struct.error: char format requires a bytes object of length 1
<pulkit25> ah, I think that should be `pycompat.bytechr` instead of chr
Matt Harbison <matt_harbison@yahoo.com> [Sat, 16 Nov 2019 11:48:47 -0500] rev 43676
setup: use bytes for assumed python version
Caught by PyOxidizer when hacking on Windows.
# skip-blame for b'' prefixing
Differential Revision: https://phab.mercurial-scm.org/D7443
Matt Harbison <matt_harbison@yahoo.com> [Sat, 16 Nov 2019 11:42:27 -0500] rev 43675
setup: combine two contiguous string literals
Differential Revision: https://phab.mercurial-scm.org/D7442
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 13:18:22 -0800] rev 43674
util: remove datapath and swith users over to resourceutil
The util module no longer needs the datapath for injecting it into the
i18n module, so we can remove it from there and update other users.
Differential Revision: https://phab.mercurial-scm.org/D7436
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 12:41:33 -0800] rev 43673
i18n: get datapath directly from resourceutil
The new resourceutil module is lower in the dependency graph, so we
can depend directly on it and won't have to depend on the util module
to inject the datapath.
Differential Revision: https://phab.mercurial-scm.org/D7435
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 12:33:10 -0800] rev 43672
util: move definition of datapath to resourceutil
Since this means moving the function into a subdirectory, we have to
compensate by adding another layer of os.path.dirname().
Differential Revision: https://phab.mercurial-scm.org/D7434
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 11:52:22 -0800] rev 43671
procutil: move mainfrozen() to new resourceutil.py
The i18n module practically depends on procutil for mainfrozen() but
since procutil depends on i18n, it would be a circular dependency if
i18n depended directly on procutil. The cycle is currently resolved by
having the higher-level util module calculate the "datapath" and
inject it into i18n. Extracting mainfrozen() to a new module lets us
clean up the dependencies.
Differential Revision: https://phab.mercurial-scm.org/D7433
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 17:36:01 -0800] rev 43670
defaults: rename default.d to defaultrc to make it a valid package name
"default.d" is not a valid Python package name, and it needs to be a
valid package name if we want to be able to load the files from here
as resources.
Differential Revision: https://phab.mercurial-scm.org/D7426
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 17:30:52 -0800] rev 43669
help: remove references to default.d/ from user-facing docs
The user doesn't need to know what we call the internal directory and
I'm about to rename it.
Differential Revision: https://phab.mercurial-scm.org/D7425