##// END OF EJS Templates
annotate: move pair function to top level...
Siddharth Agarwal -
r32483:f8fb8a44 default
parent child Browse files
Show More
@@ -969,15 +969,6 b' class basefilectx(object):'
969 969 def decorate(text, rev):
970 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 972 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
982 973
983 974 def parents(f):
@@ -1054,7 +1045,7 b' class basefilectx(object):'
1054 1045 visit.pop()
1055 1046 curr = decorate(f.data(), f)
1056 1047 for p in pl:
1057 curr = pair(hist[p], curr)
1048 curr = _annotatepair(hist[p], curr, diffopts)
1058 1049 if needed[p] == 1:
1059 1050 del hist[p]
1060 1051 del needed[p]
@@ -1082,6 +1073,15 b' class basefilectx(object):'
1082 1073 c = visit.pop(max(visit))
1083 1074 yield c
1084 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
1085 1085 class filectx(basefilectx):
1086 1086 """A filecontext object makes access to data related to a particular
1087 1087 filerevision convenient."""
General Comments 0
You need to be logged in to leave comments. Login now