Show More
@@ -918,27 +918,20 b' class basefilectx(object):' | |||||
918 | return p[1] |
|
918 | return p[1] | |
919 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) |
|
919 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) | |
920 |
|
920 | |||
921 |
def annotate(self, follow=False, linenumber= |
|
921 | def annotate(self, follow=False, linenumber=False, diffopts=None): | |
922 | '''returns a list of tuples of (ctx, line) for each line |
|
922 | '''returns a list of tuples of ((ctx, number), line) for each line | |
923 | in the file, where ctx is the filectx of the node where |
|
923 | in the file, where ctx is the filectx of the node where | |
924 |
that line was last changed |
|
924 | that line was last changed; if linenumber parameter is true, number is | |
925 | This returns tuples of ((ctx, linenumber), line) for each line, |
|
925 | the line number at the first appearance in the managed file, otherwise, | |
926 | if "linenumber" parameter is NOT "None". |
|
926 | number has a fixed value of False. | |
927 | In such tuples, linenumber means one at the first appearance |
|
927 | ''' | |
928 | in the managed file. |
|
|||
929 | To reduce annotation cost, |
|
|||
930 | this returns fixed value(False is used) as linenumber, |
|
|||
931 | if "linenumber" parameter is "False".''' |
|
|||
932 |
|
928 | |||
933 | def lines(text): |
|
929 | def lines(text): | |
934 | if text.endswith("\n"): |
|
930 | if text.endswith("\n"): | |
935 | return text.count("\n") |
|
931 | return text.count("\n") | |
936 | return text.count("\n") + 1 |
|
932 | return text.count("\n") + 1 | |
937 |
|
933 | |||
938 |
if linenumber |
|
934 | if linenumber: | |
939 | def decorate(text, rev): |
|
|||
940 | return ([rev] * lines(text), text) |
|
|||
941 | elif linenumber: |
|
|||
942 | def decorate(text, rev): |
|
935 | def decorate(text, rev): | |
943 | return ([(rev, i) for i in xrange(1, lines(text) + 1)], text) |
|
936 | return ([(rev, i) for i in xrange(1, lines(text) + 1)], text) | |
944 | else: |
|
937 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now