Patchwork D3652: graft: use state.cmdstate() to check whether graftstate exists

login
register
mail settings
Submitter phabricator
Date May 25, 2018, 4:17 p.m.
Message ID <cd89b00b26aa1dad080c298b3d4f8183@localhost.localdomain>
Download mbox | patch
Permalink /patch/31859/
State Not Applicable
Headers show

Comments

phabricator - May 25, 2018, 4:17 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG58b08f4ce5f5: graft: use state.cmdstate() to check whether graftstate exists (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3652?vs=8883&id=8890

REVISION DETAIL
  https://phab.mercurial-scm.org/D3652

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -54,6 +54,7 @@ 
     rewriteutil,
     scmutil,
     server,
+    state as statemod,
     streamclone,
     tags as tagsmod,
     templatekw,
@@ -2216,17 +2217,16 @@ 
                                      **pycompat.strkwargs(opts))
 
     cont = False
+    graftstate = statemod.cmdstate(repo, 'graftstate')
     if opts.get('continue'):
         cont = True
         if revs:
             raise error.Abort(_("can't specify --continue and revisions"))
         # read in unfinished revisions
-        try:
+        if graftstate.exists():
             nodes = _readgraftstate(repo)['nodes']
             revs = [repo[node].rev() for node in nodes]
-        except IOError as inst:
-            if inst.errno != errno.ENOENT:
-                raise
+        else:
             cmdutil.wrongtooltocontinue(repo, _('graft'))
     else:
         if not revs: