changeset 31306:f5c71e98f0f7

rebase: unhide original working directory node as well (issue5219) By including the working directory revision at the start of rebase in the repo._rebaseset, we make sure it's not hidden when we update back to it at the end of the rebase. This feels like abusing the set a bit given its name (_rebaseset), but I couldn't think of another name that's clearly better.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 10 Mar 2017 23:07:20 -0800
parents 98658f73588a
children 59d09565ac77
files hgext/rebase.py tests/test-rebase-obsolete.t
diffstat 2 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Mar 10 23:06:31 2017 -0800
+++ b/hgext/rebase.py	Fri Mar 10 23:07:20 2017 -0800
@@ -250,7 +250,7 @@
         repo.ui.debug('computed skipped revs: %s\n' %
                         (' '.join(str(r) for r in sorted(skipped)) or None))
         repo.ui.debug('rebase status resumed\n')
-        _setrebasesetvisibility(repo, set(state.keys()))
+        _setrebasesetvisibility(repo, set(state.keys()) | set([originalwd]))
 
         self.originalwd = originalwd
         self.target = target
@@ -1203,7 +1203,8 @@
     dest: context
     rebaseset: set of rev
     '''
-    _setrebasesetvisibility(repo, set(rebaseset))
+    originalwd = repo['.'].rev()
+    _setrebasesetvisibility(repo, set(rebaseset) | set([originalwd]))
 
     # This check isn't strictly necessary, since mq detects commits over an
     # applied patch. But it prevents messing up the working directory when
@@ -1288,7 +1289,7 @@
             state[r] = revpruned
         else:
             state[r] = revprecursor
-    return repo['.'].rev(), dest.rev(), state
+    return originalwd, dest.rev(), state
 
 def clearrebased(ui, repo, state, skipped, collapsedas=None):
     """dispose of rebased revision at the end of the rebase
--- a/tests/test-rebase-obsolete.t	Fri Mar 10 23:06:31 2017 -0800
+++ b/tests/test-rebase-obsolete.t	Fri Mar 10 23:07:20 2017 -0800
@@ -279,11 +279,27 @@
   $ hg --hidden up -qr 'first(hidden())'
   $ hg rebase --rev 13 --dest 15
   rebasing 13:98f6af4ee953 "C"
-  transaction abort!
-  rollback completed
-  abort: hidden revision '1'!
-  (use --hidden to access hidden revisions)
-  [255]
+  $ hg log -G
+  o  16:294a2b93eb4d C
+  |
+  o  15:627d46148090 D
+  |
+  | o  12:462a34d07e59 B
+  | |
+  | o  11:4596109a6a43 D
+  | |
+  | o  7:02de42196ebe H
+  | |
+  +---o  6:eea13746799a G
+  | |/
+  | o  5:24b6387c8c8c F
+  | |
+  o |  4:9520eea781bc E
+  |/
+  | @  1:42ccdea3bb16 B
+  |/
+  o  0:cd010b8cd998 A
+  
 
   $ cd ..