[PATCH 1 of 4 evolve-ext] fold: enable --date and --user options

Jordi Gutiérrez Hermoso jordigh at octave.org
Sat Apr 12 02:02:57 UTC 2014


# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1397258669 14400
#      Fri Apr 11 19:24:29 2014 -0400
# Branch stable
# Node ID c5b806b24aadeb64ff32476b850d521f0bc37bef
# Parent  12ed6dfa8eead0deb3b3062df1466e63c1e54640
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.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1722,7 +1722,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):
@@ -1763,12 +1763,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()],
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1,6 +1,7 @@
   $ cat >> $HGRCPATH <<EOF
   > [defaults]
   > amend=-d "0 0"
+  > fold=-d "0 0"
   > [web]
   > push_ssl = false
   > allow_push = *
@@ -593,7 +594,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 at default(draft) add 1
   |
   o  5:0b9e50c35132 at default(draft) add 3
   |
@@ -619,7 +620,7 @@
   3 changesets folded
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ glog
-  @  12:*@default(draft) add 4 (glob)
+  @  12:c3cfb9017ff6 at default(draft) add 4
   |
   | o  1:73d38bb17fd7 at default(draft) add 1
   |/


More information about the Mercurial-devel mailing list