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, @@ -2184,7 +2185,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 = _oldgraftstate(fp) + nodes = stateopts['nodes'] revs = [repo[node].rev() for node in nodes] except IOError as inst: if inst.errno != errno.ENOENT: @@ -2343,6 +2346,11 @@ return 0 +@statemod.readoldstatefile('graftstate') +def _oldgraftstate(fp): + nodes = fp.read().splitlines() + return {'nodes': nodes} + @command('grep', [('0', 'print0', None, _('end fields with NUL')), ('', 'all', None, _('print all revisions that match')),