# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1510868671 -19800 # Node ID f0f4cc2febac611079df82eaebfbd9dc852a45ed # Parent b73bd280b21c5f15015f413c07976479ffef3bd0 uncommit: add support for storing a note in obsmarker diff -r b73bd280b21c -r f0f4cc2febac hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Fri Nov 17 03:14:20 2017 +0530 +++ b/hgext3rd/evolve/cmdrewrite.py Fri Nov 17 03:14:31 2017 +0530 @@ -300,6 +300,7 @@ [('a', 'all', None, _('uncommit all changes when no arguments given')), ('i', 'interactive', False, _('interactive mode to uncommit (EXPERIMENTAL)')), ('r', 'rev', '', _('revert commit content to REV instead')), + ('n', 'note', '', _('store a note on uncommit')), ] + commands.walkopts + commitopts + commitopts2 + commitopts3, _('[OPTION]... [NAME]')) def uncommit(ui, repo, *pats, **opts): @@ -325,6 +326,7 @@ Return 0 if changed files are uncommitted. """ + _checknotesize(opts) _resolveoptions(ui, opts) # process commitopts3 interactive = opts.get('interactive') wlock = lock = tr = None @@ -377,7 +379,12 @@ raise error.Abort(_('nothing to uncommit'), hint=_("use --all to uncommit all files")) - obsolete.createmarkers(repo, [(old, (repo[newid],))]) + # metadata to be stored in obsmarker + metadata = {} + if opts.get('note'): + metadata['note'] = opts['note'] + + obsolete.createmarkers(repo, [(old, (repo[newid],))], metadata=metadata) phases.retractboundary(repo, tr, oldphase, [newid]) with repo.dirstate.parentchange(): repo.dirstate.setparents(newid, node.nullid) diff -r b73bd280b21c -r f0f4cc2febac tests/test-tutorial.t --- a/tests/test-tutorial.t Fri Nov 17 03:14:20 2017 +0530 +++ b/tests/test-tutorial.t Fri Nov 17 03:14:31 2017 +0530 @@ -937,6 +937,7 @@ -a --all uncommit all changes when no arguments given -r --rev VALUE revert commit content to REV instead + -n --note VALUE store a note on uncommit -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns -m --message TEXT use text as commit message diff -r b73bd280b21c -r f0f4cc2febac tests/test-uncommit-interactive.t --- a/tests/test-uncommit-interactive.t Fri Nov 17 03:14:20 2017 +0530 +++ b/tests/test-uncommit-interactive.t Fri Nov 17 03:14:31 2017 +0530 @@ -220,7 +220,7 @@ 2 3 - $ hg uncommit -i< y > n > y @@ -293,6 +293,7 @@ | x 678a59e5ff90 (3) another one | rewritten(content) as 46e35360be47 by test (Thu Jan 01 00:00:00 1970 +0000) + | note: 'testing uncommit on dirty wdir' | x f70fb463d5bf (1) another one rewritten(content) as 678a59e5ff90 by test (Thu Jan 01 00:00:00 1970 +0000)