Patchwork D3651: graft: factor out function to read graft state in separate function

login
register
mail settings
Submitter phabricator
Date May 25, 2018, 4:17 p.m.
Message ID <07ed2952bb41cd903d8f799c538e4f40@localhost.localdomain>
Download mbox | patch
Permalink /patch/31858/
State Not Applicable
Headers show

Comments

phabricator - May 25, 2018, 4:17 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG009aa4af5093: graft: factor out function to read graft state in separate function (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3651?vs=8882&id=8889

REVISION DETAIL
  https://phab.mercurial-scm.org/D3651

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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')),