equal
deleted
inserted
replaced
73 def _decorate(fctx): |
73 def _decorate(fctx): |
74 text = fctx.data() |
74 text = fctx.data() |
75 linecount = text.count(b'\n') |
75 linecount = text.count(b'\n') |
76 if text and not text.endswith(b'\n'): |
76 if text and not text.endswith(b'\n'): |
77 linecount += 1 |
77 linecount += 1 |
78 return ([(fctx, i) for i in pycompat.xrange(linecount)], text) |
78 return ([(fctx, i) for i in range(linecount)], text) |
79 |
79 |
80 |
80 |
81 # extracted from mercurial.context.basefilectx.annotate. slightly modified |
81 # extracted from mercurial.context.basefilectx.annotate. slightly modified |
82 # so it takes an extra "blocks" parameter calculated elsewhere, instead of |
82 # so it takes an extra "blocks" parameter calculated elsewhere, instead of |
83 # calculating diff here. |
83 # calculating diff here. |
575 # [llrev] |
575 # [llrev] |
576 revs = [revmap.hsh2rev(l[0]) for l in annotateresult] |
576 revs = [revmap.hsh2rev(l[0]) for l in annotateresult] |
577 result = [None] * len(annotateresult) |
577 result = [None] * len(annotateresult) |
578 # {(rev, linenum): [lineindex]} |
578 # {(rev, linenum): [lineindex]} |
579 key2idxs = collections.defaultdict(list) |
579 key2idxs = collections.defaultdict(list) |
580 for i in pycompat.xrange(len(result)): |
580 for i in range(len(result)): |
581 key2idxs[(revs[i], annotateresult[i][1])].append(i) |
581 key2idxs[(revs[i], annotateresult[i][1])].append(i) |
582 while key2idxs: |
582 while key2idxs: |
583 # find an unresolved line and its linelog rev to annotate |
583 # find an unresolved line and its linelog rev to annotate |
584 hsh = None |
584 hsh = None |
585 try: |
585 try: |