changeset 27677:128ef8828ed5

transplant: only use checkunfinished if not continue
author timeless <timeless@mozdev.org>
date Wed, 06 Jan 2016 04:59:21 +0000
parents 1c48f348f2d0
children b97004648028
files hgext/transplant.py tests/test-transplant.t
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/transplant.py	Tue Jan 05 22:46:04 2016 +0000
+++ b/hgext/transplant.py	Wed Jan 06 04:59:21 2016 +0000
@@ -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]
--- a/tests/test-transplant.t	Tue Jan 05 22:46:04 2016 +0000
+++ b/tests/test-transplant.t	Wed Jan 06 04:59:21 2016 +0000
@@ -410,6 +410,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