Mercurial > hg
changeset 28613:6433da9c96a9
debugobsolete: add an option to show marker index
A bigger picture is the ability to be delete an arbitrary marker form the
repo's obsstore. This is a useful debug ability and it needs a way to indentify
the marker one wants to delete. Having a marker's index provides such an
ability.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Wed, 23 Mar 2016 10:50:24 -0700 |
parents | 6fb1d3c936d2 |
children | b927fe8bf0b9 |
files | mercurial/cmdutil.py mercurial/commands.py tests/test-completion.t tests/test-obsolete.t |
diffstat | 4 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Mar 15 09:51:42 2016 +0000 +++ b/mercurial/cmdutil.py Wed Mar 23 10:50:24 2016 -0700 @@ -1597,10 +1597,12 @@ raise error.Abort(inst.args[0]) return t -def showmarker(ui, marker): +def showmarker(ui, marker, index=None): """utility function to display obsolescence marker in a readable way To be used by debug function.""" + if index is not None: + ui.write("%i " % index) ui.write(hex(marker.precnode())) for repl in marker.succnodes(): ui.write(' ')
--- a/mercurial/commands.py Tue Mar 15 09:51:42 2016 +0000 +++ b/mercurial/commands.py Wed Mar 23 10:50:24 2016 -0700 @@ -3029,6 +3029,7 @@ ('', 'record-parents', False, _('record parent information for the precursor')), ('r', 'rev', [], _('display markers relevant to REV')), + ('', 'index', False, _('display index of the marker')), ] + commitopts2, _('[OBSOLETED [REPLACEMENT ...]]')) def debugobsolete(ui, repo, precursor=None, *successors, **opts): @@ -3091,8 +3092,9 @@ else: markers = obsolete.getmarkers(repo) - for m in markers: - cmdutil.showmarker(ui, m) + for i, m in enumerate(markers): + ind = i if opts.get('index') else None + cmdutil.showmarker(ui, m, index=ind) @command('debugpathcomplete', [('f', 'full', None, _('complete an entire path')),
--- a/tests/test-completion.t Tue Mar 15 09:51:42 2016 +0000 +++ b/tests/test-completion.t Wed Mar 23 10:50:24 2016 -0700 @@ -261,7 +261,7 @@ debuglocks: force-lock, force-wlock debugmergestate: debugnamecomplete: - debugobsolete: flags, record-parents, rev, date, user + debugobsolete: flags, record-parents, rev, index, date, user debugpathcomplete: full, normal, added, removed debugpushkey: debugpvec:
--- a/tests/test-obsolete.t Tue Mar 15 09:51:42 2016 +0000 +++ b/tests/test-obsolete.t Wed Mar 23 10:50:24 2016 -0700 @@ -129,6 +129,13 @@ ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'} 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'} +Test the --index option of debugobsolete command + $ hg debugobsolete --index + 0 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'} + 1 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'} + 2 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'} + 3 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'} + Refuse pathological nullid successors $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000 transaction abort!