Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Jan 2022 13:05:21 -0800] rev 48981
filemerge: add support for partial conflict resolution by external tool
A common class of merge conflicts is in imports/#includes/etc. It's
relatively easy to write a tool that can resolve these conflicts,
perhaps by naively just unioning the statements and leaving any
cleanup to other tools to do later [1]. Such specialized tools cannot
generally resolve all conflicts in a file, of course. Let's therefore
call them "partial merge tools". Note that the internal simplemerge
algorithm is such a partial merge tool - one that only resolves
trivial "conflicts" where one side is unchanged or both sides change
in the same way.
One can also imagine having smarter language-aware partial tools that
merge the AST. It may be useful for such tools to interactively let
the user resolve any conflicts it can't resolve itself. However,
having the option of implementing it as a partial merge tool means
that the developer doesn't *need* to create a UI for it. Instead, the
user can resolve any remaining conflicts with their regular merge tool
(e.g. `:merge3` or `meld).
We don't currently have a way to let the user define such partial
merge tools. That's what this patch addresses. It lets the user
configure partial merge tools to run. Each tool can be configured to
run only on files matching certain patterns (e.g. "*.py"). The tool
takes three inputs (local, base, other) and resolves conflicts by
updating these in place. For example, let's say the inputs are these:
base:
```
import sys
def main():
print('Hello')
```
local:
```
import os
import sys
def main():
print('Hi')
```
other:
```
import re
import sys
def main():
print('Howdy')
```
A partial merge tool could now resolve the conflicting imports by
replacing the import statements in *all* files by the following
snippet, while leaving the remainder of the files unchanged.
```
import os
import re
import sys
```
As a result, simplemerge and any regular merge tool that runs after
the partial merge tool(s) will consider the imports to be
non-conflicting and will only present the conflict in `main()` to the
user.
Differential Revision: https://phab.mercurial-scm.org/D12356
Joerg Sonnenberger <joerg@bec.de> [Tue, 22 Mar 2022 03:19:01 +0100] rev 48980
pullbundle: fix file name in the help text
It is pullbundles.manifest and not pullbundle.manifest.
Differential Revision: https://phab.mercurial-scm.org/D12391
Martin von Zweigbergk <martinvonz@google.com> [Mon, 21 Mar 2022 14:21:10 -0700] rev 48979
unamend: abort if commit was not created by `hg [un]amend`
`hg unamend` can currently undo any kind of rewrite, as long as it has
an obsmarker. However, that has quite unexpected results if you run it
after e.g. `hg rebase` (expecting it to behave like a generic `hg
undo` command), because it updates to the predecessor and leaves the
old changes in the working copy. I think it's better to allow `hg
unamend` only after `hg amend` (and after `hg unamend` because that's
documented as being supported).
Differential Revision: https://phab.mercurial-scm.org/D12390
Raphaël Gomès <rgomes@octobus.net> [Mon, 21 Mar 2022 10:55:50 +0100] rev 48978
branching: merge stable into default
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 17 Mar 2022 14:58:46 +0100] rev 48977
test: use `wait-on-file` in `test-racy-mutations.t`
The official utility scale its timeout with the run-tests.py one. So lets use
it.
Differential Revision: https://phab.mercurial-scm.org/D12382
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Mar 2022 21:15:54 -0700] rev 48976
amend: fix amend with copies in extras
If copy information is stored only in the commit extras and not in
filelogs, then they get lost on amend if the file wasn't also modified
in the working copy. That's because we create `filectx` object from
the old commit in those cases, and the `.copysource()` of such objects
read only from the filelog. This patch fixes it by always creating a
new `memfilectx` in these cases, passing the calculated copy
information to it.
Differential Revision: https://phab.mercurial-scm.org/D12387