[PATCH 3 of 4] transplant: only use checkunfinished if not continue

timeless timeless at mozdev.org
Tue Jan 5 23:12:36 CST 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1452056361 0
#      Wed Jan 06 04:59:21 2016 +0000
# Node ID ca8dfff2add30ea34a82ab8eb9cc70aeb552d381
# Parent  8f40cd2a9924a0f024a58dcda5d737347849b87b
transplant: only use checkunfinished if not continue

diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -303,6 +303,9 @@
 
         return n
 
+    def canresume(self):
+        return os.path.exists(os.path.join(self.path, 'journal'))
+
     def resume(self, repo, source, opts):
         '''recover last transaction and apply remaining changesets'''
         if os.path.exists(os.path.join(self.path, 'journal')):
@@ -627,11 +630,14 @@
 
     tp = transplanter(ui, repo, opts)
 
-    cmdutil.checkunfinished(repo)
     p1, p2 = repo.dirstate.parents()
     if len(repo) > 0 and p1 == revlog.nullid:
         raise error.Abort(_('no revision checked out'))
-    if not opts.get('continue'):
+    if opts.get('continue'):
+        if not tp.canresume():
+            raise error.Abort(_('no transplant to continue'))
+    else:
+        cmdutil.checkunfinished(repo)
         if p2 != revlog.nullid:
             raise error.Abort(_('outstanding uncommitted merges'))
         m, a, r, d = repo.status()[:4]
diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -376,6 +376,9 @@
   $ hg up -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm added
+  $ hg transplant --continue
+  abort: no transplant to continue
+  [255]
   $ hg transplant 1
   applying 46ae92138f3c
   patching file foo


More information about the Mercurial-devel mailing list