Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 11:33:01 +0100] rev 48764
rank: naive rank property computation and retrieval
This stores the rank (size of the ancestor set of a revision, including itself)
in a changelog field and allows this property to be retrieved.
This new property is used as part of stable-range computations, which will be
introduced later on.
The value is computed in a naive way from the definition of the rank. This will
be replaced by a more efficient version subsequently.
Differential Revision: https://phab.mercurial-scm.org/D12139
Martin von Zweigbergk <martinvonz@google.com> [Mon, 07 Feb 2022 22:54:38 -0800] rev 48763
filemerge: move check for identical sides out of filemerge()
`filemerge.filemerge()` returns `None` if no merge was necessary
because the two sides were identical. I don't think it should be that
function's responsibility to handle that case; we should ideally not
even call `filemerge.filemerge()` if the two inputs identical. This
patch therefore moves the check out to the caller (`mergestate.py`).
The largefiles test changed because we now notice that the two sides
made the same change, so we don't consider it a merge. Also note that
the new message better matches the line above it in the test output.
Differential Revision: https://phab.mercurial-scm.org/D12154
Martin von Zweigbergk <martinvonz@google.com> [Mon, 07 Feb 2022 20:12:09 -0800] rev 48762
mergestate: use an early return for trivial merges
`filemerge.filemerge()` returns `None` if no merge was needed because
the two sides were identical. I'd like to move that to the
caller. This is a little refactoring to prepare for that.
Differential Revision: https://phab.mercurial-scm.org/D12153
Martin von Zweigbergk <martinvonz@google.com> [Mon, 07 Feb 2022 14:07:04 -0800] rev 48761
simplemerge: remove now-unused arguments
The `ui` argument is no longer needed now that we don't handle
`--print` in the library code.
Differential Revision: https://phab.mercurial-scm.org/D12151
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Jan 2022 13:22:55 -0800] rev 48760
merge: fix documented order of `labels` argument
Differential Revision: https://phab.mercurial-scm.org/D12150
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Jan 2022 12:57:55 -0800] rev 48759
filemerge: when not keeping premerge, don't write markers to context
When premerge is enabled (as it is for non-binary inputs by default)
and the markers are not kept, we currently still write it to the
output context and then restore the previous content right after. With
the refactoring in the previous patch, we can easily avoid that step
and instead write the output in the opposite case (i.e. when it's
successful or when the markers are supposed to be kept).
Differential Revision: https://phab.mercurial-scm.org/D12149
Martin von Zweigbergk <martinvonz@google.com> [Fri, 14 Jan 2022 08:17:13 -0800] rev 48758
simplemerge: move printing of merge result to extension
The `mercurial.simplemerge` module still has some command-lines
processing that doesn't belong in such a low-level module. This patch
moves the handling of `hg simplemerge --print` to the extension by
having `mercurial.simplemerge.simplemerge()` return the merged text.
Differential Revision: https://phab.mercurial-scm.org/D12148
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Feb 2022 15:48:01 -0800] rev 48757
simplemerge: remove code for checking binary input now that callers do it
The callers now do the checking for binary inputs and handle warnings
and/or errors, so we can remove that code from the low-level
`simplemerge` module now. After this patch we just raise an error
unless the caller told us to allow binary inputs.
Differential Revision: https://phab.mercurial-scm.org/D12169
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Feb 2022 15:27:58 -0800] rev 48756
simplemerge: let filemerge check for binary inputs
This is similar to the previous patch, but here we put a specialized
copy of `simplemerge._verifytext()` in the the `filemerge` module
instead.
Differential Revision: https://phab.mercurial-scm.org/D12147
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Feb 2022 13:36:09 -0800] rev 48755
simplemerge: let extension check for binary inputs (unless `--text`)
The `simplemerge` module does too much UI-related things. This patch
puts a specialized copy of `simplemerge._verifytext()` in the
simplemerge extension.
Differential Revision: https://phab.mercurial-scm.org/D12146
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Feb 2022 11:00:32 -0800] rev 48754
simplemerge: store input data in MergeInput
I want to be able to update the file contents for support for partial
conflict resolution. Having the text available (and later settable) on
`MergeInput` will enable that.
Differential Revision: https://phab.mercurial-scm.org/D12144
Martin von Zweigbergk <martinvonz@google.com> [Fri, 04 Feb 2022 18:36:36 -0800] rev 48753
simplemerge: convert MergeInput to regular, non-attr.ib class
I'm about to add more logic and state to it.
Differential Revision: https://phab.mercurial-scm.org/D12145
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Feb 2022 09:59:07 -0800] rev 48752
simplemerge: replace `**opts` passed to `simplemerge()` by keyword arguments
The `simplemerge` module is library code; it should not get an
unmodified `opts` dict from the `simplemerge` extension.
Differential Revision: https://phab.mercurial-scm.org/D12152
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 03 Feb 2022 18:14:25 +0100] rev 48751
narrow: add support for merging add and remove outside of the tracked set
This extend f1eb77dceb36 to test and support the remaining action. Or, at least,
the simple incarnation of them.
Differential Revision: https://phab.mercurial-scm.org/D12181
Simon Sapin <simon.sapin@octobus.net> [Fri, 21 Jan 2022 17:54:03 +0100] rev 48750
status: prefer relative paths in Rust code
… when the repository root is under the current directory,
so the kernel needs to traverse fewer directory in every call
to `read_dir` or `symlink_metadata`.
Better yet would be to use libc functions like `openat` and `fstatat`
to remove such repeated traversals entirely, but the standard library
does not provide APIs based on those.
Maybe with a crate like https://crates.io/crates/openat instead?
Benchmarks of `rhg status` show that this patch is neutral in some configurations,
and makes the command up to ~20% faster in others.
Below is semi-arbitrary subset of results. The four numeric columns are:
time (in seconds) with this changeset’s parent, time with this changeset,
time difference (negative is better), time ratio (less than 1 is better).
```
mercurial-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.0061 -> 0.0059: -0.0002 (0.97)
mercurial-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0029 -> 0.0028: -0.0001 (0.97)
mozilla-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.2110 -> 0.2102: -0.0007 (1.00)
mozilla-dirstate-v2 | default-copies-clean.ignored.pbr | 0.0489 -> 0.0401: -0.0088 (0.82)
mozilla-dirstate-v2 | default-copies-clean.no-iu.pbr | 0.0479 -> 0.0393: -0.0085 (0.82)
mozilla-dirstate-v2 | default-copies-large.all.pbr | 0.1262 -> 0.1210: -0.0051 (0.96)
mozilla-dirstate-v2 | default-copies-small.ignored-unknown.pbr | 0.1262 -> 0.1200: -0.0062 (0.95)
mozilla-dirstate-v2 | default-copies-small.ignored.pbr | 0.0536 -> 0.0417: -0.0119 (0.78)
mozilla-dirstate-v2 | default-copies-small.no-iu.pbr | 0.0482 -> 0.0393: -0.0089 (0.81)
mozilla-dirstate-v2 | default-plain-clean.ignored.pbr | 0.0518 -> 0.0402: -0.0116 (0.78)
mozilla-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0481 -> 0.0392: -0.0088 (0.82)
mozilla-dirstate-v2 | default-plain-large.all.pbr | 0.1271 -> 0.1218: -0.0052 (0.96)
mozilla-dirstate-v2 | default-plain-small.ignored-unknown.pbr | 0.1225 -> 0.1202: -0.0022 (0.98)
mozilla-dirstate-v2 | default-plain-small.ignored.pbr | 0.0510 -> 0.0418: -0.0092 (0.82)
mozilla-dirstate-v2 | default-plain-small.no-iu.pbr | 0.0480 -> 0.0394: -0.0086 (0.82)
netbeans-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.1442 -> 0.1422: -0.0020 (0.99)
netbeans-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0325 -> 0.0282: -0.0043 (0.87)
```
Differential Revision: https://phab.mercurial-scm.org/D12175
Simon Sapin <simon.sapin@octobus.net> [Mon, 14 Feb 2022 18:51:43 +0100] rev 48749
rust: remove unused `StatusError::IO` enum variant
All `io::Error` cases are now handled through PatternFileWarning or BadMatch
Differential Revision: https://phab.mercurial-scm.org/D12174
Simon Sapin <simon.sapin@octobus.net> [Mon, 14 Feb 2022 18:57:12 +0100] rev 48748
rust: fix code formatting
Differential Revision: https://phab.mercurial-scm.org/D12173
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 07 Feb 2022 00:33:22 -0500] rev 48747
sparse: rework debugsparse's interface
hg debugsparse supports arguments like --include, similar to `hg
tracked --addinclude` or `hg log --include`. But in `hg debugsparse`,
the pattern is not an argument of the flag, instead the patterns are
the anonymous command line arguments.
Not only is this surprising, it makes it impossible to use --include
and --exclude in the same invocation, or --reset --exclude.
So I propose making debugsparse making --include, --exclude take an
argument, and rejecting anonymous command line arguments, as well as
allowing mixing several of these flags in one invocations.
Differential Revision: https://phab.mercurial-scm.org/D12155
Mitchell Hentges <mhentges@mozilla.com> [Wed, 09 Feb 2022 13:04:37 -0500] rev 48746
color: don't infer vt status from TERM on Windows
Previously, it was assumed that Windows environments with
"xterm" in the TERM environment variable meant that either
"virtual terminal mode" was already enabled, or that
we are running in an environment that didn't need a "virtual
terminal mode" (such as mintty, that interprets ANSI sequences
itself).
However, modern Cygwin and MSYS2 set TERM=xterm when using the
Command Prompt as the terminal, which needs "virtual terminal
mode" to be manually enabled. However, due to (issue6640),
the vtmode wasn't being enabled.
This patch ensures that we always try to enable vtmode on
Windows regardless of the state of TERM, so that:
* ANSI-based colors work in modern Cygwin/MSYS2 (with Command
Prompt), and
* The vtmode is unnecessarily set when running in a different
terminal such as mintty, but it is simply redundant and doesn't
appear to have ill effects.
Differential Revision: https://phab.mercurial-scm.org/D12158
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 19:26:10 +0100] rev 48745
rhg: enable `rhg status` by default, without config or env opt-in
The full test suite now passes with `hg` pointing to rhg.
Differential Revision: https://phab.mercurial-scm.org/D12162
Simon Sapin <simon.sapin@octobus.net> [Tue, 08 Feb 2022 14:20:58 +0100] rev 48744
rhg: Colorize `rhg status` output when appropriate
Differential Revision: https://phab.mercurial-scm.org/D12168
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 12:59:32 +0100] rev 48743
rhg: Add support for colored output
The same "label" system is used as in Python code
Differential Revision: https://phab.mercurial-scm.org/D12167
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 13:56:43 +0100] rev 48742
rhg: Add parsing for the --color global CLI argument
Differential Revision: https://phab.mercurial-scm.org/D12166
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 12:52:25 +0100] rev 48741
rhg: Make Ui::new falliable, add Ui::new_infallible
This allows propagating color configuration errors
Differential Revision: https://phab.mercurial-scm.org/D12165
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 12:12:56 +0100] rev 48740
rhg: Pass a &Config to Ui::new
When a Ui object is needed to print errors about configuration-loading errors,
an empty (default) configuration is used.
Differential Revision: https://phab.mercurial-scm.org/D12164
Simon Sapin <simon.sapin@octobus.net> [Thu, 10 Feb 2022 11:58:04 +0100] rev 48739
rhg: Add support for HGPLAINEXPECT
Differential Revision: https://phab.mercurial-scm.org/D12163
Augie Fackler <augie@google.com> [Thu, 10 Feb 2022 13:24:38 -0500] rev 48738
merge: with stable
Anton Shestakov <av6@dwimlabs.net> [Mon, 07 Feb 2022 12:29:43 +0300] rev 48737
scmutil: obsrevs is already a frozenset
Differential Revision: https://phab.mercurial-scm.org/D12157
Anton Shestakov <av6@dwimlabs.net> [Mon, 07 Feb 2022 12:25:46 +0300] rev 48736
obsolete: always return frozensets from obsolete.getrevs()
getrevs function already returns an empty frozenset when there is no obsstore,
but let's make sure to return a frozenset in any case. This makes it possible
to use the result of this function as a dict key or provide it to hash()
built-in function without any conversions.
Differential Revision: https://phab.mercurial-scm.org/D12156
pacien <pacien.trangirard@pacien.net> [Wed, 26 Jan 2022 13:18:48 +0100] rev 48735
revlog: split revlog v1 and revlog v2 handling
Explicitly splitting their fields packing and unpacking makes it easier to
extend the existing C implemenation to handle the new changelog format, whose
fields and offsets are not simply a superset of the revlog.
Differential Revision: https://phab.mercurial-scm.org/D12137
pacien <pacien.trangirard@pacien.net> [Wed, 26 Jan 2022 13:08:36 +0100] rev 48734
revlog: extract entry byte offsets into named constants
Labelling the fields pointed by the given offsets shared by revlog v1 and v2.
Differential Revision: https://phab.mercurial-scm.org/D12136
Anton Shestakov <av6@dwimlabs.net> [Mon, 07 Feb 2022 13:24:30 +0300] rev 48733
branchmap: split a long condition in branchcache.validfor(), add comments
Differential Revision: https://phab.mercurial-scm.org/D12138
Anton Shestakov <av6@dwimlabs.net> [Sun, 06 Feb 2022 19:31:39 +0300] rev 48732
branchmap: don't add branch entries if there are no heads
We definitely don't want any empty entries to be present in repo.branchmap()
just for the sake of not breaking test-notify.t.
No test changes required because the previous patch made notify extension to
not raise any tracebacks in case of RepoLookupErrors.
Differential Revision: https://phab.mercurial-scm.org/D12135
Anton Shestakov <av6@dwimlabs.net> [Sun, 06 Feb 2022 19:14:51 +0300] rev 48731
notify: don't produce errors if a revision is not found
Notify extension has a way to only subscribe to a specific revset, such as
"branch(foo)". Before this patch, when there was no branch with that name, it
would produce a traceback saying "unknown revision: foo". With this patch it
would no longer do that, and instead it'll assume there are no revisions that
match this revset. I think this patch is an improvement in general, but there's
a reason I'm sending it now.
test-notify.t has a test case where it obsoletes the only revision on a branch,
and previously that wouldn't produce any complications, because head
computation wasn't obsolescence-aware. Now if the only revision on a branch is
obsolete, repo should not see that branch at all.
That branch will still be present in branchcache (with an empty list of
revisions) until the next patch.
Differential Revision: https://phab.mercurial-scm.org/D12134
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 03 Feb 2022 18:14:11 +0100] rev 48730
narrow: allow merging non-conflicting change outside of the narrow spec
We use the mergestate to carry information about these merge action and
reprocess them at commit time to apply the necessary update.
The dirstate itself is never affected and remains "pure", with content only in
the narrow-spec. This file involved in such merge are therefor not listed in `hg
status`.
The current testing is based on a modification of the previous testing, that
refused to do such merges. As a result it is a bit simple and more extensive
code and testing testing will have to be introduced later. I am planning to do
this extra testing, soon.
In addition, this only works for flat manifest. Support for tree manifest will
need more work. I am not currently planning to do this work.
Differential Revision: https://phab.mercurial-scm.org/D12119
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 30 Jan 2022 06:01:42 +0100] rev 48729
merge-actions: add some information about the "changes" the action do
This will be useful when processing merges action outside of the narrow-spec.
"support" outside of narrow file on commit
Differential Revision: https://phab.mercurial-scm.org/D12118
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 29 Jan 2022 06:21:32 +0100] rev 48728
merge-actions: have an attribute for narrow safetiness
This allow the core doing narrow filtering to process action without
explicitely listing all possible actions. This is important to make the actions
system more flexible in the future.
Differential Revision: https://phab.mercurial-scm.org/D12117
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 15:19:58 +0100] rev 48727
merge-actions: add an explicite "no_op" attribute
This make the MergeAction smarter and able to describe themself. This is useful
to help introducing more MergeAction object that better the complexity of the
situation.
Differential Revision: https://phab.mercurial-scm.org/D12116
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 19:46:37 +0100] rev 48726
merge-actions: gather all created action into a set
This is mostly to demonstrate we can do this before we start adding more
specialized set.
Differential Revision: https://phab.mercurial-scm.org/D12115
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 17:08:30 +0100] rev 48725
merge-actions: make merge action a full featured object
This open the way for having "smarter" value as action, making the usage code
simpler and more flexible.
We have to explicitly use __bytes__ call in a couple of place because Python2…
Differential Revision: https://phab.mercurial-scm.org/D12114
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 16:25:41 +0100] rev 48724
convert: use the merge action constant
The constant exists, lets use them. Otherwise we cannot make these constant more
powerful.
Differential Revision: https://phab.mercurial-scm.org/D12113
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 16:11:42 +0100] rev 48723
large-file: use the merge action constant
The constant exists, lets use them. Otherwise we cannot make these constant more
powerful.
Differential Revision: https://phab.mercurial-scm.org/D12112
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 16:41:45 +0100] rev 48722
merge: stop using merge action for pathconflict option
This is not the b'r' you are looking for.
Differential Revision: https://phab.mercurial-scm.org/D12111
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:25:51 +0100] rev 48721
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12110
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:25:45 +0100] rev 48720
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12109
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:25:39 +0100] rev 48719
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12108
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:25:32 +0100] rev 48718
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12107
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:25:05 +0100] rev 48717
merge: break up two not-so-one-liner for extra readability
Differential Revision: https://phab.mercurial-scm.org/D12106
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:24:41 +0100] rev 48716
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12105
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:24:30 +0100] rev 48715
merge: break up a not-so-one-liner for readability
(even if not fully satisfied this time)
Differential Revision: https://phab.mercurial-scm.org/D12104
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:23:56 +0100] rev 48714
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12103
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:23:49 +0100] rev 48713
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12102
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Jan 2022 14:23:37 +0100] rev 48712
merge: break up a not-so-one-liner for readability
Differential Revision: https://phab.mercurial-scm.org/D12101
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 03 Feb 2022 06:49:48 +0100] rev 48711
phabricator-refresh: add a magic value to skip it in the CI
When maintaining (light) fork, it is useful to be able to disable this.
Differential Revision: https://phab.mercurial-scm.org/D12133
Anton Shestakov <av6@dwimlabs.net> [Thu, 27 Jan 2022 20:04:56 +0300] rev 48710
interfaces: add missing caches kwarg of localrepo.updatecaches()
Added to localrepo: in 1337bfaa88ca, added to the interface: now.
Differential Revision: https://phab.mercurial-scm.org/D12092
Anton Shestakov <av6@dwimlabs.net> [Mon, 31 Jan 2022 18:05:36 +0300] rev 48709
obsolete: don't import from .node twice
See d55b71393907.
Differential Revision: https://phab.mercurial-scm.org/D12121
Anton Shestakov <av6@dwimlabs.net> [Mon, 31 Jan 2022 18:04:11 +0300] rev 48708
dagop: don't import nullrev from .node twice
See 59fa3890d40a.
Differential Revision: https://phab.mercurial-scm.org/D12120
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Jan 2022 22:24:11 +0100] rev 48707
stream-clone: allow to change persistent-nodemap format during stream clone
Persistent nodemap affect the store format. However it is fairly isolated and
fast to generate locally. So not making it a fixed part of the stream clone is
useful.
This allow clients without persistent-nodemap support (default for client
without Rust enabled, or simply older client). So it make it possible to enable
persistent nodemap on client, where it can provide a massive boost. without too
much consequence.
To do so, we stop using it in the advertisement requirements for streaming and
let the client add/remove the necessary file depending of its configuration.
We still send the files as it seems like a small save to not regenerate them.
In addition, the way we match them will overlap with the changelog-v2/revlog-v2
so we can't simply skip the associated patterns.
Differential Revision: https://phab.mercurial-scm.org/D12096
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Jan 2022 15:22:09 +0100] rev 48706
stream-clone: add 5000 changesets to test-clone-stream-format
This make sure the changelog is not inlined. We needs this to test coming
behavior change around persistent-nodemap.
Differential Revision: https://phab.mercurial-scm.org/D12095
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Jan 2022 15:22:04 +0100] rev 48705
debugbuilddag: add a flag to allow running it from a non-empty repository
Allow that by default seems "dangerous", but having a flag to make it possible
will be useful to help building some repository incrementally. The newly introduced support is basic, but already useful.
Differential Revision: https://phab.mercurial-scm.org/D12094