Pulkit Goyal <7895pulkit@gmail.com> [Wed, 26 Aug 2020 17:20:53 +0530] rev 45459
merge: show list of bids for each file in bid-merge in ui.debug()
Earlier, we were showing the list of bids only when we were ambiguously picking.
However, the cases where we unambiguously picked a side may not always be
correct and need to be fixed.
Having list of bids for all files will be helpful in debugging.
Differential Revision: https://phab.mercurial-scm.org/D8966
Yuya Nishihara <yuya@tcha.org> [Mon, 14 Sep 2020 19:39:51 +0900] rev 45458
merge with stable
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Sep 2020 17:52:24 +0900] rev 45457
cmdutil: reimplement finddate() without using walkchangerevs()
It's simpler and slightly faster maybe because a fewer Python ops would
run.
Unscientific benchmark:
$ python -m timeit \
-s 'from mercurial import hg, ui, cmdutil; repo = hg.repository(ui.ui())' \
'cmdutil.finddate(repo.ui, repo, "<2008-01-01")'
(orig) 10 loops, best of 3: 1.45 sec per loop
(new) 10 loops, best of 3: 1.25 sec per loop
Now "hg churn" and "hg grep" are the only users of walkchangerevs(), which
I want to refactor and fix bugs.
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Sep 2020 18:14:51 +0900] rev 45456
test-simple-update: add test for -d DATE option
I couldn't find any tests for cmdutil.finddate() except for the abort case.
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Sep 2020 17:46:48 +0900] rev 45455
largefiles: walk history in ascending order while downloading all lfiles
I don't think the order matters. Maybe it's purely because of the use of
walkchangerevs(), which was originally designed for "hg log" command.
Surprisingly, the number of objects fetched in test-largefiles.t has changed.
According to the --verbose output, the order of the following fetches flipped
and the latter got deduplicated.
getting large3:
eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
found
eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
getting sub/large4:
eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
found
eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Sep 2020 17:43:19 +0900] rev 45454
largefiles: replace use of walkchangerevs() with simple revset query
Since it does nothing in prepare(), what we're doing is just walking
revisions matching ".hglf" in reverse order.
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 10:47:17 +0900] rev 45453
largefiles: remove unused 'rev' parameter from downloadlfiles()
It's no longer used since
83ead8cb0ff2 "largefiles: implement pull
--all-largefiles as a special case of --lfrev."
Martin von Zweigbergk <martinvonz@google.com> [Sat, 12 Sep 2020 11:18:12 -0700] rev 45452
resourceutil: document when we expect to take the importlib.resouces code path
Differential Revision: https://phab.mercurial-scm.org/D9018
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Sep 2020 22:00:00 -0700] rev 45451
templater: fix reading of templates in frozen binaries with py3 < 3.7
When using a frozen binary with py3 < 3.7, there's no
`importlib.resources` module, so we use the code path that reads the
resources from the file system. That code path expects bytes for
package name and resource name.
Differential Revision: https://phab.mercurial-scm.org/D9008
Martin von Zweigbergk <martinvonz@google.com> [Fri, 11 Sep 2020 09:35:49 -0700] rev 45450
histedit: cache description line
Navigating the curses-based histedit interface can be pretty slow
because it redraws everything whenever you make a change.
This patch simply replaces `@property` by `@util.propertycache` on the
`histeditrule.desc()` function so it's not re-calculated every time
the screen needs to be re-rendered. I timed it on an example of 30
simple commits, where I moved the top commit down 25 steps and then up
25 steps after. Before this patch, that (the whole `hg histedit`
invocation) took 11.6 s of CPU and after this patch it took 0.8 s).
Differential Revision: https://phab.mercurial-scm.org/D9016
Martin von Zweigbergk <martinvonz@google.com> [Fri, 11 Sep 2020 09:55:08 -0700] rev 45449
tests: make emacs test less strict
It was failing like this for me:
```
@@ -2,7 +2,7 @@
$ emacs -q -no-site-file -batch -l $TESTDIR/../contrib/hg-test-mode.el \
> -f ert-run-tests-batch-and-exit
Running 1 tests (*) (glob)
- passed 1/1 hg-test-mode--compilation-mode-support
+ passed 1/1 hg-test-mode--compilation-mode-support (0.045732 sec)
- Ran 1 tests, 1 results as expected (*) (glob)
+ Ran 1 tests, 1 results as expected, 0 unexpected (2020-09-11 16:49:56+0000, 0.046034 sec)
```
Differential Revision: https://phab.mercurial-scm.org/D9017
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Sep 2020 13:12:34 -0700] rev 45448
graphlog: use '%' only if there are *unresolved* conflicts
In
14d0e89520a2, I made graphlog use '%' for the "other" context when
there's an existing merge state. However, that has confused many
people because it shows up even if all conflicts are already resolved,
which makes it show up even after e.g. `hg update -m` with
automatically resolved conflicts. This patch makes it so we show the
'%' only if there still unresolved conflicts.
This patch replaces my earlier attempt in D8930, where I decided to
automatically clear the mergestate if there are no remaining
conflicts. That had the problem that it wouldn't let the user
re-resolve the conflicts using `hg resolve`.
Note that an in-progress "proper" merge (one that will result in a
commit with two parents, such as after `hg merge`) will already have
two dirstate parents before the commit happens. That means that both
sides of the merge will get drawn as '@' in the graph, since "is
dirstate parent" takes precedence over "is involved in merge
conflict".
Differential Revision: https://phab.mercurial-scm.org/D9007
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 26 Aug 2020 17:24:22 +0530] rev 45447
merge: show number of ancestors in bid merge debug notes
A good number of times, we don't generate an action for a file in
manifestmerge() which can result in bid merge doing the wrong thing.
Mentioning the number of ancestors from which we are bidding will help spot such
cases where we are not returning an action.
Differential Revision: https://phab.mercurial-scm.org/D8967
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Sep 2020 14:45:16 +0530] rev 45446
debugmergestate: sort extras before printing
Prevents flaky output.
Differential Revision: https://phab.mercurial-scm.org/D8986
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 24 Aug 2020 18:59:19 +0530] rev 45445
debugmergestate: show extras for files which are not in mergestate
With recent changes and future changes, we will like to store extras information
about files which were merged automatically. Hence, we will have merge extras
for files which are not in the mergestate.
Differential Revision: https://phab.mercurial-scm.org/D8942
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 10 Sep 2020 16:51:40 +0530] rev 45444
tests: update lockdelay.py to handle the `wait` argument
Spotted by a future change.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Sep 2020 14:14:04 +0530] rev 45443
commit: pass mergestate into _filecommit() instead of re-reading it
mergestate reading although cheap is not free. Let's read mergestate once on top
and pass it into `_filecommit()`.
In upcoming patches, we will be reading mergestate more in `_filecommit()`.
Differential Revision: https://phab.mercurial-scm.org/D8984
Sushil khanchi <sushilkhanchi97@gmail.com> [Fri, 11 Sep 2020 13:04:05 +0530] rev 45442
py3: fix bytes and str mixup in run-tests
Differential Revision: https://phab.mercurial-scm.org/D9009
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 17 Aug 2020 10:59:30 +0200] rev 45441
hg-core: fix some `clippy` warnings
Differential Revision: https://phab.mercurial-scm.org/D8957
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 17 Aug 2020 16:55:43 +0200] rev 45440
rhg: print error message when argument parsing fails
Differential Revision: https://phab.mercurial-scm.org/D8956
Antoine Cezar <antoine.cezar@octobus.net> [Thu, 13 Aug 2020 16:36:42 +0200] rev 45439
rhg: fix `clippy` warnings
Differential Revision: https://phab.mercurial-scm.org/D8955
Antoine Cezar <antoine.cezar@octobus.net> [Tue, 04 Aug 2020 16:11:23 +0200] rev 45438
rhg: pass `ui` to `Command` `run`
Allow implementation of `From<clap::ArgMatches> for Command`
Differential Revision: https://phab.mercurial-scm.org/D8954
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 03 Aug 2020 11:55:59 +0200] rev 45437
rhg: add harness tests for rhg files
Differential Revision: https://phab.mercurial-scm.org/D8873
Raphaël Gomès <rgomes@octobus.net> [Thu, 30 Jul 2020 16:55:44 +0200] rev 45436
rhg: make output of `files` relative to the current directory and the root
This matches the behavior of `hg files`.
The util is added in `hg-core` instead of `rhg` because this operation could
be useful for other external tools. (this was definitely not prompted by rust
issue #50784, I swear)
Differential Revision: https://phab.mercurial-scm.org/D8872
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 08 Sep 2020 19:36:40 +0530] rev 45435
tags: take lock instead of wlock before writing hgtagsfnodes1 cache
This cache is shared across stores and hence we should take store lock before
writing to it. Otherwise there will be race where one share with wlock is
writing to this cache and other share with wlock is trying to read it
simultaneously.
Differential Revision: https://phab.mercurial-scm.org/D9001
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 10 Sep 2020 13:37:35 +0530] rev 45434
statichttprepo: use LockUnavailable() instead of Abort() for lock (API)
If we try to get a lock on statichttprepo, we get `error.Abort()` instead of
subclass of `error.LockError()`. The callers which catches `error.LockError`
fails to catch this case as the correct error is not raised.
Raising `error.LockUnavaible()` is same as what is done for wlock also.
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 08 Sep 2020 18:46:01 +0530] rev 45433
localrepo: warn if we are writing to cache without a lock
From quite sometime we have two types of cache, `cache` and `wcache`. The later
one is a working copy cache and the first one is a store cache.
Let's add a check for warning if we are missing store lock while writing to
these caches.
This is inspired from some tag cache breakage which is observed when multiple
shares are in play.
The interesting part is that although we are still taking wlock to write store
caches at many places, but still the test pases.
Differential Revision: https://phab.mercurial-scm.org/D9000
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Sep 2020 14:14:40 +0530] rev 45432
commit: fix a wrong argument name in documentation
Differential Revision: https://phab.mercurial-scm.org/D8985
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 10 Sep 2020 17:03:38 +0530] rev 45431
git: remove unrequired assignment of listignored and listunknown
Caught by test-check-pyflakes.t
Yuya Nishihara <yuya@tcha.org> [Wed, 09 Sep 2020 11:41:18 +0900] rev 45430
grep: fix hash(linestate) to not include linenum
linestate.__eq__() just compares the line values whereas __hash__() does
hash both self.line and self.linenum, which violates the rule. __hash__()
was added at
fb502719c75c, "python 2.6 compatibility: add __hash__ to
classes that have __eq__" with no additional remarks, so this would probably
be a simple mistake.
The test output changed because difflib.SequenceMatcher() internally uses
a dict. As you can see, the line "export" is unchanged at the revision 2,
so the new output is correct.
Yuya Nishihara <yuya@tcha.org> [Tue, 08 Sep 2020 21:38:10 +0900] rev 45429
test-grep: document that trivially moved lines might not be detected
I'm not going to fix this. I just learned "grep --diff" does clever thing
than a simple grep(patch.diff(context=0)), and I think it's better to
document how things work.
Yuya Nishihara <yuya@tcha.org> [Wed, 09 Sep 2020 11:51:51 +0900] rev 45428
revset: remove indirect indexing of status tuple
Just use the attribute name.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 25 Aug 2020 23:18:42 -0400] rev 45427
rewriteutil: relax the sha1 hash references to handle future hash types
Per discussion with nbjoerg in IRC.
Differential Revision: https://phab.mercurial-scm.org/D8951
Matt Harbison <matt_harbison@yahoo.com> [Mon, 24 Aug 2020 18:51:25 -0400] rev 45426
phabricator: update the hashes in commit messages as they get submitted
Due to the sequence of actions (posting, amending the local commit, and then
updating the Differential properties), the message in the commit is updated on
the initial send but the message displayed in Phabricator is not. It should get
updated there if the review is reposted. The data in the Commits tab is
accurate for the first `phabsend`.
Differential Revision: https://phab.mercurial-scm.org/D8950
Matt Harbison <matt_harbison@yahoo.com> [Mon, 24 Aug 2020 18:44:15 -0400] rev 45425
rewriteutil: also consider pending obsoletes when updating hashes in messages
Phabricator builds up the replacement commits and mapping in a single
transaction, and then finalizes everything once the commits have been rewritten.
That's too late when trying to update the messages for those commits.
I'm a little concerned that this isn't a generic enough interface, since it
doesn't mimic the list of list return of `obsutil.successorssets()`. But this
is the type of mapping that phabricator maintains, and I don't think the methods
that would be interested in calling this need to worry about split and
divergence. We can fix that later if the need arises.
Differential Revision: https://phab.mercurial-scm.org/D8949
Matt Harbison <matt_harbison@yahoo.com> [Mon, 24 Aug 2020 12:43:53 -0400] rev 45424
rewriteutil: extract evolve code used to replace obsolete hashes in commits
The evolve command uses it, but there are core things like `phabsend` and
`rebase` that would also benefit.
Differential Revision: https://phab.mercurial-scm.org/D8948
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 17:16:16 -0400] rev 45423
git: fix index handling of removed files during commit (
issue6398)
Other changes in this series also changed the behavior here in
positive ways, but this was the final step that actually fixed things.
Differential Revision: https://phab.mercurial-scm.org/D8999
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 17:14:59 -0400] rev 45422
git: make dirstate actually support listclean parameter
As far as I can tell listignored and listunknown should already
work. I'm vexed that there doesn't seem to be a way to get clean files
out of the pygit2 status method, but this at least makes things work
better.
Differential Revision: https://phab.mercurial-scm.org/D8998
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 17:13:45 -0400] rev 45421
git: make dirstate status() respect matcher
As with other changes in this stack, we appear to have been getting
lucky in the past. An upcoming change behaved _very_ oddly without
this fix.
Differential Revision: https://phab.mercurial-scm.org/D8997
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 17:12:29 -0400] rev 45420
git: fix up dirstate use of index
This was super-broken before, and somehow none of the existing
attempts to use this code tripped on the defects here. Sigh.
Differential Revision: https://phab.mercurial-scm.org/D8996
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 16:27:12 -0400] rev 45419
git: correctly handle "nothing changed" commits
I guess localrepo.commit() actually returns an Optional[node], which
is a bit of a surprise to me.
Differential Revision: https://phab.mercurial-scm.org/D8995
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 16:25:16 -0400] rev 45418
localrepo: use functools.wraps() in unfilteredmethod decorator
This makes it easier to figure out what function you're holding on to
when doing printf-style debugging.
Differential Revision: https://phab.mercurial-scm.org/D8994
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 16:13:10 -0400] rev 45417
git: actually copy treemanifest instances in .copy() (
issue6398)
The implementation here is so simple I honestly have no idea why I
didn't do it at the time. Hopefully there's not some nuance past-me
forgot to write down.
Differential Revision: https://phab.mercurial-scm.org/D8993
Yuya Nishihara <yuya@tcha.org> [Fri, 11 Sep 2020 14:41:05 +0900] rev 45416
log: fix crash and bad filematcher lookup by -fr'wdir()' PATH
"-fr'wdir()' ADDED-PATH" is still wrong, which will be fixed in default
branch.
Augie Fackler <augie@google.com> [Wed, 09 Sep 2020 14:48:55 -0400] rev 45415
hgdemandimport: bypass demandimport for _ast module (
issue6407)
This is broken on Python 3.9rc1, and while it sounds like there may be
a fix in Python, we probably also should have this workaround in place
in hg. See the bug for more details (including on bugs at redhat and
b.p.o).
Differential Revision: https://phab.mercurial-scm.org/D9004
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 15:46:56 -0400] rev 45414
git: restore basic functionality after
b3040b6739ce
We don't yet have a formal interface for the changelog, but it's
mostly specified. Sadly,
b3040b6739ce added a semi-private pseudo-enum
that we need to cope with, so it's probably high time that someone
(me?) attempts to define that interface to prevent future backsliding.
Differential Revision: https://phab.mercurial-scm.org/D8992
Augie Fackler <raf@durin42.com> [Mon, 07 Sep 2020 15:31:34 -0400] rev 45413
git: convert tz offset to int (
issue6359)
Differential Revision: https://phab.mercurial-scm.org/D8991
Matt Harbison <matt_harbison@yahoo.com> [Fri, 04 Sep 2020 15:21:02 -0400] rev 45412
repoview: pin revisions for `local` and `other` when a merge is active
I've hit this a couple of times, where pulling with a dirty `wdir` obsoletes
`p1` and updating to the successor results in merge conflicts. The problem was
resolving them failed immediately, complaining that the old checkout was
filtered.
The change in `test-rebase-obsolete.t` is because there's an outstanding merge
conflict in a rebase operation. The summary prompt to merge seems incorrect for
this scenario, but that's an existing issue.
Differential Revision: https://phab.mercurial-scm.org/D8980
Augie Fackler <augie@google.com> [Mon, 07 Sep 2020 15:20:31 -0400] rev 45411
merge with stable
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 02 Sep 2020 19:46:55 +0530] rev 45410
extdiff: refactor cmdline and gui calculation login in a separate fn
This is some good logic with handling of many config items and various ways of
specifying it. I want to reuse in `diff --tool` and hence refatcored it in a
separate function of it's own.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 02 Sep 2020 19:17:31 +0530] rev 45409
extdiff: reorder an if-else conditional
This brings continue part on top and will help in next patch where we will like
to introduce utility functions for rest of the code.
Sushil khanchi <sushilkhanchi97@gmail.com> [Wed, 02 Sep 2020 23:09:45 +0530] rev 45408
run-tests: extract logic to get errpath in a utility func
Differential Revision: https://phab.mercurial-scm.org/D8979
Sushil khanchi <sushilkhanchi97@gmail.com> [Sat, 22 Aug 2020 16:31:34 +0530] rev 45407
run-tests: refactor filtering logic for --retest flag
How I got to this:
While re-running failed tests using --retest I noticed that the output:
"running x tests using y parallel processes".
was not actually correct, because x was the total number of tests present
in the directory, but it should be the number of failed tests. Although
it would run only the failed tests and later will say that remaining tests
were skipped.
Changes in test files reflect the fixed behaviour.
This patch change and move the logic for filtering failed test for
--retest option and make sure that we create instances of
class Test only for the tests we need to run.
As mentioned in the deleted text (in this patch itself) the logic
for --retest should be outside of TestSuite.
Differential Revision: https://phab.mercurial-scm.org/D8938
Sushil khanchi <sushilkhanchi97@gmail.com> [Thu, 27 Aug 2020 12:24:57 +0530] rev 45406
tests: add a --retest test to demonstrate a fix in next patch
As you see above the added lines, there was only one test failed.
So the output should be:
"running 1 tests using 1 parallel processes"
Next patch will be fixing this.
Differential Revision: https://phab.mercurial-scm.org/D8964
Sushil khanchi <sushilkhanchi97@gmail.com> [Thu, 27 Aug 2020 12:21:24 +0530] rev 45405
tests: remove a sub-test since we are done with it in test-run-tests.t
removing test-failure.t to make sure that in next patch when
we re-run failed tests using --retest, it won't get considered
unnecessarily.
Differential Revision: https://phab.mercurial-scm.org/D8963
Joerg Sonnenberger <joerg@bec.de> [Tue, 21 Jul 2020 22:41:45 +0200] rev 45404
storageutil: allow modern hash sizes for fileids
Differential Revision: https://phab.mercurial-scm.org/D8783
Matt Harbison <matt_harbison@yahoo.com> [Tue, 01 Sep 2020 22:28:41 -0400] rev 45403
registrar: fix a documentation typo
Differential Revision: https://phab.mercurial-scm.org/D8976
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 10 Aug 2020 15:50:22 +0200] rev 45402
documentation: add `zstd` compression to the internal `revlogs` documentation
Differential Revision: https://phab.mercurial-scm.org/D8953
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Aug 2020 14:35:18 +0530] rev 45401
extdiff: move single file handling inside `not per-file` conditional
If `--per-file` is passed, we will diffing files one by one, hence there is no
need to make this optimization around single file in that case. This
optimization is only required when `--per-file` is not passed and we will be
opening directory-diff for a single file.
Differential Revision: https://phab.mercurial-scm.org/D8971
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Aug 2020 14:32:26 +0530] rev 45400
extdiff: remove dir2root and pass full path as dir2 in _runperfilediff()
The only use of `dir2root` was to join with `dir2` to generate the path for
other side of diff. Like in previous patch, `dir1a` and `dir1b` are full paths
and no longer base names, hence we pass `dir2` as full path too and making
`dir2root` unrequired.
Differential Revision: https://phab.mercurial-scm.org/D8970
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Aug 2020 14:28:34 +0530] rev 45399
extdiff: pass full paths of `dir1a` and `dir1b` to `_runperfilediff()`
Earlier we were passing basename instead of the fullpath and then joining with
the tmproot. This is wrong because the user can choose `rev1a` as wdir and in
those cases, tmproot should not be joined with the path.
I am working on refactoring extdiff logic so that we can have options like `diff
--tool` and encountered this. Although this patch in itself makes no difference,
however in future when a new caller of `_runperfilediff()` will be added, it
will be useful to directly pass on the full paths instead.
Differential Revision: https://phab.mercurial-scm.org/D8969
Harald Klimach <harald@klimachs.de> [Wed, 02 Sep 2020 12:31:37 +0200] rev 45398
hgweb: compatibility of hgweb.cgi template with Python 3
When running Mercurial on Python 3 hgweb expects the config variable to be a
bytestring.
The solution proposed by Anton Shestakov is to use a byteprefix to the literal
string defined cgi script as provided in this patch for hgweb.cgi,
contrib/hgweb.fcgi and contrib/hgweb.wsgi.
I am not sure whether this covers all relevant templates, but I couldn't find
others.
Differential Revision: https://phab.mercurial-scm.org/D8978
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
Antoine Cezar <antoine.cezar@octobus.net> [Fri, 24 Jul 2020 10:34:04 +0200] rev 45367
rhg: handle broken pipe error for stderr
Differential Revision: https://phab.mercurial-scm.org/D8871
Antoine Cezar <antoine.cezar@octobus.net> [Fri, 24 Jul 2020 17:24:10 +0200] rev 45366
rhg: extract function handle_stdout_error
Avoid repeating the logic of handling stdout write errors.
Differential Revision: https://phab.mercurial-scm.org/D8870
Antoine Cezar <antoine.cezar@octobus.net> [Fri, 17 Jul 2020 17:24:54 +0200] rev 45365
rhg: add a limited `rhg files` subcommand
Differential Revision: https://phab.mercurial-scm.org/D8869
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 10:21:17 +0200] rev 45364
rhg: add a `Files` `Command` to prepare the `rhg files` subcommand
Differential Revision: https://phab.mercurial-scm.org/D8868
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 15:49:44 +0200] rev 45363
rhg: simplify `FindRootError` handling
Differential Revision: https://phab.mercurial-scm.org/D8867
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 10:26:17 +0200] rev 45362
rhg: add buffered stdout writing possibility
Improve batch stdout writing performance.
At some point line buffered output should be introduced.
Differential Revision: https://phab.mercurial-scm.org/D8866
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 20 Jul 2020 18:14:52 +0200] rev 45361
rhg: ask the error message from `CommandError`
Avoid repeating the display of the same error messages in different commands.
Differential Revision: https://phab.mercurial-scm.org/D8865
Antoine Cezar <antoine.cezar@octobus.net> [Tue, 21 Jul 2020 10:39:30 +0200] rev 45360
rhg: Do not return error when when we really mean ok in commands
Before when a command was successfull `Err(CommandErrorKind::Ok.into())` was
returned which is an oxymoron. Using `Ok(())` when everything is ok seems more
appropriate.
Differential Revision: https://phab.mercurial-scm.org/D8864
Antoine Cezar <antoine.cezar@octobus.net> [Sat, 08 Aug 2020 12:52:39 -0700] rev 45359
hg-core: define a `ListTrackedFiles` `Operation`
List files under Mercurial control in the working directory.
Differential Revision: https://phab.mercurial-scm.org/D8863
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 10:08:09 +0200] rev 45358
hg-core: remove the `Operation` trait
There is no way to currently define a trait which can both return references
to `self` and to passed data, which is what we would need.
Generic Associated Types may fix this and allow us to have a unified interface.
See: rust #44265
Differential Revision: https://phab.mercurial-scm.org/D8862
Antoine Cezar <antoine.cezar@octobus.net> [Tue, 04 Aug 2020 10:59:43 +0200] rev 45357
hg-core: make parse_dirstate return references rather than update hashmaps
Returing a vec is faster than updating a hashmap when the hashmap is not needed
like in `hg files` which just list tracked files.
Returning references avoid copying data when not needed improving performence
for large repositories.
Differential Revision: https://phab.mercurial-scm.org/D8861
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 18:01:48 +0530] rev 45356
repository: introduce constant for internal phase repo 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/D8912
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 10:06:32 -0700] rev 45355
repository: introduce constant for sparse repo 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/D8911
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 16:02:13 +0530] rev 45354
localrepo: refactor `.hg/requires` reading logic in separate function
In an upcoming patch, we will be reusing this to read `.hg/store/requires`, so
let's separate it in a different function before.
Differential Revision: https://phab.mercurial-scm.org/D8910
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 15:52:52 +0530] rev 45353
localrepo: refactor logic to calculate sharedvfs in separate fn
We will be reusing this in an upcoming patch, so better to refactor it into a
separate function. Also the underlying handling deserves a function of it's own.
Differential Revision: https://phab.mercurial-scm.org/D8909
Cédric Krier <ced@b2ck.com> [Sun, 02 Aug 2020 17:40:35 +0200] rev 45352
keepalive: Do not append _rbuf if _raw_readinto exists (
issue6356)
The readline method append to the chunks the content of the _rbuf then there
is a loop that call _raw_read which on Python3 call readinto. But the readinto
version in mercurial append again the _rbuf content. So this creates the
duplicate content. This does not happen in Python2 because _raw_read does not
call readinto.
Differential Revision: https://phab.mercurial-scm.org/D8859
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 10:13:37 -0700] rev 45351
store: refactor space delimited list to proper data structure
There is no good reason why are having a space delimited list and then using
`.split()` to get the actual list. Let's convert this into a proper collection.
Differential Revision: https://phab.mercurial-scm.org/D8908
Martin von Zweigbergk <martinvonz@google.com> [Fri, 07 Aug 2020 21:59:43 -0700] rev 45350
makefile: stop setting unused HGEXTDIR variable during osx build
The variable was added in
a38ed42cd23c (osx: include chg by default,
2017-03-20), but I can't find any others references to the variable in
that commit or in any other commits.
Differential Revision: https://phab.mercurial-scm.org/D8915
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 06 Aug 2020 13:51:43 +0530] rev 45349
merge: drop commitinfo argument to applyupdates (API)
We now pass the mergeresult object and hence there is no need to have a separate
commitinfo argument as the required info is present in mergeresult object.
Differential Revision: https://phab.mercurial-scm.org/D8904
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 06 Aug 2020 13:27:38 +0530] rev 45348
merge: remove emptyactions() and use collections.defaultdict(list) instead
emptyactions() used to return a dict which was populated and passed into
applyupdates(). However, with recent changes, we no longer pass a plain dict,
instead we pass the mergeresult object.
There was only one usage of emptyactions and that too inside mergeresult object.
That usage is replaced with collections.defaultdict(list) instead.
Not sure why we were not using collections.defaultdict(list) from the beginning.
Differential Revision: https://phab.mercurial-scm.org/D8903
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 16:52:51 +0530] rev 45347
merge: pass mergeresult obj in _forgetremoved() (API)
Instead of returning a dict of actions and then updating it, let's pass the
object directly and update it there.
This makes `updateactions()` on mergeresult unused and this patch removes that.
After this patch, we have couple of methods left on mergeresult class which
still exposes the internal dict based action storage.
Differential Revision: https://phab.mercurial-scm.org/D8889
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 16:00:25 +0530] rev 45346
mergeresult: introduce filemap() which yields filename based mapping
We wanted to remove `actions` as this was leaking how we store things internally
and was direct access to one of the member. This introduces filemap() which
yields a map of `filename` -> `action, args, msg`.
`mergeresult.actions` has been deleted as it's no longer required.
Differential Revision: https://phab.mercurial-scm.org/D8888
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 15:41:23 +0530] rev 45345
mergeresult: add `files()` and use it
`files()` will return a list of files on which an action needs to be performed.
This is a step to stop exposing the underlying map to the user of this object.
Differential Revision: https://phab.mercurial-scm.org/D8887
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 15:37:26 +0530] rev 45344
mergeresult: introduce getfile() and use it where required
We want to hide the underlying dictionary from the users and provide API for
valid and sane use cases.
Differential Revision: https://phab.mercurial-scm.org/D8886
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 14:03:59 +0530] rev 45343
merge: use ACTION_* constants instead of values in _filternarrowactions()
It makes easier to check what noconflicttypes are and which are not included.
I hope we can have a state where we always use ACTION_* constants instead of
these values which are very hard to understand.
Differential Revision: https://phab.mercurial-scm.org/D8885
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 13:50:49 +0530] rev 45342
merge: rework iteration over mergeresult object in checkpathconflicts()
Instead of following pattern:
```
for f, (m, args, msg) in mresult.actions.items():
if m == mergestatemod.ACTION_*:
...
elif m == mergestatemod.ACTION_*:
...
....
```
We do:
```
for (f, args, msg) in mresult.getaction((mergestatemod.ACTION_*,)):
...
for (f, args, msg) in mresult.getaction((mergestatemod.ACTION_*,)):
...
....
```
This makes code bit easier to understand and prevent iterating over actions
which we don't need.
Differential Revision: https://phab.mercurial-scm.org/D8884
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 13:21:06 +0530] rev 45341
applyupdates: simplfy calculation of number of updated files
Instead of increasing the `updated` variable each time in a loop, let's use the
mergeresult object API to calculate the updated value in one call.
Differential Revision: https://phab.mercurial-scm.org/D8883
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 18:08:37 +0530] rev 45340
mergeresult: yield from getactions() instead of buidling a list and returning
Only 7 out of 29 callers change the underlying dict while iterating. So it's
better to yield and wrap the 7 callers with `list()`.
Differential Revision: https://phab.mercurial-scm.org/D8882