##// END OF EJS Templates
annotate: track whether a particular annotation was the result of a skip...
Siddharth Agarwal -
r34434:2f5a135b default
parent child Browse files
Show More
@@ -1111,6 +1111,8 class basefilectx(object):
1111 class annotateline(object):
1111 class annotateline(object):
1112 fctx = attr.ib()
1112 fctx = attr.ib()
1113 lineno = attr.ib(default=False)
1113 lineno = attr.ib(default=False)
1114 # Whether this annotation was the result of a skip-annotate.
1115 skip = attr.ib(default=False)
1114
1116
1115 def _annotatepair(parents, childfctx, child, skipchild, diffopts):
1117 def _annotatepair(parents, childfctx, child, skipchild, diffopts):
1116 r'''
1118 r'''
@@ -1159,7 +1161,7 def _annotatepair(parents, childfctx, ch
1159 for bk in xrange(b1, b2):
1161 for bk in xrange(b1, b2):
1160 if child[0][bk].fctx == childfctx:
1162 if child[0][bk].fctx == childfctx:
1161 ak = min(a1 + (bk - b1), a2 - 1)
1163 ak = min(a1 + (bk - b1), a2 - 1)
1162 child[0][bk] = parent[0][ak]
1164 child[0][bk] = attr.evolve(parent[0][ak], skip=True)
1163 else:
1165 else:
1164 remaining[idx][1].append((a1, a2, b1, b2))
1166 remaining[idx][1].append((a1, a2, b1, b2))
1165
1167
@@ -1170,7 +1172,7 def _annotatepair(parents, childfctx, ch
1170 for bk in xrange(b1, b2):
1172 for bk in xrange(b1, b2):
1171 if child[0][bk].fctx == childfctx:
1173 if child[0][bk].fctx == childfctx:
1172 ak = min(a1 + (bk - b1), a2 - 1)
1174 ak = min(a1 + (bk - b1), a2 - 1)
1173 child[0][bk] = parent[0][ak]
1175 child[0][bk] = attr.evolve(parent[0][ak], skip=True)
1174 return child
1176 return child
1175
1177
1176 class filectx(basefilectx):
1178 class filectx(basefilectx):
@@ -80,9 +80,11 class AnnotateTests(unittest.TestCase):
80 diffopts)
80 diffopts)
81 self.assertEqual(childann[0], [
81 self.assertEqual(childann[0], [
82 annotateline('old', 1),
82 annotateline('old', 1),
83 annotateline('old', 2),
83 annotateline('old', 2, True),
84 # note that this line was carried over from earlier so it is *not*
85 # marked skipped
84 annotateline('p2', 2),
86 annotateline('p2', 2),
85 annotateline('p2', 2),
87 annotateline('p2', 2, True),
86 annotateline('p2', 3),
88 annotateline('p2', 3),
87 ])
89 ])
88
90
@@ -91,9 +93,9 class AnnotateTests(unittest.TestCase):
91 diffopts)
93 diffopts)
92 self.assertEqual(childann[0], [
94 self.assertEqual(childann[0], [
93 annotateline('old', 1),
95 annotateline('old', 1),
94 annotateline('old', 2),
96 annotateline('old', 2, True),
95 annotateline('p1', 3),
97 annotateline('p1', 3),
96 annotateline('p1', 3),
98 annotateline('p1', 3, True),
97 annotateline('p2', 3),
99 annotateline('p2', 3),
98 ])
100 ])
99
101
General Comments 0
You need to be logged in to leave comments. Login now