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
--- a/mercurial/repoview.py Wed Sep 02 12:31:37 2020 +0200
+++ b/mercurial/repoview.py Fri Sep 04 15:21:02 2020 -0400
@@ -62,6 +62,17 @@
rev = cl.index.get_rev
pinned.update(rev(t[0]) for t in tags.values())
pinned.discard(None)
+
+ # Avoid cycle: mercurial.filemerge -> mercurial.templater ->
+ # mercurial.templatefuncs -> mercurial.revset -> mercurial.repoview ->
+ # mercurial.mergestate -> mercurial.filemerge
+ from . import mergestate
+
+ ms = mergestate.mergestate.read(repo)
+ if ms.active():
+ pinned.add(ms.localctx.rev())
+ pinned.add(ms.otherctx.rev())
+
return pinned
--- a/tests/test-rebase-check-restore.t Wed Sep 02 12:31:37 2020 +0200
+++ b/tests/test-rebase-check-restore.t Fri Sep 04 15:21:02 2020 -0400
@@ -153,5 +153,29 @@
|/
o 0:draft 'A'
+ $ cat >> .hg/hgrc << EOF
+ > [experimental]
+ > evolution.createmarkers=True
+ > EOF
+
+When updating away from a dirty, obsolete wdir, don't complain that the old p1
+is filtered and requires --hidden.
+
+ $ echo conflict > A
+ $ hg debugobsolete 071d07019675449d53b7e312c65bcf28adbbdb64 965c486023dbfdc9c32c52dc249a231882fd5c17
+ 1 new obsolescence markers
+ obsoleted 1 changesets
+ $ hg update -r 2 --config ui.merge=internal:merge --merge
+ merging A
+ warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
+ 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
+ use 'hg resolve' to retry unresolved file merges
+ [1]
+ $ hg resolve A
+ merging A
+ warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
+ [1]
+
+ $ hg up -C -q .
$ cd ..
--- a/tests/test-rebase-obsolete.t Wed Sep 02 12:31:37 2020 +0200
+++ b/tests/test-rebase-obsolete.t Fri Sep 04 15:21:02 2020 -0400
@@ -1795,6 +1795,8 @@
$ hg log -G
@ 2:b18e25de2cf5 D
|
+ | % 1:2ec65233581b B (pruned using prune)
+ |/
o 0:426bada5c675 A
$ hg summary
@@ -1802,8 +1804,8 @@
D
branch: default
commit: 1 modified, 1 added, 1 unknown, 1 unresolved
- update: (current)
- phases: 2 draft
+ update: 1 new changesets, 2 branch heads (merge)
+ phases: 3 draft
rebase: 0 rebased, 2 remaining (rebase --continue)
$ hg rebase --abort