Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
32518:05abc47f3746 | 32519:1df80eff24cf |
---|---|
947 p = self.parents() | 947 p = self.parents() |
948 if len(p) == 2: | 948 if len(p) == 2: |
949 return p[1] | 949 return p[1] |
950 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) | 950 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) |
951 | 951 |
952 def annotate(self, follow=False, linenumber=False, diffopts=None): | 952 def annotate(self, follow=False, linenumber=False, skiprevs=None, |
953 diffopts=None): | |
953 '''returns a list of tuples of ((ctx, number), line) for each line | 954 '''returns a list of tuples of ((ctx, number), line) for each line |
954 in the file, where ctx is the filectx of the node where | 955 in the file, where ctx is the filectx of the node where |
955 that line was last changed; if linenumber parameter is true, number is | 956 that line was last changed; if linenumber parameter is true, number is |
956 the line number at the first appearance in the managed file, otherwise, | 957 the line number at the first appearance in the managed file, otherwise, |
957 number has a fixed value of False. | 958 number has a fixed value of False. |
1042 ready = False | 1043 ready = False |
1043 visit.append(p) | 1044 visit.append(p) |
1044 if ready: | 1045 if ready: |
1045 visit.pop() | 1046 visit.pop() |
1046 curr = decorate(f.data(), f) | 1047 curr = decorate(f.data(), f) |
1047 curr = _annotatepair([hist[p] for p in pl], f, curr, False, | 1048 skipchild = False |
1049 if skiprevs is not None: | |
1050 skipchild = f._changeid in skiprevs | |
1051 curr = _annotatepair([hist[p] for p in pl], f, curr, skipchild, | |
1048 diffopts) | 1052 diffopts) |
1049 for p in pl: | 1053 for p in pl: |
1050 if needed[p] == 1: | 1054 if needed[p] == 1: |
1051 del hist[p] | 1055 del hist[p] |
1052 del needed[p] | 1056 del needed[p] |