changeset 14599:b28004513977

rebase: preserve mq series order after rebasing (issue2849)
author Idan Kamara <idankk86@gmail.com>
date Sun, 12 Jun 2011 17:26:58 +0300
parents 259ba7502370
children 17c16bcf6926
files hgext/rebase.py tests/test-rebase-mq.t
diffstat 2 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Jun 12 17:26:20 2011 +0300
+++ b/hgext/rebase.py	Sun Jun 12 17:26:58 2011 +0300
@@ -396,14 +396,9 @@
                 mq.qimport(repo, (), patchname=name, git=isgit,
                                 rev=[str(state[rev])])
 
-        # Restore missing guards
-        for s in original_series:
-            pname = mq.guard_re.split(s, 1)[0]
-            if pname in mq.fullseries:
-                repo.ui.debug('restoring guard for patch %s' % (pname))
-                mq.fullseries.remove(pname)
-                mq.fullseries.append(s)
-                mq.series_dirty = True
+        # restore old series to preserve guards
+        mq.fullseries = original_series
+        mq.series_dirty = True
         mq.savedirty()
 
 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
--- a/tests/test-rebase-mq.t	Sun Jun 12 17:26:20 2011 +0300
+++ b/tests/test-rebase-mq.t	Sun Jun 12 17:26:58 2011 +0300
@@ -250,6 +250,7 @@
   $ hg qnew foo
   $ hg qguard foo +baz
   $ echo foo > foo
+  $ hg add foo
   $ hg qref
   $ hg qpop
   popping foo
@@ -258,6 +259,7 @@
   $ hg qnew bar
   $ hg qguard bar +baz
   $ echo bar > bar
+  $ hg add bar
   $ hg qref
 
   $ hg qguard -l
@@ -272,13 +274,13 @@
 Create new head to rebase bar onto:
 
   $ hg up -C 0
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo b > b
   $ hg add b
   $ hg ci -m b
   created new head
   $ hg up -C 1
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo a >> a
   $ hg qref
 
@@ -290,13 +292,19 @@
   o  0:* 'a' tags: qparent (glob)
   
 
-Rebase bar:
+Rebase bar (make sure series order is preserved):
 
+  $ hg qseries
+  bar
+  foo
   $ hg -q rebase -d 1
+  $ hg qseries
+  bar
+  foo
 
   $ hg qguard -l
+  bar: +baz
   foo: +baz
-  bar: +baz
 
   $ hg tglog
   @  2:* '[mq]: bar' tags: bar qbase qtip tip (glob)