D2595: graft: start using the new state file
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Mar 3 19:20:01 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
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
@@ -2169,19 +2169,17 @@
**pycompat.strkwargs(opts))
cont = False
+ cmdstate = state.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 = state.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:
cmdutil.checkunfinished(repo)
@@ -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'])
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list