Mercurial > hg
changeset 38146:009aa4af5093
graft: factor out function to read graft state in separate function
Fatcoring out the logic in a separate function will help us in adding
conditional logic for different versions of graft state files.
Differential Revision: https://phab.mercurial-scm.org/D3651
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 25 May 2018 01:15:30 +0530 |
parents | 6f67bfe4b82f |
children | 58b08f4ce5f5 |
files | mercurial/commands.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri May 25 01:46:06 2018 +0530 +++ b/mercurial/commands.py Fri May 25 01:15:30 2018 +0530 @@ -2222,7 +2222,7 @@ raise error.Abort(_("can't specify --continue and revisions")) # read in unfinished revisions try: - nodes = repo.vfs.read('graftstate').splitlines() + nodes = _readgraftstate(repo)['nodes'] revs = [repo[node].rev() for node in nodes] except IOError as inst: if inst.errno != errno.ENOENT: @@ -2381,6 +2381,11 @@ return 0 +def _readgraftstate(repo): + """read the graft state file and return a dict of the data stored in it""" + nodes = repo.vfs.read('graftstate').splitlines() + return {'nodes': nodes} + @command('grep', [('0', 'print0', None, _('end fields with NUL')), ('', 'all', None, _('print all revisions that match')),