repoview: only pin obsolete wdir parents while there are unresolved conflicts stable
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 23 Oct 2020 22:20:08 -0400
branchstable
changeset 45761 341e014fe0fb
parent 45760 e0ad11ab8052
child 45762 0599c83cdf5c
child 45794 330c258fe7ca
repoview: only pin obsolete wdir parents while there are unresolved conflicts I noticed after doing an update from an obsolete revision with a dirty wdir that the obsolete commit stayed visible for no obvious reason. It was decided in 85b03b1e4715 not to clear mergestate once all of the conflicts were resolved, in order to allow re-resolving. Since the point of pinning the obsolete parents was to allow resolving in the first place (aaeccdb6e654), it makes sense to also gate it on whether or not there are any remaining files to resolve. This might result in pinning again if files are marked unresolved again, but that seems reasonable, given that it still solves the original issue. Note that this isn't purely cosmetic- pushing with a pinned obsolete revision is likely to cause complaints about pushing multiple heads or other unexpected errors. So the faster it comes out of that state, the better. Differential Revision: https://phab.mercurial-scm.org/D9248
mercurial/repoview.py
tests/test-rebase-check-restore.t
--- a/mercurial/repoview.py	Wed Oct 28 17:41:25 2020 +0100
+++ b/mercurial/repoview.py	Fri Oct 23 22:20:08 2020 -0400
@@ -69,7 +69,7 @@
     from . import mergestate
 
     ms = mergestate.mergestate.read(repo)
-    if ms.active():
+    if ms.active() and ms.unresolvedcount():
         for node in (ms.local, ms.other):
             rev = cl.index.get_rev(node)
             if rev is not None:
--- a/tests/test-rebase-check-restore.t	Wed Oct 28 17:41:25 2020 +0100
+++ b/tests/test-rebase-check-restore.t	Fri Oct 23 22:20:08 2020 -0400
@@ -176,6 +176,48 @@
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   [1]
 
+An unresolved conflict will pin the obsolete revision
+
+  $ hg log -G -Tcompact
+  %  5[tip]   071d07019675   1970-01-01 00:00 +0000   test
+  |    F
+  |
+  o  4   ae36e8e3dfd7   1970-01-01 00:00 +0000   test
+  |    E
+  |
+  o  3:0   46b37eabc604   1970-01-01 00:00 +0000   test
+  |    D
+  |
+  | @  2   965c486023db   1970-01-01 00:00 +0000   test
+  | |    C
+  | |
+  | o  1   27547f69f254   1970-01-01 00:00 +0000   test
+  |/     B
+  |
+  o  0   4a2df7238c3b   1970-01-01 00:00 +0000   test
+       A
+  
+
+But resolving the conflicts will unpin it
+
+  $ hg resolve -m A
+  (no more unresolved files)
+  $ hg log -G -Tcompact
+  o  4[tip]   ae36e8e3dfd7   1970-01-01 00:00 +0000   test
+  |    E
+  |
+  o  3:0   46b37eabc604   1970-01-01 00:00 +0000   test
+  |    D
+  |
+  | @  2   965c486023db   1970-01-01 00:00 +0000   test
+  | |    C
+  | |
+  | o  1   27547f69f254   1970-01-01 00:00 +0000   test
+  |/     B
+  |
+  o  0   4a2df7238c3b   1970-01-01 00:00 +0000   test
+       A
+  
   $ hg up -C -q .
 
   $ cd ..