Patchwork [7,of,8] commands: disallow 'hg debugobsolete --index --rev <smth>'

login
register
mail settings
Submitter Jun Wu
Date April 7, 2016, 2:51 a.m.
Message ID <84deb23ba221e545aca3.1459997494@waste.org>
Download mbox | patch
Permalink /patch/14417/
State Accepted
Commit 2637d6ad3e61cc8bcc16529a5a6124169f41c94f
Headers show

Comments

Jun Wu - April 7, 2016, 2:51 a.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1459549231 25200
#      Fri Apr 01 15:20:31 2016 -0700
# Node ID 84deb23ba221e545aca3930d6ba9deed78200225
# Parent  94ab422cbc95322cc95f786bf00921c8d2b2fdec
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.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3095,6 +3095,9 @@ 
         finally:
             l.release()
     else:
+        if opts.get('rev') and opts.get('index'):
+            hint = _("call 'hg debugobsolete --index' without other arguments")
+            raise error.Abort(_("cannot use --index with --rev"), hint=hint)
         if opts['rev']:
             revs = scmutil.revrange(repo, opts['rev'])
             nodes = [repo[r].node() for r in revs]