changeset 21965:fd7839d1107d stable

qimport: record imported revs incrementally (issue3874) When an import fails, this doesn't lose the state for the earlier revisions.
author Matt Mackall <mpm@selenic.com>
date Thu, 31 Jul 2014 16:32:12 -0500
parents ef555e456420
children be94ed4baa5d f582fa1167f7
files hgext/mq.py tests/test-mq-qimport.t
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu Jul 31 16:01:01 2014 -0500
+++ b/hgext/mq.py	Thu Jul 31 16:32:12 2014 -0500
@@ -1995,12 +1995,12 @@
                 self.added.append(patchname)
                 imported.append(patchname)
                 patchname = None
-            if rev and repo.ui.configbool('mq', 'secret', False):
-                # if we added anything with --rev, we must move the secret root
-                phases.retractboundary(repo, phases.secret, [n])
-            self.parseseries()
-            self.applieddirty = True
-            self.seriesdirty = True
+                if rev and repo.ui.configbool('mq', 'secret', False):
+                    # if we added anything with --rev, move the secret root
+                    phases.retractboundary(repo, phases.secret, [n])
+                self.parseseries()
+                self.applieddirty = True
+                self.seriesdirty = True
 
         for i, filename in enumerate(files):
             if existing:
--- a/tests/test-mq-qimport.t	Thu Jul 31 16:01:01 2014 -0500
+++ b/tests/test-mq-qimport.t	Thu Jul 31 16:32:12 2014 -0500
@@ -196,6 +196,14 @@
   now at: appendbar.diff
   $ hg qfin -a
   patch b.diff finalized without changeset message
+  $ touch .hg/patches/2.diff
+  $ hg qimport -r 'p1(.)::'
+  abort: patch "2.diff" already exists
+  [255]
+  $ hg qapplied
+  3.diff
+  $ hg qfin -a
+  $ rm .hg/patches/2.diff
   $ hg qimport -r 'p1(.)::' -P
   $ hg qpop -a
   popping 3.diff