Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 21:43:18 -0500] rev 43883
typing: suppress a warning that mercurial.windows.checkosfilename is missing
This function is used to check filename portability everwhere, so it isn't
tucked into the windows.py module. I supposed the alternative is to move it and
then alias it in `util`. I'm guessing it was done like this to save an import.
Differential Revision: https://phab.mercurial-scm.org/D7677
Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 21:36:06 -0500] rev 43882
typing: add an assertion to util.versiontuple
Fixes the following warning:
line 1177, in versiontuple: No attribute 'split' on None [attribute-error]
In Optional[bytes]
Differential Revision: https://phab.mercurial-scm.org/D7676
Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 21:28:30 -0500] rev 43881
typing: add a couple of assertions to lrucachedict to help pytype
Fixes the following warnings:
line 1488, in pop: No attribute 'markempty' on None [attribute-error]
In Optional[Union[Any, _lrucachenode, nothing]]
line 1578, in popoldest: No attribute 'markempty' on None [attribute-error]
In Optional[Union[Any, _lrucachenode, nothing]]
Differential Revision: https://phab.mercurial-scm.org/D7674
Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 21:26:21 -0500] rev 43880
util: rename a variable to avoid confusing pytype
Fixes the following warning:
line 1205, in f: No attribute 'append' on Dict[nothing, nothing] [attribute-error]
In Union[Dict[nothing, nothing], list]
Differential Revision: https://phab.mercurial-scm.org/D7673
Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 21:22:27 -0500] rev 43879
pytype: suppress the import-error in util.py when importing re2
Differential Revision: https://phab.mercurial-scm.org/D7672
Matt Harbison <matt_harbison@yahoo.com> [Sun, 15 Dec 2019 18:30:16 -0500] rev 43878
debugcommands: finish moving `extendeddateformats` from util to dateutil
Caught by pytype.
Differential Revision: https://phab.mercurial-scm.org/D7671
Matt Harbison <matt_harbison@yahoo.com> [Sat, 14 Dec 2019 18:31:50 -0500] rev 43877
ui: convert exception data to bytes when printing chained exception info
Caught by pytype.
Differential Revision: https://phab.mercurial-scm.org/D7670
Matt Harbison <matt_harbison@yahoo.com> [Sat, 14 Dec 2019 18:23:37 -0500] rev 43876
ui: use a context manager to handle file streams in edit()
Differential Revision: https://phab.mercurial-scm.org/D7669
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 15:30:16 -0800] rev 43875
graft: reuse cmdutl.resolvecommitoptions()
Differential Revision: https://phab.mercurial-scm.org/D7632
Kyle Lippincott <spectral@google.com> [Fri, 13 Dec 2019 15:46:25 -0800] rev 43874
rebase: make rebase not crash if p1 == p2 != nullid
While this shouldn't happen normally, some historical bugs can have caused this
kind of commit to exist. Instead of crashing and having it be unobvious how to
recover, let's try to continue on. Without this, we get an error like
"ValueError: min() arg is an empty sequence"
Differential Revision: https://phab.mercurial-scm.org/D7664
Kyle Lippincott <spectral@google.com> [Wed, 11 Dec 2019 19:42:05 -0800] rev 43873
merge: add commands.merge.require-rev to require an argument to hg merge
This is related to commands.rebase.requiredest, commands.update.requiredest, and
commands.push.require-revs. Since it isn't really a "destination", I went with
require-rev to be similar to push's require-revs.
Differential Revision: https://phab.mercurial-scm.org/D7620
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 09:59:03 -0800] rev 43872
tests: make test-config-env.py a little less hacky
Overriding os.path.isdir to always returns False is very
confusing. Let's make it more explicit by specifically not returning
any defaultrc/ configs.
Differential Revision: https://phab.mercurial-scm.org/D7623
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 12:57:13 -0800] rev 43871
help: get helptext/ data from `resources` module if available
For PyOxidizer, we need to read configs using the `resources`
module. This patch makes it so we use that module if available
(i.e. Python >= 3.7). It does that by adding a new `open_resource()`
function to our `resourceutil` module.
Tested by running `$PYTHON ./hg help pager` for each $PYTHON in
{python2, python3.6, python3.7}.
Differential Revision: https://phab.mercurial-scm.org/D7622
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 10:26:09 -0800] rev 43870
pycompat: allow pycompat.sysbytes() even if input already is bytes
pycompat.sysstr() on py3 accepts an input that's already str
(i.e. unicode). This patch makes it so pycompat.sysbytes() on py3
accepts an input that's already bytes. Allowing that makes it possible
to do pycompat.sysbytes(fp.name) where fp.name is either bytes or
unicode, as we'll get when fp can come from either open() or
resources.open_binary().
Differential Revision: https://phab.mercurial-scm.org/D7621
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Dec 2019 10:10:40 -0800] rev 43869
merge with stable
Yuya Nishihara <yuya@tcha.org> [Tue, 19 Nov 2019 23:19:57 +0900] rev 43868
rust-cpython: do not convert warning pattern to utf-8 bytes
On Unix, both Rust Path and Mercurial expect a locale-dependent bytes,
and we don't support Windows yet.
Differential Revision: https://phab.mercurial-scm.org/D7614
Yuya Nishihara <yuya@tcha.org> [Tue, 19 Nov 2019 23:16:16 +0900] rev 43867
rust-cpython: import utils::files::* function at module level
IIRC, it's common in Rust to call functions with the module prefix.
Differential Revision: https://phab.mercurial-scm.org/D7613
Raphaël Gomès <rgomes@octobus.net> [Mon, 18 Nov 2019 17:37:59 +0100] rev 43866
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/D7612
Raphaël Gomès <rgomes@octobus.net> [Mon, 18 Nov 2019 17:34:44 +0100] rev 43865
py3: pass bytes to `configint` and `configbool`
Both functions require bytes, even in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D7611
Raphaël Gomès <rgomes@octobus.net> [Sun, 10 Nov 2019 07:30:14 -0800] rev 43864
rust-threads: force Rayon to respect the worker count in config
As per the inline comment, this is a workaround because Rust code does not yet
know how to read config files.
Differential Revision: https://phab.mercurial-scm.org/D7610
Raphaël Gomès <rgomes@octobus.net> [Thu, 12 Dec 2019 15:55:25 +0100] rev 43863
rust-dirs: handle forgotten `Result`s
In
1fe2e574616e I introduced a temporary bugfix to align Rust code with a new
behavior from C/Python and forgot about a few `Result`s (cargo's compiler cache
does not re-emit warnings on cached modules). This fixes it.
For the record, I am still unsure that this behavior change is a good idea.
Note: I was already quite unhappy with the setters and getters for the
`DirstateMap` and, indirectly, `Dirs`, and this only further reinforces my
feelings. I hope we can one day fix that situation at the type level; Georges
Racinet and I were just talking about devising a POC for using the builder
pattern in the context of FFI with Python, we'll see what comes out of it.
Differential Revision: https://phab.mercurial-scm.org/D7609
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Dec 2019 09:43:43 -0800] rev 43862
merge with stable
Rodrigo Damazio Bovendorp <rdamazio@google.com> [Mon, 09 Dec 2019 22:24:58 -0800] rev 43861
status: outputting structured unfinished-operation information
This adds a new item in the json/template output for morestatus and added item
types to all entries.
Differential Revision: https://phab.mercurial-scm.org/D7595
Kyle Lippincott <spectral@google.com> [Thu, 05 Dec 2019 14:28:21 -0800] rev 43860
chg: fix chg to work with py3.7+ "coercing" the locale
When the environment is empty (specifically: it doesn't contain LC_ALL,
LC_CTYPE, or LANG), Python will "coerce" the locale environment variables to be
a UTF-8 capable one. It sets LC_CTYPE in the environment, and this breaks chg,
since chg operates by:
- start hg, using whatever environment the user has when chg starts
- hg stores a hash of this "original" environment, but python has already set
LC_CTYPE even though the user doesn't have it in their environment
- chg calls setenv over the commandserver. This clears the environment inside of
hg and sets it to be exactly what the environment in chg is (without
LC_CTYPE).
- chg calls validate to ensure that the environment hg is using (after the
setenv call) is the one that the chg process has - if not, it is assumed the
user changed their environment and we should use a different server. This will
*never* be true in this situation because LC_CTYPE was removed.
Differential Revision: https://phab.mercurial-scm.org/D7550