D3659: graft: reuse --user and --date values in `hg graft --continue` (BC)

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


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

REVISION SUMMARY
  Reading the user and date information from graftstate during `hg graft
  --continue` will help us in preserving the user and date arguments passed when
  `hg graft` was called. This patch reads that information and reuses that while
  running `hg graft --continue`. So after this patch, --user and --date values are
  preserved even if conflicts occur and user don't need to pass them again.
  
  The test changes demonstrate the fix.
  
  This is a backward incompatible change but I think of this more as a bug fix.
  Also thinking about removing the line from `hg help graft` which says --continue
  does not reapply other flags but need to check what are the other flags which
  needs to be preserved.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-graft.t

CHANGE DETAILS

diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -1468,17 +1468,16 @@
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
-XXX: the user of 6 and 7 should be batman
   $ hg log -Gr 3::
-  @  changeset:   7:89f377552d81
+  @  changeset:   7:11a36ffaacf2
   |  tag:         tip
-  |  user:        test
+  |  user:        batman
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     added c
   |
-  o  changeset:   6:393512ff89b9
+  o  changeset:   6:76803afc6511
   |  parent:      3:9e887f7a939c
-  |  user:        test
+  |  user:        batman
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     added b
   |
@@ -1518,18 +1517,17 @@
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
-XXX: 8 and 9 show have the date we passed
   $ hg log -Gr '.^^::.'
-  @  changeset:   9:7ee8d3496b19
+  @  changeset:   9:1896b76e007a
   |  tag:         tip
   |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  date:        Fri Feb 13 21:18:00 2009 -0002
   |  summary:     added c
   |
-  o  changeset:   8:802f1eae3af3
+  o  changeset:   8:ce2b4f1632af
   |  parent:      3:9e887f7a939c
   |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  date:        Fri Feb 13 21:18:00 2009 -0002
   |  summary:     added b
   |
   o  changeset:   3:9e887f7a939c
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2226,7 +2226,12 @@
             raise error.Abort(_("can't specify --continue and revisions"))
         # read in unfinished revisions
         if graftstate.exists():
-            nodes = _readgraftstate(repo, graftstate)['nodes']
+            statedata = _readgraftstate(repo, graftstate)
+            if statedata.get('date'):
+                opts['date'] = statedata['date']
+            if statedata.get('user'):
+                opts['user'] = statedata['user']
+            nodes = statedata['nodes']
             revs = [repo[node].rev() for node in nodes]
         else:
             cmdutil.wrongtooltocontinue(repo, _('graft'))



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


More information about the Mercurial-devel mailing list