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
Manuel Jacob <me@manueljacob.de> [Sun, 17 Nov 2019 19:55:01 +0100] rev 43668
cffi: fix build on Python 3
CFFI expects the arguments to be of type str, which means that the string
literals should not have the `b` prefix.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 16 Nov 2019 20:08:35 +0100] rev 43667
pure: use string for another exception in the pure version of base85
That message does not seems tested, but I am assuming that the same reasoning as
for the previous changeset applies.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 16 Nov 2019 20:07:49 +0100] rev 43666
pure: use string for exception in the pure version of base85
Without this change, running the test with python3 and --pure gives the
following error::
--- /home/marmoute/src/mercurial-dev/tests/test-import-git.t
+++ /home/marmoute/src/mercurial-dev/tests/test-import-git.t.err
@@ -518,7 +518,7 @@
>
> EOF
applying patch from stdin
- abort: could not decode "binary2" binary patch: bad base85 character at position 6
+ abort: could not decode "binary2" binary patch: b'bad base85 character at position 6'
[255]
$ hg revert -aq
To make the cext implementation, we use a "native" string for the exception.
This fix the test failure.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 14 Nov 2019 10:47:04 +0100] rev 43665
bisect: replace try:/finally: by a "restore_state" context manager
This should help pytype to not consider "bgood" variable as NameError.
See https://phab.mercurial-scm.org/D7384 for context.
Differential Revision: https://phab.mercurial-scm.org/D7430
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Wed, 30 Oct 2019 19:19:57 -0400] rev 43664
histedit: render a rolled up description using the proper roll colours
Users have rightfully complained that the old behaviour of completely
removing the description of a rolled commit makes it difficult to
remember what was in that commit. Instead, we now render the removed
description in red.
I couldn't think of a simpler way to do this. You can't just combine
existing curses colours into new effects; only secondary effects like
bold or underline can be logically OR'ed to generate a combined text
effect. It seems easier to just redundantly keep track of what the
roll colour should be.
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Wed, 30 Oct 2019 19:34:57 -0400] rev 43663
histedit: define new colour pairs for roll action
Red seems like a good colour to indicate removal, since that's the
colour we use in diffs. We need three varieties with three different
backgrounds corresponding to the possible ways we can display a rule.
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Wed, 30 Oct 2019 19:27:09 -0400] rev 43662
histeditrule: split __bytes__ property into prefix and desc
In order to be able to colourise the description of the rule, we need
to have it as a separate bytestring. Curses doesn't make it easy to
take existing text on the screen and give it different properties; we
can only add new text with new properties.
Yuya Nishihara <yuya@tcha.org> [Fri, 15 Nov 2019 22:22:55 +0900] rev 43661
merge with stable
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 14 Nov 2019 20:40:54 -0800] rev 43660
packaging: convert to UNIX line endings
I must have my editor on Windows configured incorrectly because
I submitted patches with Windows line endings :(
# skip-blame whitespace only line ending changes
Differential Revision: https://phab.mercurial-scm.org/D7421
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 14 Nov 2019 20:35:11 -0800] rev 43659
black: blacken scripts
test-check-format.t doesn't appear to detect Python scripts with shebangs.
But my editor which is configured to auto run black on Python files does
and it appears some files are not blackened.
This commit blackens scripts that need it.
# skip-blame reformatting
Differential Revision: https://phab.mercurial-scm.org/D7420
Augie Fackler <augie@google.com> [Tue, 12 Nov 2019 10:17:59 -0500] rev 43658
dirs: resolve fuzzer OOM situation by disallowing deep directory hierarchies
It seems like 2048 directories ought to be enough for any reasonable
use of Mercurial?
A previous version of this patch scanned for slashes before any allocations
occurred. That approach is slower than this in the happy path, but much faster
than this in the case that too many slashes are encountered. We may want to
revisit it in the future using memchr() so it'll be well-optimized by the libc
we're using.
.. bc:
Mercurial will now defend against OOMs by refusing to operate on
paths with 2048 or more components. This means that _extremely_
deep path hierarchies will be rejected, but we anticipate nobody
is using hierarchies this deep.
Differential Revision: https://phab.mercurial-scm.org/D7411
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 14:14:11 -0800] rev 43657
py3: use native string for 'macosx_app'
I couldn't find any definitive information on this, but all examples
(except for ours) seem to use a native string.
Differential Revision: https://phab.mercurial-scm.org/D7414
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 14:07:36 -0800] rev 43656
py3: drop an unnecessary fsencode() before comparing with constant
Differential Revision: https://phab.mercurial-scm.org/D7413
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 14:03:02 -0800] rev 43655
py3: use native string as fallback value for __file__ for consistency
This is not a bugfix (pycommpat.fsencode(b'') is a no-op on py3), but
the b'' value was inconsistent and confusing.
Differential Revision: https://phab.mercurial-scm.org/D7412
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 13:38:17 -0500] rev 43654
scmutil: convert status data object from a tuple to an attrs (API)
We've been pushing towards the property names for a while, and the
subclassing of the tuple confuses pytype. Rather than bend over
backwards to try and annotate the tuple subclass, let's just use attrs
here.
Differential Revision: https://phab.mercurial-scm.org/D7406
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:29:27 -0500] rev 43653
perf: bool() elements of dirstate.status return instead of len()
I'm about to make scmutil.status no longer have a len(), so we need to do
something else to "use" the results in this perf method.
Differential Revision: https://phab.mercurial-scm.org/D7405
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:28:44 -0500] rev 43652
tags: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7404
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:28:34 -0500] rev 43651
subrepo: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7403
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:28:08 -0500] rev 43650
revset: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7402
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:27:58 -0500] rev 43649
patch: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7401
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:27:50 -0500] rev 43648
logcmdutil: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7400
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:27:40 -0500] rev 43647
context: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7399
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:27:32 -0500] rev 43646
commands: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7398
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:27:20 -0500] rev 43645
cmdutil: convert terse status result back to an scmutil.status
This is also part of detupling scmutil.status.
Differential Revision: https://phab.mercurial-scm.org/D7397
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:26:17 -0500] rev 43644
cmdutil: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7396
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:26:05 -0500] rev 43643
uncommit: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7395
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:25:57 -0500] rev 43642
transplant: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7394
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:25:48 -0500] rev 43641
split: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7393
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:25:40 -0500] rev 43640
mq: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7392
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:25:26 -0500] rev 43639
hgk: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7391
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 15:24:22 -0500] rev 43638
extdiff: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7390
Augie Fackler <augie@google.com> [Wed, 13 Nov 2019 20:32:24 -0500] rev 43637
encoding: fix bad type annotation
This function returns utf-8 in a bytes, not a unicode.
Differential Revision: https://phab.mercurial-scm.org/D7379
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 13:13:36 -0500] rev 43636
branchmap: annotate constructor type for branchcache
This type signature is...big. But it's correct as far as I can tell,
and it detected a bug.
Differential Revision: https://phab.mercurial-scm.org/D7389
Augie Fackler <augie@google.com> [Wed, 13 Nov 2019 22:30:33 -0500] rev 43635
debugcommands: don't shadow the error module
Caught by pytype.
Differential Revision: https://phab.mercurial-scm.org/D7378
Augie Fackler <augie@google.com> [Thu, 14 Nov 2019 13:14:02 -0500] rev 43634
branchmap: correctly set()-ify list argument
Caught with pytype. I'm more than a little curious how this never
caused problems.
Differential Revision: https://phab.mercurial-scm.org/D7289
Martin von Zweigbergk <martinvonz@google.com> [Thu, 14 Nov 2019 08:03:26 -0800] rev 43633
utils: move finddirs() to pathutil
This is a follow-up to
c21aca51b392 (utils: move the `dirs` definition
in pathutil (API), 2019-11-06). finddirs() is closely related to dirs
and used by it.
Differential Revision: https://phab.mercurial-scm.org/D7388
Matt Harbison <matt_harbison@yahoo.com> [Wed, 13 Nov 2019 21:52:25 -0500] rev 43632
help: create packages for the help text
These files need to be loaded as resources with PyOxidizer, instead of using
filesystem representations. AFAICT, the resource loading mechanisms only work
for the named package given to it, and can't reach into a subdirectory.
While here, the `help` directory is renamed to `helptext`. Without this, trying
to load external help text crashed in mercurial/help.py when importing `.i18n`,
saying there's no `mercurial.help.i18n` module.
Differential Revision: https://phab.mercurial-scm.org/D7376
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 14 Nov 2019 11:33:05 +0100] rev 43631
tests: test "hg log" with --line-range and --copies
This now works (does not crash), due to previous changeset. Since
--line-range implies --follow, --copies option is redundant.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 14 Nov 2019 11:11:38 +0100] rev 43630
logcmdutil: let getlinerangerevs() return "revs" as a smartset
This makes it consistent in "hg log" command where 'revs' can come from
logcmdutil.getrevs() as a smartset or from getlinerangerevs(),
previously as a list. This will help type hinting as noticed in
https://phab.mercurial-scm.org/D7377.
Denis Laxalde <denis.laxalde@logilab.fr> [Wed, 13 Nov 2019 17:06:05 +0100] rev 43629
patchbomb: fix wrong argument type when calling mail generator.flatten()
Denis Laxalde <denis.laxalde@logilab.fr> [Wed, 13 Nov 2019 16:46:28 +0100] rev 43628
mail: move strtolocal call in _addressencode()
Denis Laxalde <denis.laxalde@logilab.fr> [Wed, 13 Nov 2019 15:23:04 +0100] rev 43627
mail: use a native string for "subtype" value
This is somehow similar to previous changeset and avoids one str
conversion.