fold: enable --date and --user options
authorJordi Gutiérrez Hermoso <jordigh@octave.org>
Fri, 11 Apr 2014 19:24:29 -0400
changeset 908 06100fbc05e5
parent 907 c17ab719da56
child 909 ff71b83a4bbe
fold: enable --date and --user options Like all other commit-creating commits, `hg fold` should also have these options enabled. This also allows getting consistent hashes during tests involving fold.
hgext/evolve.py
tests/test-evolve.t
tests/test-tutorial.t
--- a/hgext/evolve.py	Tue Apr 22 17:04:40 2014 -0700
+++ b/hgext/evolve.py	Fri Apr 11 19:24:29 2014 -0400
@@ -1982,7 +1982,7 @@
 
 @command('^fold',
     [('r', 'rev', [], _("explicitly specify the full set of revision to fold")),
-    ],
+    ] + commitopts2,
     # allow to choose the seed ?
     _('rev'))
 def fold(ui, repo, *revs, **opts):
@@ -2023,12 +2023,13 @@
         lock = repo.lock()
         tr = repo.transaction('touch')
         try:
+            commitopts = opts.copy()
             allctx = [repo[r] for r in revs]
             targetphase = max(c.phase() for c in allctx)
             msgs = ["HG: This is a fold of %d changesets." % len(allctx)]
             msgs += ["HG: Commit message of changeset %s.\n\n%s\n" %
                      (c.rev(), c.description()) for c in allctx]
-            commitopts = {'message': "\n".join(msgs)}
+            commitopts['message'] = "\n".join(msgs)
             commitopts['edit'] = True
             newid, _ = rewrite(repo, root, allctx, head,
                              [root.p1().node(), root.p2().node()],
--- a/tests/test-evolve.t	Tue Apr 22 17:04:40 2014 -0700
+++ b/tests/test-evolve.t	Fri Apr 11 19:24:29 2014 -0400
@@ -1,6 +1,7 @@
   $ cat >> $HGRCPATH <<EOF
   > [defaults]
   > amend=-d "0 0"
+  > fold=-d "0 0"
   > [web]
   > push_ssl = false
   > allow_push = *
@@ -600,7 +601,7 @@
   2 changesets folded
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ glog
-  @  11:*@default(draft) add 1 (glob)
+  @  11:dd4682c1a481@default(draft) add 1
   |
   o  5:0b9e50c35132@default(draft) add 3
   |
@@ -622,16 +623,20 @@
 
   $ hg up 4
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ hg fold --rev 4::11
+  $ hg fold --rev 4::11 --user victor
   3 changesets folded
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ glog
-  @  12:*@default(draft) add 4 (glob)
+  @  12:d26d339c513f@default(draft) add 4
   |
   | o  1:73d38bb17fd7@default(draft) add 1
   |/
   o  0:8685c6d34325@default(draft) add 0
   
+  $ hg log --template '{rev}: {author}\n'
+  12: victor
+  1: test
+  0: test
   $ hg log -r 12 --template '{desc}\n'
   add 4
   
--- a/tests/test-tutorial.t	Tue Apr 22 17:04:40 2014 -0700
+++ b/tests/test-tutorial.t	Fri Apr 11 19:24:29 2014 -0400
@@ -487,6 +487,8 @@
   options:
   
    -r --rev VALUE [+] explicitly specify the full set of revision to fold
+   -d --date DATE     record the specified date as commit date
+   -u --user USER     record the specified user as committer
   
   [+] marked option can be specified multiple times