diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2169,19 +2169,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 = statemod.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: @@ -2306,8 +2304,9 @@ # report any conflicts if stats and stats[3] > 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' % util.shellquote(opts['user'])