Matt Harbison <matt_harbison@yahoo.com> [Tue, 21 Jan 2020 09:51:39 -0500] rev 44139
lfs: explicitly close the file handle for the blob being uploaded
The previous code relied on reading the blob fully to close it. The obvious
problem is if an error occurs before that point. But there is also a problem
when using workers where the data may need to be re-read, which can't happen
once it is closed. This eliminates the surprising behavior before attempting to
fix the worker problem.
Differential Revision: https://phab.mercurial-scm.org/D7957
Matt Harbison <matt_harbison@yahoo.com> [Tue, 21 Jan 2020 09:40:40 -0500] rev 44138
lfs: drop the unused progressbar code in the `filewithprogress` class
This has been unused since
f98fac24b757, which added worker based transfers for
concurrency, shifting the progressbar maintenance to the single thread waiting
on the worker to complete. Since the name no longer fits, rename the class.
Differential Revision: https://phab.mercurial-scm.org/D7956
Raphaël Gomès <rgomes@octobus.net> [Tue, 14 Jan 2020 16:58:07 +0100] rev 44137
rust-filepatterns: remove bridge code for filepatterns-related functions
These functions will be used internally by `hg-core` without needed to be
exposed to Python.
Differential Revision: https://phab.mercurial-scm.org/D7868
Raphaël Gomès <rgomes@octobus.net> [Tue, 14 Jan 2020 18:03:28 +0100] rev 44136
rust-utils: add Rust implementation of Python's "os.path.splitdrive"
I also wrote the NT version although I didn't mean to at first, so I thought
I would keep it, so that any further effort to get the Rust code working on
Windows is a little easier.
Differential Revision: https://phab.mercurial-scm.org/D7864
Kyle Lippincott <spectral@google.com> [Tue, 21 Jan 2020 17:15:34 -0800] rev 44135
crecord: fix a concatenation of bytes and str on py3
Differential Revision: https://phab.mercurial-scm.org/D7970
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Wed, 22 Jan 2020 14:11:11 -0500] rev 44134
recover: fix typos
Differential Revision: https://phab.mercurial-scm.org/D7971
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jan 2020 10:27:39 -0800] rev 44133
relnotes: copy "next" to "5.3" and clear "next"
This is the same thing as we've done for the last two releases.
Differential Revision: https://phab.mercurial-scm.org/D7955
Kyle Lippincott <spectral@google.com> [Tue, 21 Jan 2020 12:10:35 -0800] rev 44132
cext: change two more vars to Py_ssize_t in manifest.c
D7913 fixed a compiler warning with a signedness conflict in a ternary operator
by changing the types of some variables to be Py_ssize_t instead of size_t or
int. That commit missed these two cases since they aren't warned about (at least
on my compiler).
Both of these variables are produced by operations on variables that are
themselves Py_ssize_t now/already, so they should keep the same type.
Differential Revision: https://phab.mercurial-scm.org/D7964
Augie Fackler <raf@durin42.com> [Tue, 21 Jan 2020 13:16:30 -0500] rev 44131
Added signature for changeset
84a0102c05c7
Augie Fackler <raf@durin42.com> [Tue, 21 Jan 2020 13:16:29 -0500] rev 44130
Added tag 5.3rc0 for changeset
84a0102c05c7
Augie Fackler <augie@google.com> [Tue, 21 Jan 2020 13:14:51 -0500] rev 44129
merge to stable for 5.3 release freeze
Matt Harbison <matt_harbison@yahoo.com> [Fri, 17 Jan 2020 16:56:49 -0500] rev 44128
phabricator: use .arcconfig for `phabricator.url` if not set locally
This setting is also per repo; see the previous commit for details.
The existing `conduit_uri` setting is the previous name of `phabricator.uri`[1]
and while it could easily be queried before the latter for compatibility, the
config in this repo has '/api' appended. That's already done in `callconduit()`,
which would clearly end up giving the wrong result. It looks like the path of
the URL is now ignored in user configs[2], so add the modern setting without it
to this repo's .arcconfig.
Sadly, we still need to have contributors configure `auth.hg.phabtoken` (and
therefore `auth.hg.prefix` to link it to `phabricator.url`) in order to submit
patches, but at least now it's localized to a single section.
[1] https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/
[2] https://github.com/phacility/arcanist/blob/
cc850163f30c4697e925df0d6212469679600a2c/scripts/arcanist.php#L271
Differential Revision: https://phab.mercurial-scm.org/D7935
Matt Harbison <matt_harbison@yahoo.com> [Fri, 17 Jan 2020 14:21:40 -0500] rev 44127
phabricator: use .arcconfig for the callsign if not set locally (
issue6243)
This makes things easier for people working with more than one repository
because this file can be committed to each repository. The bug report asks to
read <repo>/.arcrc, but AFAICT, that file lives in ~/ and holds the credentials.
And we already track an .arcconfig file. Any callsign set globally is still
used if that is all that is present, but .arcconfig will override it if
available. The idea behind letting the local hgrc override .arcconfig is that
the developer may need to do testing against another server, and not dirty the
working directory.
Originally I was going to just try to read the callsign in `getrepophid()` if it
wasn't present in the hg config. That works fine, but I think it also makes
sense to read the URL from this file too. That would have worked less well
because `readurltoken()` doesn't have access to the repo object to know where to
find the file. Supplimenting the config mechanism is less magical because it
reports the source and value of the properties used, and it doesn't need to read
the file twice.
Invalid hgrc files generally cause the program to abort. I only flagged it as a
warning here because it's not our config file, not crucial to the whole program
operating, and really shouldn't be corrupt in the typical case where it is
checked into the repo.
Differential Revision: https://phab.mercurial-scm.org/D7934
Matt Harbison <matt_harbison@yahoo.com> [Fri, 17 Jan 2020 13:29:47 -0500] rev 44126
config: add a function to insert non-file based, but overridable settings
This will be used in the next patch.
Until relatively recently (
473510bf0575), there was no official way for
extensions to inject per-repo config data, so it probably makes sense that
`ui.setconfig()` items are sticky, and not affected by loading more config
files. But that makes it cumbersome if the extension wants to allow the data it
might add to be overridden by any data in the local hgrc file. The only thing I
could get to work was to load the local hgrc first, and then check if the source
for the config item that should be overridden was *not* the local hgrc file
name. But that's brittle because in addition to the file name, the source
contains the line number, there are the usual '\' vs '/' platform differences,
etc.
Differential Revision: https://phab.mercurial-scm.org/D7933
Matt Harbison <matt_harbison@yahoo.com> [Thu, 16 Jan 2020 19:48:01 -0500] rev 44125
tests: restore phabricator tests and regenerate the recordings
These contain the new API chatter. Most of the changes are because some new
commits were created, but they're pretty obviously equivalent. I have no idea
why the last recording contains real data, whereas it previously looked fake.
Differential Revision: https://phab.mercurial-scm.org/D7920
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Jan 2020 11:24:05 +0100] rev 44124
hgrc: introduce HGRCSKIPREPO to skip reading the repository's hgrc
We had a way to change the behavior regarding reading the global and user
config, but we had nothing regarding the repository hgrc itself.
This option is useful in situation where scripts need to be able to work around
strange configuration set by the user in his repository. (and were HGPLAIN is
not enough).
Differential Revision: https://phab.mercurial-scm.org/D7807
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 10:37:14 -0800] rev 44123
debugcommands: move away from line buffered output on binary stream
Line buffering on binary file objects is apparently undefined behavior
in Python and emits a RuntimeWarning on Python 3.8. See
https://bugs.python.org/
issue32236.
This commit changes the I/O logging file descriptor from line
buffered to unbuffered to work around this. I'm no fan of
unbuffered I/O for performance reasons. But I don't think it
is an issue here given the nature of the code.
With this change, test-ssh-proto.t now passes on Python 3.8.
Differential Revision: https://phab.mercurial-scm.org/D7948
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 10:43:52 -0800] rev 44122
py3: conditionalize test-lfs-serve-access.t for Python 3.8
This is another case where Python 3.8's traceback printing
varies subtly from older Python versions. Again, I'm not sure
why. But this is apparently the new behavior.
With this change, test-lfs-serve-access.t now passes on Python
3.8!
Differential Revision: https://phab.mercurial-scm.org/D7947
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 10:27:03 -0800] rev 44121
py3: add extra traceback line present on Python 3.8
I'm not sure why Python 3.8 is outputting this line. It
appears to be a change in behavior of formatting tracebacks on
Python 3.8. So let's add it to expected output.
With this change, test-hook.t now passes on Python 3.8.
Differential Revision: https://phab.mercurial-scm.org/D7946
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 10:12:41 -0800] rev 44120
py3: conditionalize test-flagprocessor.t on Python 3.8
For reasons I don't understand, Python 3.8 is outputting a different
lint in the traceback than prior Pythons.
The lines in question are:
flagutil.addflagprocessor(
REVIDX_NOOP, (noopdonothingread, noopdonothing, validatehash,)
)
Python <3.8 prints the 2nd line but 3.8 the first line. Perhaps Python
changed its traceback logic to always print the first line of a
multiple line expression?
Whatever the case, with this change, the test now passes on
Python 3.8.
Differential Revision: https://phab.mercurial-scm.org/D7945
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 10:21:45 -0800] rev 44119
tests: conditionalize test-hightlight.t on pygments version
Output changed slightly in pygments 2.5.
I thought it was easier to copy the line and add a version
check than to add a regular expression because the line has some
special characters. I also like tests explicitly calling out where
they vary.
Differential Revision: https://phab.mercurial-scm.org/D7943
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 20 Jan 2020 23:51:25 -0800] rev 44118
hgdemandimport: apply lazy module loading to sys.meta_path finders
Python's `sys.meta_path` finders are the primary objects whose job it
is to find a module at import time. When `import` is called, Python
iterates objects in this list and calls `o.find_spec(...)` to find
a `ModuleSpec` (or None if the module couldn't be found by that
finder). If no meta path finder can find a module, import fails.
One of the default meta path finders is `PathFinder`. Its job is to
import modules from the filesystem and is probably the most important
importer. This finder looks at `sys.path` and `sys.path_hooks` to do
its job.
The `ModuleSpec` returned by `MetaPathImporter.find_spec()` has a
`loader` attribute, which defines the concrete module loader to use.
`sys.path_hooks` is a hook point for teaching `PathFinder` to
instantiate custom loader types.
Previously, we injected a custom `sys.path_hook` that told `PathFinder`
to wrap the default loaders with a loader that creates a module object
that is lazy.
This approach worked. But its main limitation was that it only applied
to the `PathFinder` meta path importer. There are other meta path
importers that are registered. And in the case of PyOxidizer loading
modules from memory, `PathFinder` doesn't come into play since
PyOxidizer's own meta path importer was handling all imports.
This commit changes our approach to lazy module loading by proxying
all meta path importers. Specifically, we overload the `find_spec()`
method to swap in a wrapped loader on the `ModuleSpec` before it
is returned. The end result of this is all meta path importers should
be lazy.
As much as I would have loved to utilize .__class__ manipulation to
achieve this, some meta path importers are implemented in C/Rust
in such a way that they cannot be monkeypatched. This is why we
use __getattribute__ to define a proxy.
Also, this change could theoretically open us up to regressions in
meta path importers whose loader is creating module objects which
can't be monkeypatched. But I'm not aware of any of these in the
wild. So I think we'll be safe.
According to hyperfine, this change yields a decent startup time win of
5-6ms:
```
Benchmark #1: ~/.pyenv/versions/3.6.10/bin/python ./hg version
Time (mean ± σ): 86.8 ms ± 0.5 ms [User: 78.0 ms, System: 8.7 ms]
Range (min … max): 86.0 ms … 89.1 ms 50 runs
Time (mean ± σ): 81.1 ms ± 2.7 ms [User: 74.5 ms, System: 6.5 ms]
Range (min … max): 77.8 ms … 90.5 ms 50 runs
Benchmark #2: ~/.pyenv/versions/3.7.6/bin/python ./hg version
Time (mean ± σ): 78.9 ms ± 0.6 ms [User: 70.2 ms, System: 8.7 ms]
Range (min … max): 78.1 ms … 81.2 ms 50 runs
Time (mean ± σ): 73.4 ms ± 0.6 ms [User: 65.3 ms, System: 8.0 ms]
Range (min … max): 72.4 ms … 75.7 ms 50 runs
Benchmark #3: ~/.pyenv/versions/3.8.1/bin/python ./hg version
Time (mean ± σ): 78.1 ms ± 0.6 ms [User: 70.2 ms, System: 7.9 ms]
Range (min … max): 77.4 ms … 80.9 ms 50 runs
Time (mean ± σ): 72.1 ms ± 0.4 ms [User: 64.4 ms, System: 7.6 ms]
Range (min … max): 71.4 ms … 74.1 ms 50 runs
```
Differential Revision: https://phab.mercurial-scm.org/D7954
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 20 Jan 2020 23:42:19 -0800] rev 44117
hgdemandimport: disable on Python 3.5
The demand importer functionality isn't working at all on Python 3.5.
I'm not sure what's wrong.
Since it isn't working, let's disable it completely.
```
$ HGRCPATH= hyperfine -w 1 -r 50 -- "~/.pyenv/versions/3.5.9/bin/python ./hg version" \
"HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version"
Benchmark #1: ~/.pyenv/versions/3.5.9/bin/python ./hg version
Time (mean ± σ): 163.7 ms ± 2.2 ms [User: 148.5 ms, System: 15.7 ms]
Range (min … max): 161.0 ms … 170.2 ms 50 runs
Benchmark #2: HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version
Time (mean ± σ): 164.3 ms ± 1.4 ms [User: 148.2 ms, System: 16.6 ms]
Range (min … max): 161.4 ms … 169.8 ms 50 runs
```
Differential Revision: https://phab.mercurial-scm.org/D7953
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 18 Jan 2020 11:13:01 -0800] rev 44116
py3: suppress unraisable exceptions in test-worker.t
Python 3.8 calls sys.unraisablehook when an unraisable
exception is encountered. The default behavior is to print a
warning.
test-worker.t was triggering this hook due to a race between
a newly forked process exiting and that process's
_os.register_at_fork handlers running. I was seeing the
stdlib's random module in the stack re-seeding itself. Although
there could be other after-fork handlers in the mix.
This commit defines sys.unraisablehook to effectively no-op.
This suppresses the warning and makes test output on Python 3.8
consistent with prior versions. test-worker.t now passes on
Python 3.8.
Differential Revision: https://phab.mercurial-scm.org/D7949
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 20 Jan 2020 18:28:46 -0500] rev 44115
rust: add a README
In particular to explain how to build any of the rust. It's neither
obvious, nor easy to find out, nor easy to determine if you did it
right without some documentation.
Differential Revision: https://phab.mercurial-scm.org/D7952
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 20 Jan 2020 17:44:03 -0500] rev 44114
rust: move hgcli's README out of the way
My understanding is that it's not meant to be used in the current
form.
Differential Revision: https://phab.mercurial-scm.org/D7951
Matt Harbison <matt_harbison@yahoo.com> [Sat, 18 Jan 2020 01:54:17 -0500] rev 44113
verify: avoid spurious integrity warnings in verbose mode (
issue6172)
The issue seems to revolve around renames in filtered commits, and only occurred
in verbose mode. The problem occurs in the `# check renames` stage, around line
577. Without using the unfiltered repo, this test would have printed:
$ hg verify -v
repository uses revlog format 1
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
foo@25: checking rename of
71ec0570c325: filtered revision '25'
foobar@26: checking rename of
1b549296015b: filtered revision '26'
checked 28 changesets with 16 changes to 11 files
2 integrity errors encountered!
(first damaged changeset appears to be 25)
[1]
Differential Revision: https://phab.mercurial-scm.org/D7950
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 17 Jan 2020 22:31:47 -0800] rev 44112
py3: glob over exception in test-check-py3-compat.t
Python 3.6+ raise ModuleNotFoundError and older versions raise
ImportError. Glob over the exception differences.
For whatever reason, we were already doing this for one failure.
But not all occurrences of ModuleNotFoundError were changed.
Who knows.
This test should now pass on all Python versions (although I didn't
check Windows).
Differential Revision: https://phab.mercurial-scm.org/D7939
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 17 Jan 2020 22:24:27 -0800] rev 44111
py3: string normalization and I/O tweaks in test-lfs.t
The print was inserting b'' on Python 3. In addition, since we
weren't writing to the ui instance (which isn't readily available
in this function), output order could get mixed up.
We add some pycompat casts and a stdout flush to make the test
happy on all Python versions.
Differential Revision: https://phab.mercurial-scm.org/D7938
Matt Harbison <matt_harbison@yahoo.com> [Fri, 17 Jan 2020 21:27:53 -0500] rev 44110
help: minor copy editing to the `config.format` section
Differential Revision: https://phab.mercurial-scm.org/D7936
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 21 Nov 2019 17:27:44 +0100] rev 44109
changectx: mark parent of changesets as non filtered
If a node is not filtered, its parents cannot be filtered.
Differential Revision: https://phab.mercurial-scm.org/D7502
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 21 Nov 2019 23:46:51 +0100] rev 44108
changectx: use unfiltered changelog to walk ancestors in annotate
Since we are only walking ancestors, it is safe to use an unfiltered repository.
(Because if the original rev is not filtered, none of its ancestors will be).
Differential Revision: https://phab.mercurial-scm.org/D7501