changeset 38185:63553c2bef7e

graft: store user passed date and user information in graftstate Right now, `hg help graft` says: The -c/--continue option does not reapply earlier options, except for --force. which should be treated as a bug. A good user experience is that the commands remember the arguments passed initially and preserve them during `hg graft --continue`. This patch starts storing the user and date information in graftstate if user passed it. Upcoming patches will make sure we preserve that information during --continue and them don't allow user to pass any new arguments with --continue. I don't think there is any another `--continue` flag which allows new options to be passed with it. Differential Revision: https://phab.mercurial-scm.org/D3657
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 25 May 2018 16:14:15 +0530
parents 0dfa27e53c57
children 108ebd8eff5c
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri May 25 16:00:37 2018 +0530
+++ b/mercurial/commands.py	Fri May 25 16:14:15 2018 +0530
@@ -2207,6 +2207,8 @@
 
     revs = list(revs)
     revs.extend(opts.get('rev'))
+    # a dict of data to be stored in state file
+    statedata = {}
 
     if not opts.get('user') and opts.get('currentuser'):
         opts['user'] = ui.username()
@@ -2330,9 +2332,11 @@
         user = ctx.user()
         if opts.get('user'):
             user = opts['user']
+            statedata['user'] = user
         date = ctx.date()
         if opts.get('date'):
             date = opts['date']
+            statedata['date'] = date
         message = ctx.description()
         if opts.get('log'):
             message += '\n(grafted from %s)' % ctx.hex()
@@ -2352,7 +2356,7 @@
             if stats.unresolvedcount > 0:
                 # write out state for --continue
                 nodes = [repo[rev].hex() for rev in revs[pos:]]
-                statedata = {'nodes': nodes}
+                statedata['nodes'] = nodes
                 stateversion = 1
                 graftstate.save(stateversion, statedata)
                 extra = ''