Patchwork D3751: graft: start storing new nodes formed in graftstate

login
register
mail settings
Submitter phabricator
Date June 15, 2018, 8:09 p.m.
Message ID <differential-rev-PHID-DREV-udz2yxfvgybxrlcl6qbc-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32182/
State Superseded
Headers show

Comments

phabricator - June 15, 2018, 8:09 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch starts storing the new nodes formed during the ongoing graft
  operation in the graftstate. We need the list of new nodes formed while
  implmenting `graft --abort` which will strip out the new nodes.

REPOSITORY
  rHG Mercurial

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

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
@@ -2188,6 +2188,8 @@ 
     revs.extend(opts.get('rev'))
     # a dict of data to be stored in state file
     statedata = {}
+    # list of new nodes created by ongoing graft
+    statedata['newnodes'] = []
 
     if not opts.get('user') and opts.get('currentuser'):
         opts['user'] = ui.username()
@@ -2364,6 +2366,9 @@ 
             ui.warn(
                 _('note: graft of %d:%s created no changes to commit\n') %
                 (ctx.rev(), ctx))
+        # checking that newnodes exist because old state files won't have it
+        elif statedata.get('newnodes') is not None:
+            statedata['newnodes'].append(node)
 
     # remove state when we complete successfully
     if not opts.get('dry_run'):