changeset 38451:3c07e0b1f6c6

graft: start storing new nodes formed in graftstate 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. Differential Revision: https://phab.mercurial-scm.org/D3751
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 15 Jun 2018 02:34:27 +0530
parents b45c353ebbc7
children afb7e15392b9
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Jun 14 23:22:51 2018 +0900
+++ b/mercurial/commands.py	Fri Jun 15 02:34:27 2018 +0530
@@ -2186,6 +2186,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()
@@ -2362,6 +2364,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'):