diff mercurial/context.py @ 32519: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 05abc47f3746
children 6ae068f801e3
line wrap: on
line diff
--- a/mercurial/context.py	Wed May 24 19:07:14 2017 -0700
+++ b/mercurial/context.py	Wed May 24 19:39:33 2017 -0700
@@ -949,7 +949,8 @@
             return p[1]
         return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
 
-    def annotate(self, follow=False, linenumber=False, diffopts=None):
+    def annotate(self, follow=False, linenumber=False, skiprevs=None,
+                 diffopts=None):
         '''returns a list of tuples of ((ctx, number), line) for each line
         in the file, where ctx is the filectx of the node where
         that line was last changed; if linenumber parameter is true, number is
@@ -1044,7 +1045,10 @@
             if ready:
                 visit.pop()
                 curr = decorate(f.data(), f)
-                curr = _annotatepair([hist[p] for p in pl], f, curr, False,
+                skipchild = False
+                if skiprevs is not None:
+                    skipchild = f._changeid in skiprevs
+                curr = _annotatepair([hist[p] for p in pl], f, curr, skipchild,
                                      diffopts)
                 for p in pl:
                     if needed[p] == 1: