Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 Mar 2021 12:08:46 -0700] rev 46801
rebase: skip obsolete commits even if they have pruned successors
Issue 5782 reported that `hg rebase -r <obsolete commit with pruned
successor>` failed with an error saying that it would cause
divergence. Commit
b7e2cf114e85 (rebase: do not consider extincts for
divergence detection (
issue5782), 2018-02-09) fixed it by letting you
rebase the commit. However, that fix seems inconsistent with how we
handle `hg rebase -r <pruned commit>`. To me, it should make no
difference whether a commit is pruned itself or if it has (only)
pruned successors. This patch changes it so we treat these two kinds
of commits the same way. I let the message we print remain "note: not
rebasing <commit>, it has no successor" even though that last part is
not technically correct for commits with pruned successors. I doubt it
will confuse users.
Differential Revision: https://phab.mercurial-scm.org/D10240
Joerg Sonnenberger <joerg@bec.de> [Sat, 20 Mar 2021 00:37:57 +0100] rev 46800
tests: ask any chg instance to terminate before looking at sqlite dbs
There are spurious errors in CI where the database is still locked, so
force the daemon to quit to get deterministic behavior. Since the kill
command itself is racy, also sleep 2s to give the server time to wake up
and exit.
Differential Revision: https://phab.mercurial-scm.org/D10244
Joerg Sonnenberger <joerg@bec.de> [Sat, 20 Mar 2021 00:36:43 +0100] rev 46799
chg: kill trailing comma in SEE ALSO
Differential Revision: https://phab.mercurial-scm.org/D10243
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 Mar 2021 23:16:09 -0700] rev 46798
bisect: use standard one-line commit summary
This makes bisect use the standardized support for one-line commit
summary I added a while back. That means that it will respect the
`command-templates.oneline-summary` config. If also means that the
default output now includes the first line of the commit message (see
test impact).
Differential Revision: https://phab.mercurial-scm.org/D10245
Simon Sapin <simon.sapin@octobus.net> [Fri, 19 Mar 2021 13:18:53 +0100] rev 46797
rhg: Add more conversions between error types
This allows using the `?` operator in more places, as the next commit does.
Differential Revision: https://phab.mercurial-scm.org/D10238
Joerg Sonnenberger <joerg@bec.de> [Fri, 19 Mar 2021 23:51:46 +0100] rev 46796
tests: resort to fix test with newer git versions
Differential Revision: https://phab.mercurial-scm.org/D10242
Joerg Sonnenberger <joerg@bec.de> [Fri, 19 Mar 2021 23:34:29 +0100] rev 46795
git: fix missing case from
6266d19556ad (introduction of nodeconstants)
Differential Revision: https://phab.mercurial-scm.org/D10241
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Mar 2021 18:24:59 -0400] rev 46794
merge with stable
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Mar 2021 02:09:23 -0500] rev 46793
typing: rewrite a conditional assignment to unconfuse pytype
Otherwise, pytype and PyCharm flags it:
File "/mnt/c/Users/Matt/hg/mercurial/localrepo.py", line 2903, in wlock: No attribute 'held' on _weakref.ReferenceType[nothing] [attribute-error]
In Optional[Union[Any, _weakref.ReferenceType[nothing]]]
File "/mnt/c/Users/Matt/hg/mercurial/localrepo.py", line 2904, in wlock: No attribute 'lock' on _weakref.ReferenceType[nothing] [attribute-error]
In Optional[Union[Any, _weakref.ReferenceType[nothing]]]
Differential Revision: https://phab.mercurial-scm.org/D10215
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Mar 2021 02:07:34 -0500] rev 46792
typing: add assertions to localrepo.py to appease pytype
Differential Revision: https://phab.mercurial-scm.org/D10214
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 21:19:17 -0500] rev 46791
obsutil: maintain a homogenous list when computing successors
In practice, this wasn't a problem because of an internal check for an empty
list, but it avoids the following pytype error:
File "/mnt/c/Users/Matt/hg/mercurial/obsutil.py", line 823, in successorsandmarkers: No attribute 'markers' on List[nothing] [attribute-error]
In Union[Any, List[nothing], _succs]
Differential Revision: https://phab.mercurial-scm.org/D10213
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 23:28:56 -0500] rev 46790
typing: add an assertion to verify.py to appease pytype
Differential Revision: https://phab.mercurial-scm.org/D10212
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 20:25:12 -0500] rev 46789
typing: add an assertion to mercurial/hgweb/webcommands.py to help pytype
I have no idea why this is needed, given the check immediately above. But
without it, I'm getting this:
File "/mnt/c/Users/Matt/hg/mercurial/hgweb/webcommands.py", line 1164, in filelog: Missing parameter 'toline' in call to function mercurial.dagop.blockdescendants [missing-parameter]
Expected: (fctx, fromline, toline)
Actually passed: (fctx, fromline)
File "/mnt/c/Users/Matt/hg/mercurial/hgweb/webcommands.py", line 1166, in filelog: Missing parameter 'toline' in call to function mercurial.dagop.blockancestors [missing-parameter]
Expected: (fctx, fromline, toline, followfirst)
Actually passed: (fctx, fromline)
Differential Revision: https://phab.mercurial-scm.org/D10211
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 19:02:07 -0500] rev 46788
crecord: null out the curses attribute with `None` on failure to import
Pytype got really confused that this could be `Union[module, bool]`, and spewed
about tons of attributes that are not available on `bool`.
Differential Revision: https://phab.mercurial-scm.org/D10210
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Mar 2021 00:41:37 -0500] rev 46787
typing: fix directives mangled by black
Differential Revision: https://phab.mercurial-scm.org/D10209
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Mar 2021 00:40:46 -0500] rev 46786
typing: disable module attribute warnings for properly conditionalized code
Differential Revision: https://phab.mercurial-scm.org/D10208
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Mar 2021 00:38:59 -0500] rev 46785
typing: disable import error warnings that are already handled
I'm assuming that the cffi ones are handled somewhere, but the others definitely
are.
Differential Revision: https://phab.mercurial-scm.org/D10207
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 17:22:35 -0500] rev 46784
typing: disable a few errors when accessing Windows specific attributes
This is already guarded with conditionals. The entire win32 module is
conditionally loaded.
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 162, in <module>: No attribute 'winstdout' on module 'mercurial.posix' [module-attr]
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 163, in <module>: No attribute 'winstdout' on module 'mercurial.posix' [module-attr]
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 174, in <module>: No attribute 'winstdout' on module 'mercurial.posix' [module-attr]
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 175, in <module>: No attribute 'winstdout' on module 'mercurial.posix' [module-attr]
Differential Revision: https://phab.mercurial-scm.org/D10206
Matt Harbison <matt_harbison@yahoo.com> [Fri, 12 Mar 2021 16:55:18 -0500] rev 46783
typing: disable a few errors calling py3.7+ functions in resourceutil.py
There's a graceful fallback when these methods are unavailable.
Differential Revision: https://phab.mercurial-scm.org/D10205
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 02 Mar 2021 00:05:22 +0100] rev 46782
test-copies: add a test updating file content while merging a pure overwrite
As the current test misbehavior show, this confuse various part of the code:
- the committed file is different depending of the commit source,
- the upgrade code compute the wrong information on this changeset.
This will be fixed in upcoming patches.
Differential Revision: https://phab.mercurial-scm.org/D10087
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 10 Mar 2021 13:08:41 +0530] rev 46781
mergestate: don't pop stateextras when there are no conflicts on filemerge
Even if `filemerge.filemerge()` didn't result in conflicts, we should not remove
stateextras for a file since we now use that for more things than just merge
time information. We use stateextras to store information which is required to
be used by commit.
I tracked this down while finding why a patch of mine which adds more commit
related information does not work as expected and looses the extras in
mergestate.
Differential Revision: https://phab.mercurial-scm.org/D10148
Joerg Sonnenberger <joerg@bec.de> [Wed, 13 Jan 2021 16:14:58 +0100] rev 46780
node: introduce nodeconstants class
In preparing for moving from SHA1 hashes to a modern hash function,
place nullid and other constant magic vules in a class. Provide the
active set of constants in the repository and push it down. Provide
nullid directly in strategic places like the repository as it is
accessed very often. This changeset introduces the API change, but not
the mechanical replacement of the node.py attributes itself.
Differential Revision: https://phab.mercurial-scm.org/D9750
Joerg Sonnenberger <joerg@bec.de> [Wed, 10 Mar 2021 18:09:21 +0100] rev 46779
revlog: guarantee that p1 != null if a non-null parent exists
This change does not affect the hashing (which already did this
transformation), but can change the log output in the rare case where
this behavior was observed in repositories. The change can simplify
iteration code where regular changesets and merges are distinct
branches.
Differential Revision: https://phab.mercurial-scm.org/D10150
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 05:50:20 +0100] rev 46778
push: allow to specify multiple destinations
I end up needing that on a regular basis and it turn out to be very simple to
implement. See documentation and test for details.
Differential Revision: https://phab.mercurial-scm.org/D10161
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 17 Mar 2021 15:20:45 +0100] rev 46777
push: indent the some part of the command
That code will be put in a loop in the next changeset, pre-indenting make the
next change clearer.
Differential Revision: https://phab.mercurial-scm.org/D10160
Joerg Sonnenberger <joerg@bec.de> [Sun, 08 Nov 2020 20:17:09 +0100] rev 46776
bundle: optional multithreaded compression, ATM zstd-only
Compression type can be a huge chunk of "hg bundle", especially when
using the higher compression levels. With level=22 and threads=7, the
NetBSD test repository took 28:39 wall time and 157:47 user time.
Before, level=22 would take 129:20 wall time and 129:07 user time.
Differential Revision: https://phab.mercurial-scm.org/D9283
Simon Sapin <simon.sapin@octobus.net> [Sat, 13 Mar 2021 08:59:03 +0100] rev 46775
rust: Preallocate the returned `Vec` in `utils::files::relativize_path`
Profiling `rhg files > /dev/null` on an old snapshot of mozilla-central
(with `perf` and the Firefox Profiler:
https://github.com/firefox-devtools/profiler/blob/main/docs-user/guide-perf-profiling.md)
showed non-trivial time spend in this function and in `realloc`.
This change makes the wall-clock time for that process on my machine
go from ~190 ms to ~150 ms.
Differential Revision: https://phab.mercurial-scm.org/D10199
Augie Fackler <augie@google.com> [Tue, 01 Dec 2020 12:59:33 -0500] rev 46774
black: merge config into main pyproject.toml now that we have it
This means that naive contributors who just run `black` on a source file
will get reasonable behavior as long as they have a recent black. Yay!
This was previously D9834 but was rolled back due to test
failures. nbjoerg thinks it's time to try again, so let's give it a
shot.
Differential Revision: https://phab.mercurial-scm.org/D10185
Augie Fackler <augie@google.com> [Tue, 01 Dec 2020 12:52:04 -0500] rev 46773
pyproject: add config file
This will tell pip et al to call our setup.py for the majority of
packaging concerns, but also gives us a place to put standard config
stuff like black.
This was previously D9833, but was rolled back due to test
breakage. nbjoerg thinks that breakage is now resolved, so we're
trying again.
Differential Revision: https://phab.mercurial-scm.org/D10184
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 16 Mar 2021 12:52:23 +0100] rev 46772
perf-util: add an helper revset to use the same spec as the case search script
This make result of the searcher script easier to use.
Differential Revision: https://phab.mercurial-scm.org/D10228
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 15 Mar 2021 18:01:42 +0100] rev 46771
perf-helpers: add a search-discovery-case script
This a small script I built to look for interesting discovery case. It is fairly
basic but could be useful in various situation so lets put it in the main
repositories.
Differential Revision: https://phab.mercurial-scm.org/D10225
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 16 Mar 2021 09:41:01 +0100] rev 46770
debugdiscovery: add missing byte string marker to some help text
This is causing crash when using --help.
Differential Revision: https://phab.mercurial-scm.org/D10227
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 15 Mar 2021 17:09:42 +0100] rev 46769
debugdiscovery: also integrate the discovery output in the json one
We add a way for formatter to informs code that free output is unwanted, and we
incorporate it in the json output.
Differential Revision: https://phab.mercurial-scm.org/D10224
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 15 Mar 2021 16:55:03 +0100] rev 46768
debugdiscovery: add support for Json output
They are some pre-output that will be impractical, I'll take care of it in the
next changeset.
Differential Revision: https://phab.mercurial-scm.org/D10223
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 15 Mar 2021 16:37:11 +0100] rev 46767
perf-helper: add a new sampling revset based on anti-chain
See inline documentation for details.
Differential Revision: https://phab.mercurial-scm.org/D10222
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 15 Mar 2021 16:35:54 +0100] rev 46766
perf-helper: add a small extension with revsets to select repository subset
Playing with discovery requires building interesting case. To do this we
need revsets to try to generate them. We start with a quite simple one. See
documentation for details.
Differential Revision: https://phab.mercurial-scm.org/D10221
Martin von Zweigbergk <martinvonz@google.com> [Tue, 26 Feb 2019 15:54:20 -0800] rev 46765
amend: mark commit obsolete after moving working copy
We were doing it this way:
1. move working copy (repo.setparents)
2. add obsmarkers (scmutil.cleanupnodes)
3. fix dirstate (dirstate.normal/drop)
Step 1 and 3 are closely related, so let's move them together. It
seems safest to create the obsmarkers last. This patch thus makes the
order 1, 3, 2.
Differential Revision: https://phab.mercurial-scm.org/D10197
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 06:03:01 +0100] rev 46764
pull: allow to specify multiple sources
I end up needing that on a regular basis and it turn out to be very simple to
implement. See documentation and test for details.
Differential Revision: https://phab.mercurial-scm.org/D10159
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 06:03:55 +0100] rev 46763
pull: pre-indent a part of the function
We are about to run it in a loop, so lets pre-indent it to clarify the actual
change in the next changesets.
Differential Revision: https://phab.mercurial-scm.org/D10158
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 05:54:27 +0100] rev 46762
command: clarify `postincoming` return and that return handling
The command should return None or a return code. The previous code was returning
boolean directly relying on the fact that `True → 1` and `False → 0`. This is a
good road to troubles, so lets be explicit about that return.
Differential Revision: https://phab.mercurial-scm.org/D10157
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 05:54:02 +0100] rev 46761
hg: make `clean` return consistent with the `update` function
The function return a boolean and is used as such. Lets be explicit about it.
Differential Revision: https://phab.mercurial-scm.org/D10156
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 16:28:46 +0100] rev 46760
tests: rename `test-pull` to `test-pull-network.t`
If is mostly about ssh and http interaction so lets avoid confusion with a
generic `hg pull` test
Differential Revision: https://phab.mercurial-scm.org/D10155
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 16:35:17 +0100] rev 46759
tests: move a test about update in test-pull-update.t
Differential Revision: https://phab.mercurial-scm.org/D10154
Martin von Zweigbergk <martinvonz@google.com> [Fri, 12 Mar 2021 09:15:40 -0800] rev 46758
split: close transaction in the unlikely event of a conflict while rebasing
`hg split` *should* never result in conflicts, but in case there are
bugs, we should at least commit the transaction so they can continue
the rebase. One of our users ran into the regression fixed by
D10120. They fixed the conflict and the tried to continue the rebase,
but it failed with "abort: cannot continue inconsistent rebase"
because the rebase state referred to commits written in a transaction
that was never committed.
Side note: `hg split` should probably turn off copy tracing to reduce
the impact of such bugs, and to speed it up as well. Copies made in
the rebased commits should still be respected because `hg rebase`
calls `copies.graftcopies()`.
Differential Revision: https://phab.mercurial-scm.org/D10164
Raphaël Gomès <rgomes@octobus.net> [Mon, 15 Mar 2021 13:05:00 +0100] rev 46757
rust-status: fix
issue6456 for the Rust implementation also
This implementation is being used by a few people now, so we need it fixed, even
though a big rewrite will be coming quite soon.
Differential Revision: https://phab.mercurial-scm.org/D10217
Joerg Sonnenberger <joerg@bec.de> [Tue, 16 Mar 2021 00:07:12 +0100] rev 46756
README: document requirement for builtin zstd
Differential Revision: https://phab.mercurial-scm.org/D10226
Simon Sapin <simon.sapin@octobus.net> [Mon, 08 Mar 2021 21:04:51 +0100] rev 46755
ci: Add a job testing with rhg installed as `hg`
This significantly increases test coverage of rhg, without duplicating
many tests that already exist.
The `cargo build` command being remove only compiled a `rhg` executable
(as shown by the preceding `cd` command) but since a previous patch
`run-tests.py --rhg` now takes care of that.
Differential Revision: https://phab.mercurial-scm.org/D10196
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 13:54:46 +0100] rev 46754
run-test: install rhg if --rhg is passed
Before this, --rhg was only working with --local.
Differential Revision: https://phab.mercurial-scm.org/D10195
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 13:54:13 +0100] rev 46753
makefile: add a install option
This gives and easy way to install rhg that we can use in `run-test.py` in the
next changesets.
Differential Revision: https://phab.mercurial-scm.org/D10194
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 13:54:00 +0100] rev 46752
makefile: add a build-rhg option
This gives an easy action to build the rhg-binary. This will be useful for the
`install-rhg` action in the next changeset.
Differential Revision: https://phab.mercurial-scm.org/D10193
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 13:53:47 +0100] rev 46751
makefile: add a install-chg option
This is done as a gratuitous improvement on the way to add makefile entry to
build and install rhg.
It seems saner to have equivalent entry for chg too.
Differential Revision: https://phab.mercurial-scm.org/D10192
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 13:53:31 +0100] rev 46750
makefile: add a build-chg option
This is done as a gratuitous improvement on the way to add makefile entry to
build and install rhg.
It seems saner to have equivalent entry for chg too.
Differential Revision: https://phab.mercurial-scm.org/D10191
Simon Sapin <simon.sapin@octobus.net> [Fri, 12 Mar 2021 23:04:56 +0100] rev 46749
tests: Disable for rhg remaining tests that fail in that mode
These cases are in features not yet implemented by rhg
for which triggering a fallback is not practical.
Disabling some tests allows us to reach passing CI and catch
any future regression in the rest of the tests.
Differential Revision: https://phab.mercurial-scm.org/D10190
Simon Sapin <simon.sapin@octobus.net> [Fri, 12 Mar 2021 21:44:07 +0100] rev 46748
rhg: Remove `rhg.fallback-executable=hg` default configuration
When `rhg.on-unsupported` is configured to `fallback` and an unsupported
feature is encountered, the previous default was to look for an `hg`
executable in `$PATH`.
This default was fragile since it was easy to end up accidentally using
an older version of Mercurial installed system-wide,
when a local (perhaps patched) installation was intended.
Instead, it is now an error to have `rhg.on-unsupported=fallback`
without also configuring an explicit path or the fallback executable.
Differential Revision: https://phab.mercurial-scm.org/D10189
Simon Sapin <simon.sapin@octobus.net> [Tue, 09 Mar 2021 09:17:24 +0100] rev 46747
rhg: Return an error code for `rhg config Section.idontexist`
This is what Python-based hg does.
Differential Revision: https://phab.mercurial-scm.org/D10145
Simon Sapin <simon.sapin@octobus.net> [Mon, 08 Mar 2021 20:04:20 +0100] rev 46746
rhg: Fall back to Python for --version
Clap has some built-in support for printing something on --version,
but it looks different than what Pytho-based hg does.
Also, at the moment we’re not giving version numbers to rhg
separate from the Mercurial version.
Differential Revision: https://phab.mercurial-scm.org/D10144
Simon Sapin <simon.sapin@octobus.net> [Mon, 08 Mar 2021 19:25:33 +0100] rev 46745
rhg: Exit with an error code if `files` finds nothing
This matches the behavior of Python-based hg.
Differential Revision: https://phab.mercurial-scm.org/D10143
Simon Sapin <simon.sapin@octobus.net> [Wed, 03 Mar 2021 16:40:03 +0100] rev 46744
rhg: `cat` command: print error messages for missing files
And exit with an error code if no file was matched.
This matches the behavior of Python-based hg.
Differential Revision: https://phab.mercurial-scm.org/D10142
Simon Sapin <simon.sapin@octobus.net> [Mon, 08 Mar 2021 19:07:29 +0100] rev 46743
rhg: Silently ignore missing files in config %include
… instead of aborting with an error message.
This is what Python-based hg does.
Differential Revision: https://phab.mercurial-scm.org/D10141
Simon Sapin <simon.sapin@octobus.net> [Mon, 08 Mar 2021 15:35:32 +0100] rev 46742
rhg: Add support for environment variables in config include paths
Some tests rely on this.
Differential Revision: https://phab.mercurial-scm.org/D10140