D3657: graft: store user passed date and user information in graftstate

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri May 25 20:52:19 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

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



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


More information about the Mercurial-devel mailing list