[PATCH 1 of 2] commands: disallow 'hg debugobsolete --index --rev <smth>'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Apr 1 14:25:48 EDT 2016



On 04/01/2016 08:56 AM, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1459523561 25200
> #      Fri Apr 01 08:12:41 2016 -0700
> # Node ID d4fc1ec31c6666d85eb2e8c174f6c231546ad8fd
> # Parent  1490e850cffc0103fd42714cf1245a55bcbdc4a6
> commands: disallow 'hg debugobsolete --index --rev <smth>'
>
> A bug in the original --index implementation. The goal of --index is to allow
> unique obsmarker identification that would be consistent between invocations
> of this command in the unchanged repo. Further goal is to use this index to
> delete arbitrary obsmarkers. So calling --index together with --rev would
> cause obsmarker indices to be different than just calling --index. This is
> not desired and current pattern for getting the index of an interesting
> obsmarker is: `$ hg debugobsolete --index | grep <interesting hash>`.
> It would clearly be better if we could somehow compute a hash of an obsmarker
> and use it to identify the one we want to delete, but it seems a bit too
> heavy for our current goals, so we can do this later if we want.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3100,6 +3100,9 @@ def debugobsolete(ui, repo, precursor=No
>           finally:
>               l.release()
>       else:
> +        if opts.get('rev') and opts.get('index'):
> +            hint = _("call 'hg debugobsolete --index' without other arguments")
> +            raise error.Abort(_("can't use --index with --rev"), hint=hint)

We usually use the full form "cannot use --index with --rev".

Note that we could have that working properly if we change the way --rev 
is implemented in the --index case. We could select the relevant markers 
then iterate over all markers, printing only the relevant one (with 
there global index). If you feel like it is easy enough to do, this 
would probably be a better move.

>           if opts['rev']:
>               revs = scmutil.revrange(repo, opts['rev'])
>               nodes = [repo[r].node() for r in revs]

We probably want a test for this

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list