comparison mercurial/context.py @ 37065:b235bde38a83

annotate: drop linenumber flag from fctx.annotate() (API) Now linenumber=True is fast enough to be enabled by default.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 13 Mar 2018 22:18:06 +0900
parents 5d3abd6a5b25
children b33b91ca2ec2
comparison
equal deleted inserted replaced
37064:434e520adb8c 37065:b235bde38a83
965 p = self.parents() 965 p = self.parents()
966 if len(p) == 2: 966 if len(p) == 2:
967 return p[1] 967 return p[1]
968 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) 968 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
969 969
970 def annotate(self, follow=False, linenumber=False, skiprevs=None, 970 def annotate(self, follow=False, skiprevs=None, diffopts=None):
971 diffopts=None): 971 """Returns a list of tuples of (attr, line) for each line in the file
972 '''returns a list of tuples of ((ctx, number), line) for each line 972
973 in the file, where ctx is the filectx of the node where 973 - attr.fctx is the filectx of the node where that line was last changed
974 that line was last changed; if linenumber parameter is true, number is 974 - attr.lineno is the line number at the first appearance in the managed
975 the line number at the first appearance in the managed file, otherwise, 975 file
976 number has a fixed value of False. 976 """
977 '''
978 getlog = util.lrucachefunc(lambda x: self._repo.file(x)) 977 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
979 978
980 def parents(f): 979 def parents(f):
981 # Cut _descendantrev here to mitigate the penalty of lazy linkrev 980 # Cut _descendantrev here to mitigate the penalty of lazy linkrev
982 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog 981 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog
1008 inclusive=True) 1007 inclusive=True)
1009 else: 1008 else:
1010 ac = cl.ancestors([base.rev()], inclusive=True) 1009 ac = cl.ancestors([base.rev()], inclusive=True)
1011 base._ancestrycontext = ac 1010 base._ancestrycontext = ac
1012 1011
1013 return dagop.annotate(base, parents, linenumber=linenumber, 1012 return dagop.annotate(base, parents, skiprevs=skiprevs,
1014 skiprevs=skiprevs, diffopts=diffopts) 1013 diffopts=diffopts)
1015 1014
1016 def ancestors(self, followfirst=False): 1015 def ancestors(self, followfirst=False):
1017 visit = {} 1016 visit = {}
1018 c = self 1017 c = self
1019 if followfirst: 1018 if followfirst: