D643: rebase: use unfiltered repo when loading state

quark (Jun Wu) phabricator at mercurial-scm.org
Wed Sep 6 22:26:33 UTC 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, `rebase --abort` may fail to do the cleanup:
  
    $ hg rebase --abort
    rebase aborted (no revision is removed, only broken state is cleared)
  
  The added test case makes sure `--abort` works in this case.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -1301,3 +1301,48 @@
    /
   o  0:426bada5c675 A
   
+For some reasons (--hidden, rebaseskipobsolete=0, directaccess,  etc),
+rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
+
+  $ hg init $TESTTMP/hidden-state
+  $ cd $TESTTMP/hidden-state
+
+  $ hg debugdrawdag <<'EOS'
+  >    C
+  >    |
+  >  D B # prune: B, C
+  >  |/  # B/D=B
+  >  A
+  > EOS
+
+  $ eval `hg tags -T '{tag}={node}\n'`
+  $ rm .hg/localtags
+
+  $ hg update -q $C --hidden
+  $ hg rebase -s $B -d $D --config experimental.rebaseskipobsolete=0
+  rebasing 1:2ec65233581b "B"
+  merging D
+  warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg log -G
+  @  2:b18e25de2cf5 D
+  |
+  | @  1:2ec65233581b B
+  |/
+  o  0:426bada5c675 A
+  
+  $ hg summary
+  parent: 2:b18e25de2cf5 tip
+   D
+  parent: 1:2ec65233581b  (obsolete)
+   B
+  branch: default
+  commit: 2 modified, 1 unknown, 1 unresolved (merge)
+  update: (current)
+  phases: 3 draft
+  rebase: 0 rebased, 2 remaining (rebase --continue)
+
+  $ hg rebase --abort
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -198,7 +198,7 @@
 
     def restorestatus(self):
         """Restore a previously stored status"""
-        repo = self.repo
+        repo = self.repo.unfiltered()
         keepbranches = None
         legacydest = None
         collapse = False



To: quark, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list