diff hgext/rebase.py @ 15904:7d28d6a67dd3

rebase: write series file without removed mq patches Rebase will remove empty changesets and will also completely remove the mq patch file for rebased empty patches. Starting with b28004513977 (1.9) it would preserve guards by writing the old series file back. That would however also reintroduce removed patch files in the series file and the inconsistency would make qpop + qpush fail. This patch backs out most of b28004513977 and makes sure guards are preserved without reintroducing removed patches.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 17 Jan 2012 02:55:55 +0100
parents 2305baff673f
children e66084ef8449
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Jan 17 17:48:59 2012 -0600
+++ b/hgext/rebase.py	Tue Jan 17 02:55:55 2012 +0100
@@ -460,9 +460,13 @@
                 mq.qimport(repo, (), patchname=name, git=isgit,
                                 rev=[str(state[rev])])
 
-        # restore old series to preserve guards
-        mq.fullseries = original_series
-        mq.series_dirty = True
+        # 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[mq.fullseries.index(pname)] = s
+                mq.series_dirty = True
         mq.savedirty()
 
 def updatebookmarks(repo, nstate, originalbookmarks, **opts):