changeset 3217:b6ba296532cb

prune: add support for storing a note in obsmarker
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 17 Nov 2017 03:13:52 +0530
parents 13cb0810ce22
children 772cc931f085
files hgext3rd/evolve/cmdrewrite.py tests/test-evolve-obshistory-complex.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Nov 17 03:06:06 2017 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Nov 17 03:13:52 2017 +0530
@@ -748,6 +748,7 @@
      ('s', 'succ', [], _("successor changeset")),
      ('r', 'rev', [], _("revisions to prune")),
      ('k', 'keep', None, _("does not modify working copy during prune")),
+     ('n', 'note', '', _('store a note on prune')),
      ('', 'biject', False, _("do a 1-1 map between rev and successor ranges")),
      ('', 'fold', False,
       _("record a fold (multiple precursors, one successors)")),
@@ -781,6 +782,7 @@
     must acknowledge it by passing ``--split``. Similarly, when you prune multiple
     changesets with a single successor, you must pass the ``--fold`` option.
     """
+    _checknotesize(opts)
     revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
     succs = opts['new'] + opts['succ']
     bookmarks = set(opts.get('bookmark'))
@@ -896,6 +898,10 @@
         if bookmarks:
             rewriteutil.deletebookmark(repo, repomarks, bookmarks)
 
+        # store note in metadata
+        if opts.get('note'):
+            metadata['note'] = opts['note']
+
         # create markers
         obsolete.createmarkers(repo, relations, metadata=metadata)
 
--- a/tests/test-evolve-obshistory-complex.t	Fri Nov 17 03:06:06 2017 +0530
+++ b/tests/test-evolve-obshistory-complex.t	Fri Nov 17 03:13:52 2017 +0530
@@ -305,7 +305,7 @@
 
   $ hg prune -s 12 -r 11
   1 changesets pruned
-  $ hg prune -s 14 -r 13
+  $ hg prune -s 14 -r 13 -n "this is a note stored in obsmarker in prune"
   1 changesets pruned
   $ hg log -G
   @  changeset:   15:d4a000f63ee9
@@ -410,6 +410,7 @@
   | | | | | |
   | +-------x  d0f33db50670 (13) fold1
   | | | | |      rewritten(description, parent, content) as ec31316faa9d by test (*) (glob)
+  | | | | |        note: 'this is a note stored in obsmarker in prune'
   | | | | |
   +---x | |  e036916b63ea (11) fold0
   | |  / /     rewritten(description, parent, content) as 7b3290f6e0a0 by test (*) (glob)