D2594: graft: move logic to read current graft state file in state.py
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Fri Mar 9 10:55:56 UTC 2018
pulkit updated this revision to Diff 6760.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D2594?vs=6619&id=6760
REVISION DETAIL
https://phab.mercurial-scm.org/D2594
AFFECTED FILES
mercurial/commands.py
mercurial/state.py
CHANGE DETAILS
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -113,3 +113,8 @@
oldstatefilefns[path] = func
return func
return dec
+
+ at readoldstatefile('graftstate')
+def oldgraftstate(fp):
+ nodes = fp.read().splitlines()
+ return {'nodes': nodes}
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,
@@ -2174,7 +2175,9 @@
raise error.Abort(_("can't specify --continue and revisions"))
# read in unfinished revisions
try:
- nodes = repo.vfs.read('graftstate').splitlines()
+ with repo.vfs('graftstate', 'rb') as fp:
+ stateopts = statemod.oldgraftstate(fp)
+ nodes = stateopts['nodes']
revs = [repo[node].rev() for node in nodes]
except IOError as inst:
if inst.errno != errno.ENOENT:
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list