pulkit updated this revision to Diff 7302.
pulkit edited the summary of this revision.
pulkit retitled this revision from "graft: start using the new state file" to 
"graft: start using the new state file class".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2595?vs=7107&id=7302

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2179,19 +2179,17 @@
                                      **pycompat.strkwargs(opts))
 
     cont = False
+    cmdstate = 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:
-            with repo.vfs('graftstate', 'rb') as fp:
-                stateopts = _oldgraftstate(fp)
-                nodes = stateopts['nodes']
+        if cmdstate:
+            cmdstate.load()
+            nodes = cmdstate['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:
@@ -2316,8 +2314,9 @@
             # report any conflicts
             if stats.unresolvedcount > 0:
                 # write out state for --continue
-                nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
-                repo.vfs.write('graftstate', ''.join(nodelines))
+                nodelines = [repo[rev].hex() for rev in revs[pos:]]
+                cmdstate.addopts({'nodes': nodelines})
+                cmdstate.save()
                 extra = ''
                 if opts.get('user'):
                     extra += ' --user %s' % procutil.shellquote(opts['user'])



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to