Merge with stable.
authorAugie Fackler <raf@durin42.com>
Wed, 06 Nov 2013 12:53:39 -0500
changeset 19985 aa80446aacc3
parent 19983 e1317d3e59e1 (current diff)
parent 19984 7d5e7799a29f (diff)
child 19988 8dc6f855f43d
Merge with stable.
--- a/hgext/rebase.py	Tue Nov 05 13:25:45 2013 -0500
+++ b/hgext/rebase.py	Wed Nov 06 12:53:39 2013 -0500
@@ -689,7 +689,7 @@
 
 def abort(repo, originalwd, target, state):
     'Restore the repository to its original state'
-    dstates = [s for s in state.values() if s != nullrev]
+    dstates = [s for s in state.values() if s > nullrev]
     immutable = [d for d in dstates if not repo[d].mutable()]
     cleanup = True
     if immutable:
--- a/mercurial/phases.py	Tue Nov 05 13:25:45 2013 -0500
+++ b/mercurial/phases.py	Wed Nov 06 12:53:39 2013 -0500
@@ -185,6 +185,8 @@
         # be replaced without us being notified.
         if rev == nullrev:
             return public
+        if rev < nullrev:
+            raise ValueError(_('cannot lookup negative revision'))
         if self._phaserevs is None or rev >= len(self._phaserevs):
             self._phaserevs = self.getphaserevs(repo, rebuild=True)
         return self._phaserevs[rev]
--- a/tests/test-rebase-abort.t	Tue Nov 05 13:25:45 2013 -0500
+++ b/tests/test-rebase-abort.t	Wed Nov 06 12:53:39 2013 -0500
@@ -181,3 +181,46 @@
   
 
   $ cd ..
+
+rebase abort should not leave working copy in a merge state if tip-1 is public
+(issue4082)
+
+  $ hg init abortpublic
+  $ cd abortpublic
+  $ echo a > a && hg ci -Aqm a
+  $ hg book master
+  $ hg book foo
+  $ echo b > b && hg ci -Aqm b
+  $ hg up -q master
+  $ echo c > c && hg ci -Aqm c
+  $ hg phase -p -r .
+  $ hg up -q foo
+  $ echo C > c && hg ci -Aqm C
+  $ hg log -G --template "{rev} {desc} {bookmarks}"
+  @  3 C foo
+  |
+  | o  2 c master
+  | |
+  o |  1 b
+  |/
+  o  0 a
+  
+
+  $ hg rebase -d master -r foo
+  merging c
+  warning: conflicts during merge.
+  merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ hg rebase --abort
+  rebase aborted
+  $ hg log -G --template "{rev} {desc} {bookmarks}"
+  @  3 C foo
+  |
+  | o  2 c master
+  | |
+  o |  1 b
+  |/
+  o  0 a
+  
+  $ cd ..