Mercurial > evolve
changeset 3215:175b524b9a2b
touch: add support for storing a note in obsmarker
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 12 Nov 2017 01:54:13 +0530 |
parents | 9fe2b3fd7fc7 |
children | 13cb0810ce22 |
files | hgext3rd/evolve/cmdrewrite.py tests/test-touch.t |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Sun Nov 12 01:35:51 2017 +0530 +++ b/hgext3rd/evolve/cmdrewrite.py Sun Nov 12 01:54:13 2017 +0530 @@ -1004,6 +1004,7 @@ @eh.command( '^touch', [('r', 'rev', [], 'revision to update'), + ('n', 'note', '', _('store a note on touch')), ('D', 'duplicate', False, 'do not mark the new revision as successor of the old one'), ('A', 'allowdivergence', False, @@ -1017,6 +1018,7 @@ This is used to "resurrect" changesets """ + _checknotesize(opts) duplicate = opts['duplicate'] allowdivergence = opts['allowdivergence'] revs = list(revs) @@ -1080,7 +1082,11 @@ newmapping[ctx.node()] = new if not duplicate: - obsolete.createmarkers(repo, [(ctx, (repo[new],))]) + metadata = {} + if opts.get('note'): + metadata['note'] = opts['note'] + obsolete.createmarkers(repo, [(ctx, (repo[new],))], + metadata=metadata) phases.retractboundary(repo, tr, ctx.phase(), [new]) if ctx in repo[None].parents(): with repo.dirstate.parentchange():
--- a/tests/test-touch.t Sun Nov 12 01:35:51 2017 +0530 +++ b/tests/test-touch.t Sun Nov 12 01:54:13 2017 +0530 @@ -151,5 +151,11 @@ $ hg prune 13 1 changesets pruned - $ hg touch 13 --hidden + $ hg touch 13 --hidden --note "testing with no successor" 1 new orphan changesets + $ hg obslog -r 13 --hidden + x [0-9a-f]{12} (.*) move (re) + pruned by test (Thu Jan 01 00:00:00 1970 +0000) + rewritten(.*) as [0-9a-f]{12} by test (.*) (re) + note: 'testing with no successor' +