diff mercurial/commands.py @ 32486:1df80eff24cf

annotate: add a new experimental --skip option to skip revs This option is most useful for mechanical code modifications, especially ones that retain the same number of lines.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 24 May 2017 19:39:33 -0700
parents 579df5aaa425
children 37d70ba1d9d1
line wrap: on
line diff
--- a/mercurial/commands.py	Wed May 24 19:07:14 2017 -0700
+++ b/mercurial/commands.py	Wed May 24 19:39:33 2017 -0700
@@ -262,7 +262,8 @@
     ('d', 'date', None, _('list the date (short with -q)')),
     ('n', 'number', None, _('list the revision number (default)')),
     ('c', 'changeset', None, _('list the changeset')),
-    ('l', 'line-number', None, _('show line number at the first appearance'))
+    ('l', 'line-number', None, _('show line number at the first appearance')),
+    ('', 'skip', [], _('revision to not display (EXPERIMENTAL)'), _('REV')),
     ] + diffwsopts + walkopts + formatteropts,
     _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
     inferrepo=True)
@@ -368,6 +369,10 @@
     follow = not opts.get('no_follow')
     diffopts = patch.difffeatureopts(ui, opts, section='annotate',
                                      whitespace=True)
+    skiprevs = opts.get('skip')
+    if skiprevs:
+        skiprevs = scmutil.revrange(repo, skiprevs)
+
     for abs in ctx.walk(m):
         fctx = ctx[abs]
         if not opts.get('text') and fctx.isbinary():
@@ -375,7 +380,7 @@
             continue
 
         lines = fctx.annotate(follow=follow, linenumber=linenumber,
-                              diffopts=diffopts)
+                              skiprevs=skiprevs, diffopts=diffopts)
         if not lines:
             continue
         formats = []