Patchwork D9248: repoview: only pin obsolete wdir parents while there are unresolved conflicts

login
register
mail settings
Submitter phabricator
Date Oct. 24, 2020, 4:14 a.m.
Message ID <differential-rev-PHID-DREV-aqf6x34wkgwuqj7rold2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47518/
State Superseded
Headers show

Comments

phabricator - Oct. 24, 2020, 4:14 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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 <https://phab.mercurial-scm.org/rHG85b03b1e47151f052460d9b34d3e3f6d1866f964> 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 <https://phab.mercurial-scm.org/rHGaaeccdb6e654d5e87029aac6096a4ed5ce001159>), 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.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D9248

AFFECTED FILES
  mercurial/repoview.py
  tests/test-rebase-check-restore.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-rebase-check-restore.t b/tests/test-rebase-check-restore.t
--- a/tests/test-rebase-check-restore.t
+++ b/tests/test-rebase-check-restore.t
@@ -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 ..
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -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: