967 return ([(rev, i) for i in xrange(1, lines(text) + 1)], text) |
967 return ([(rev, i) for i in xrange(1, lines(text) + 1)], text) |
968 else: |
968 else: |
969 def decorate(text, rev): |
969 def decorate(text, rev): |
970 return ([(rev, False)] * lines(text), text) |
970 return ([(rev, False)] * lines(text), text) |
971 |
971 |
972 def pair(parent, child): |
|
973 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts) |
|
974 for (a1, a2, b1, b2), t in blocks: |
|
975 # Changed blocks ('!') or blocks made only of blank lines ('~') |
|
976 # belong to the child. |
|
977 if t == '=': |
|
978 child[0][b1:b2] = parent[0][a1:a2] |
|
979 return child |
|
980 |
|
981 getlog = util.lrucachefunc(lambda x: self._repo.file(x)) |
972 getlog = util.lrucachefunc(lambda x: self._repo.file(x)) |
982 |
973 |
983 def parents(f): |
974 def parents(f): |
984 # Cut _descendantrev here to mitigate the penalty of lazy linkrev |
975 # Cut _descendantrev here to mitigate the penalty of lazy linkrev |
985 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog |
976 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog |
1079 visit[(parent.linkrev(), parent.filenode())] = parent |
1070 visit[(parent.linkrev(), parent.filenode())] = parent |
1080 if not visit: |
1071 if not visit: |
1081 break |
1072 break |
1082 c = visit.pop(max(visit)) |
1073 c = visit.pop(max(visit)) |
1083 yield c |
1074 yield c |
|
1075 |
|
1076 def _annotatepair(parent, child, diffopts): |
|
1077 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts) |
|
1078 for (a1, a2, b1, b2), t in blocks: |
|
1079 # Changed blocks ('!') or blocks made only of blank lines ('~') |
|
1080 # belong to the child. |
|
1081 if t == '=': |
|
1082 child[0][b1:b2] = parent[0][a1:a2] |
|
1083 return child |
1084 |
1084 |
1085 class filectx(basefilectx): |
1085 class filectx(basefilectx): |
1086 """A filecontext object makes access to data related to a particular |
1086 """A filecontext object makes access to data related to a particular |
1087 filerevision convenient.""" |
1087 filerevision convenient.""" |
1088 def __init__(self, repo, path, changeid=None, fileid=None, |
1088 def __init__(self, repo, path, changeid=None, fileid=None, |