Augie Fackler <augie@google.com> [Tue, 01 Sep 2020 10:33:10 -0400] rev 45397
genosxversion: don't give up if we can't find a path to hg libraries
This doesn't work if you have a PyOxidized hg on $PATH, but everything
is fine if you just ignore that problem.
Differential Revision: https://phab.mercurial-scm.org/D8975
Manuel Jacob <me@manueljacob.de> [Wed, 02 Sep 2020 01:30:56 +0200] rev 45396
tests: fix test-demandimport.py on Python 3.9
Starting with Python 3.9, importing importlib.resources (indirectly) imports
the zipfile module. Therefore, the module is not suitable for the test.
Instead, we can use the ftplib module, which is very unlikely to be imported
during the test run.
Augie Fackler <augie@google.com> [Tue, 01 Sep 2020 09:46:15 -0400] rev 45395
merge with stable
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 01 Sep 2020 16:27:25 +0530] rev 45394
Added signature for changeset
f62bb5d07848
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 01 Sep 2020 16:27:18 +0530] rev 45393
Added tag 5.5.1 for changeset
f62bb5d07848
Matt Harbison <matt_harbison@yahoo.com> [Mon, 24 Aug 2020 12:39:48 -0400] rev 45392
mercurial: force LF endings for *.py, *.{c,h} and *.t in .editorconfig
PyCharm on Windows otherwise uses CRLF.
Differential Revision: https://phab.mercurial-scm.org/D8947
Aay Jay Chan <aayjaychan@itopia.com.hk> [Tue, 18 Aug 2020 22:21:00 +0800] rev 45391
hooklib: update documentation of changeset_obsoletedfor for changed hook type
This updates usage example of changeset_obsoleted to reflect the move from
pretxnclose to txnclose made in
04ef381000a8 (hooklib: fix detection of
successors for changeset_obsoleted).
Differential Revision: https://phab.mercurial-scm.org/D8929
Martin von Zweigbergk <martinvonz@google.com> [Fri, 14 Aug 2020 20:45:49 -0700] rev 45390
worker: don't expose readinto() on _blockingreader since pickle is picky
The `pickle` module expects the input to be buffered and a whole
object to be available when `pickle.load()` is called, which is not
necessarily true when we send data from workers back to the parent
process (i.e., it seems like a bad assumption for the `pickle` module
to make). We added a workaround for that in
https://phab.mercurial-scm.org/D8076, which made `read()` continue
until all the requested bytes have been read.
As we found out at work after a lot of investigation (I've spent the
last two days on this), the native version of `pickle.load()` has
started calling `readinto()` on the input since Python 3.8. That
started being called in
https://github.com/python/cpython/commit/
91f4380cedbae32b49adbea2518014a5624c6523
(and only by the C version of `pickle.load()`)). Before that, it was
only `read()` and `readline()` that were called. The problem with that
was that `readinto()` on our `_blockingreader` was simply delegating
to the underlying, *unbuffered* object. The symptom we saw was that
`hg fix` started failing sometimes on Python 3.8 on Mac. It failed
very relyable in some cases. I still haven't figured out under what
circumstances it fails and I've been unable to reproduce it in test
cases (I've tried writing larger amounts of data, using different
numbers of workers, and making the formatters sleep). I have, however,
been able to reproduce it 3-4 times on Linux, but then it stopped
reproducing on the following few hundred attempts.
To fix the problem, we can simply remove the implementation of
`readinto()`, since the unpickler will then fall back to calling
`read()`. The fallback was added a bit later, in
https://github.com/python/cpython/commit/
b19f7ecfa3adc6ba1544225317b9473649815b38. However,
that commit also added checking that what `read()` returns is a
`bytes`, so we also need to convert the `bytearray` we use into
that. I was able to add a test for that failure at least.
Differential Revision: https://phab.mercurial-scm.org/D8928
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Aug 2020 09:06:35 +0200] rev 45389
test: add `test-repo` requirement to `test-check-format` (
issue6395)
Kindly reported by Tristan Seligmann <mithrandi@mithrandi.net>
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Aug 2020 15:03:57 -0700] rev 45388
commit: clear mergestate also with --amend (
issue6304)
The `hg commit --amend` uses the in-memory code, which naturally
doesn't touch the merge state (well, it shouldn't anyway; I think I've
fixed bugs in that area recently). We therefore need to clear the
mergestate after calling `repo.commitctx()` since we expect that from
`hg commit --amend`.
Differential Revision: https://phab.mercurial-scm.org/D8932
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Aug 2020 14:26:49 -0700] rev 45387
tests: add test showing that merge state is not cleared by amend
This is slightly modified version of the test case I provided in
issue6304.
Differential Revision: https://phab.mercurial-scm.org/D8931
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 11 Aug 2020 13:43:43 +0530] rev 45386
requirements: introduce constants for `shared` and `relshared` requirements
We add them to `WORKING_DIR_REQUIREMENTS` too as they should be stored in
`.hg/requires` and have information about the type of working copy.
Differential Revision: https://phab.mercurial-scm.org/D8926
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:47:21 +0530] rev 45385
mergestate: replace `addmergedother()` with generic `addcommitinfo()` (API)
Storing that a file is resolved for the other parent while merging is just one
case of things we will like to store in the mergestate. There are more which we
will like to store.
This patch replaces `addmergedother()` with a much more generic
`addcommitinfo()`. Doing this, we also blinding stores the same key value pair
generated by the merge code instead of touching them.
Differential Revision: https://phab.mercurial-scm.org/D8923
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:38:45 +0530] rev 45384
merge: introduce `addcommitinfo()` on mergeresult object
This makes code little bit nicer as we directly update information in the
mergeresult object instead of building up a dict first and then setting it.
Differential Revision: https://phab.mercurial-scm.org/D8922
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:34:27 +0530] rev 45383
merge: use collections.defaultdict() for mergeresult.commitinfo
We will be storing info from mergeresult.commitinfo to mergestate._stateextras
in upcoming patches, let's make them use same structure so that we don't have to
make much efforts in transferring info from one to other.
Differential Revision: https://phab.mercurial-scm.org/D8921
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:29:02 +0530] rev 45382
mergestate: use _stateextras instead of merge records for commit related info
There is a set of information related to a merge which is needed on commit. We
want to store such information in the mergestate so that we can read it while
committing.
For this purpose, we are using merge records and introduced a merge
entry state for that. However this won't scale and is not clean way to implement
this.
This patch reworks the existing logic related to this to use _stateextras and
read from it.
Right now the information stored is not very descriptive but it will be in next
patch.
Using _stateextras also makes MERGE_RECORD_MERGED_OTHER useless and only to be
kept for BC.
Differential Revision: https://phab.mercurial-scm.org/D8920
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:09:44 +0530] rev 45381
mergestate: use collections.defaultdict(dict) for _stateextras
I want to use this _stateextras more in upcoming patches to store some commit
time related information. Using defaultdict will help in cleaner code around
checking whether a file exists or not.
Differential Revision: https://phab.mercurial-scm.org/D8919
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 23:41:50 -0700] rev 45380
hgweb: minimize scope of a try-block in staticfile()
I think the exceptions are only relevant for the `os.stat()` and
`open()` calls, and maybe to the `fh.read()` call.
Differential Revision: https://phab.mercurial-scm.org/D8936
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 23:38:50 -0700] rev 45379
hgweb: ignore web.templates config when guessing mime type for static content
Frozen binaries won't have a file-system path for static content, so
I'd like to remove dependence on that. From the documentation, it
seems like `mimetypes.guess_type()` only cares about the suffix, so I
think it should be enough to pass in just path under the
`web.templates` directory.
Differential Revision: https://phab.mercurial-scm.org/D8935
Martin von Zweigbergk <martinvonz@google.com> [Sat, 22 Aug 2020 16:03:44 -0700] rev 45378
hgweb: let staticfile() look up path from default location unless provided
This reduces duplication between the two callers.
Differential Revision: https://phab.mercurial-scm.org/D8934
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 22:40:05 -0700] rev 45377
hgweb: handle None from templatedir() equally bad in webcommands.py
The following paragraph is based just on my reading of the code; I
have not tried to test it.
Before my recent work on templates in frozen binaries, it seems both
`hgwebdir_mod.py` and `webcommands.py` would pass in an empty list
into `staticfile()` when running in a frozen binary. That would then
result in a variable in that function (`path`) not getting bound
before its first use. I then changed that without thinking in D8786 so
we passed a `None` value into the function, which made it break in
another way (trying to iterate over `None`). Then I tried to fix it up
in D8810, but I only changed `hgwebdir_mod.py` for some reason, and it
still doesn't actually work in frozen binaries (which seems fair,
since was broken before my changes too).
This patch just replicates the half-assed "fix" from D8810 in
`webcommands.py`, so they look more similar so I can start refactoring
them in the same way.
Differential Revision: https://phab.mercurial-scm.org/D8933
Martin von Zweigbergk <martinvonz@google.com> [Thu, 13 Aug 2020 10:37:25 -0700] rev 45376
posixworker: avoid creating workers that end up getting no work
If `workers` (the detected or configured number of CPUs) is greater
than the number of work items, then some of the workers end up getting
0 work items. Let's not create such workers.
Differential Revision: https://phab.mercurial-scm.org/D8927
Martin von Zweigbergk <martinvonz@google.com> [Mon, 10 Aug 2020 21:46:47 -0700] rev 45375
revert: remove dangerous `parents` argument from `cmdutil.revert()`
As we found out the hard way (thanks to spectral@ for figuring it
out!), `cmdutil.revert()`'s `parents` argument must be
`repo.dirstate.parents()` or things may go wrong. We had an extension
that passed in the target commit as the first parent. The `hg split`
command from the evolve extension seems to have made the same mistake,
but I haven't looked carefully.
The problem is that `cmdutil._performrevert()` calls
`dirstate.normal()` on reverted files if the commit to revert to
equals the first parent. So if you pass in `ctx=foo` and
`parents=(foo.node(), nullid)`, then `dirstate.normal()` will be
called for the revert files, even though they might not be clean in
the working copy.
There doesn't seem to be any reason, other than a tiny performance
benefit, to passing the `parents` around instead of looking them up
again in `cmdutil._performrevert()`, so that's what this patch does.
Differential Revision: https://phab.mercurial-scm.org/D8925
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 18:08:15 -0700] rev 45374
requirements: introduce a set of working directory specific requirements
Some requirements like the SPARSE_REQUIREMENT is working directory specific and
cannot be shared. We add a set which will contain all these requirements.
This is not the best we can do, I think having a rich requirement class will be
much better but that will be out of scope for this series.
Differential Revision: https://phab.mercurial-scm.org/D8924
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 16:37:59 +0530] rev 45373
localrepo: move requirements constant to requirements module
We now have a dedicated module for requirements constant, let's move the ones in
localrepo there.
Differential Revision: https://phab.mercurial-scm.org/D8918
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 16:24:12 +0530] rev 45372
requirements: introduce new requirements related module
It was not clear where all requirements should and related APIs should be, this
patch introduces a requirements module which will have all exitsing requirements
and related APIs.
Differential Revision: https://phab.mercurial-scm.org/D8917
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 15:48:17 +0530] rev 45371
repository: introduce constant for treemanifest requirement and use it
In future we will like to much cleaner logic around which requirement is for
working copy and which can go in store. To start with that, we first need to
de-clutter the requirement values spread around and replace them with constants.
Differential Revision: https://phab.mercurial-scm.org/D8916
Joerg Sonnenberger <joerg@bec.de> [Tue, 21 Jul 2020 22:13:54 +0200] rev 45370
tests: make flag parsing test more future safe
The revlog format contains a number of feature flags, e.g. if general
deltas are active. When testing that unknown flags are rejected, use
bits that are not immediately following the currently used bits.
Differential Revision: https://phab.mercurial-scm.org/D8782
Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Jul 2020 09:58:28 -0700] rev 45369
rename: add support for --at-rev, which marks as copy and removes the source
I had previously only added support for `--at-rev` to `hg cp`, but not
to `hg mv`. This patch adds that support. Just like for `hg cp`, it
marks the destination as copied from the source, and doesn't care if
the source file still exists (because it only supports the `-A` mode,
aka "don't touch files" mode). It works whether or not the source file
still exists. This matches the behavior of `hg mv -A` in the working
copy.
Differential Revision: https://phab.mercurial-scm.org/D8840
Kyle Lippincott <spectral@google.com> [Fri, 24 Jul 2020 15:03:14 -0700] rev 45368
tests: make test-install.t work on debian systems
Debian systems, at least as of their version of python3.8 on my machine, have
rewritten some logic in ensurepip to make it not use the wheels in pip._bundled,
but instead to use wheels installed in /usr/share/python-wheels. It copies these
wheels into the virtual environment when it's created, and installenv/bin/pip is
able to see them and use them, so it thinks that 'wheel' is installed, and that
it can build the mercurial wheel instead of just installing it. For some reason,
when it subprocesses to run `python3 setup.py bdist_wheel`, it setup.py does
*not* have the 'wheel' wheel available, and we get an error message.
Differential Revision: https://phab.mercurial-scm.org/D8813