Commits

Anonymous committed 06100fb

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.

Comments (0)

Files changed (3)

 
 @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):
         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()],

tests/test-evolve.t

   $ cat >> $HGRCPATH <<EOF
   > [defaults]
   > amend=-d "0 0"
+  > fold=-d "0 0"
   > [web]
   > push_ssl = false
   > allow_push = *
   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
   |
 
   $ 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
   

tests/test-tutorial.t

   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