[PATCH] debugobsolete: add an option to show marker index

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 22 20:37:16 EDT 2016



On 03/22/2016 05:25 PM, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1458692297 25200
> #      Tue Mar 22 17:18:17 2016 -0700
> # Node ID 4d1ad81191085e3a4155a446a3c1e174d121e8b8
> # Parent  c11f0992d1246286a6a0b2531ff5f31948abcf58
> debugobsolete: add an option to show marker index

We'll want at least a test for that.

>
> 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.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1597,10 +1597,12 @@ def show_changeset(ui, repo, opts, buffe
>           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(' ')
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3029,6 +3029,7 @@ def debuglocks(ui, repo, **opts):
>            ('', '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 @@ def debugobsolete(ui, repo, precursor=No
>           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')),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list