diff mercurial/repoview.py @ 45412:aaeccdb6e654 stable

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
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 04 Sep 2020 15:21:02 -0400
parents 672ad1f6eeb8
children 5ed6efedc457
line wrap: on
line diff
--- 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