--- a/hgext3rd/evolve/cmdrewrite.py Fri Nov 17 03:13:52 2017 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py Fri Nov 17 03:14:08 2017 +0530
@@ -605,6 +605,7 @@
'^metaedit',
[('r', 'rev', [], _("revision to edit")),
('', 'fold', None, _("also fold specified revisions into one")),
+ ('n', 'note', '', _('store a note on metaedit')),
] + commitopts + commitopts2 + commitopts3,
_('hg metaedit [OPTION]... [-r] [REV]'))
def metaedit(ui, repo, *revs, **opts):
@@ -636,6 +637,7 @@
See :hg:`help phases` for more about draft revisions, and
:hg:`help revsets` for more about the `draft()` and `only()` keywords.
"""
+ _checknotesize(opts)
_resolveoptions(ui, opts)
revs = list(revs)
revs.extend(opts['rev'])
@@ -709,9 +711,15 @@
if created:
if p1.rev() in revs:
newp1 = newid
+ # metadata to be stored on obsmarker
+ metadata = {}
+ if opts.get('note'):
+ metadata['note'] = opts['note']
+
phases.retractboundary(repo, tr, targetphase, [newid])
obsolete.createmarkers(repo, [(ctx, (repo[newid],))
- for ctx in allctx])
+ for ctx in allctx],
+ metadata=metadata)
else:
ui.status(_("nothing changed\n"))
tr.close()
--- a/tests/test-metaedit.t Fri Nov 17 03:13:52 2017 +0530
+++ b/tests/test-metaedit.t Fri Nov 17 03:14:08 2017 +0530
@@ -134,7 +134,7 @@
abort: editing multiple revisions without --fold is not currently supported
[255]
- $ HGEDITOR=cat hg metaedit '.^::.' --fold
+ $ HGEDITOR=cat hg metaedit '.^::.' --fold --note "folding changesets using metaedit"
HG: This is a fold of 2 changesets.
HG: Commit message of changeset 6.
@@ -161,6 +161,21 @@
|
~
+ $ hg obslog -r .
+ @ a08d35fd7d9d (9) E
+ |\
+ x | 212b2a2b87cd (8) F
+ | | rewritten(description, user, parent, content) as a08d35fd7d9d by test (Thu Jan 01 00:00:00 1970 +0000)
+ | | note: 'folding changesets using metaedit'
+ | |
+ | x c2bd843aa246 (6) E
+ | rewritten(description, content) as a08d35fd7d9d by test (Thu Jan 01 00:00:00 1970 +0000)
+ | note: 'folding changesets using metaedit'
+ |
+ x 587528abfffe (7) F
+ rewritten(user) as 212b2a2b87cd by test (Thu Jan 01 00:00:00 1970 +0000)
+
+
no new commit is created here because the date is the same
$ HGEDITOR=cat hg metaedit
E