mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
annotate: track whether a particular annotation was the result of a skip
We're going to expose this information in the UI in an upcoming patch. Differential Revision: https://phab.mercurial-scm.org/D899
This commit is contained in:
parent
ca691a7bec
commit
45633c900e
@ -1111,6 +1111,8 @@ class basefilectx(object):
|
||||
class annotateline(object):
|
||||
fctx = attr.ib()
|
||||
lineno = attr.ib(default=False)
|
||||
# Whether this annotation was the result of a skip-annotate.
|
||||
skip = attr.ib(default=False)
|
||||
|
||||
def _annotatepair(parents, childfctx, child, skipchild, diffopts):
|
||||
r'''
|
||||
@ -1159,7 +1161,7 @@ def _annotatepair(parents, childfctx, child, skipchild, diffopts):
|
||||
for bk in xrange(b1, b2):
|
||||
if child[0][bk].fctx == childfctx:
|
||||
ak = min(a1 + (bk - b1), a2 - 1)
|
||||
child[0][bk] = parent[0][ak]
|
||||
child[0][bk] = attr.evolve(parent[0][ak], skip=True)
|
||||
else:
|
||||
remaining[idx][1].append((a1, a2, b1, b2))
|
||||
|
||||
@ -1170,7 +1172,7 @@ def _annotatepair(parents, childfctx, child, skipchild, diffopts):
|
||||
for bk in xrange(b1, b2):
|
||||
if child[0][bk].fctx == childfctx:
|
||||
ak = min(a1 + (bk - b1), a2 - 1)
|
||||
child[0][bk] = parent[0][ak]
|
||||
child[0][bk] = attr.evolve(parent[0][ak], skip=True)
|
||||
return child
|
||||
|
||||
class filectx(basefilectx):
|
||||
|
@ -80,9 +80,11 @@ class AnnotateTests(unittest.TestCase):
|
||||
diffopts)
|
||||
self.assertEqual(childann[0], [
|
||||
annotateline('old', 1),
|
||||
annotateline('old', 2),
|
||||
annotateline('p2', 2),
|
||||
annotateline('old', 2, True),
|
||||
# note that this line was carried over from earlier so it is *not*
|
||||
# marked skipped
|
||||
annotateline('p2', 2),
|
||||
annotateline('p2', 2, True),
|
||||
annotateline('p2', 3),
|
||||
])
|
||||
|
||||
@ -91,9 +93,9 @@ class AnnotateTests(unittest.TestCase):
|
||||
diffopts)
|
||||
self.assertEqual(childann[0], [
|
||||
annotateline('old', 1),
|
||||
annotateline('old', 2),
|
||||
annotateline('p1', 3),
|
||||
annotateline('old', 2, True),
|
||||
annotateline('p1', 3),
|
||||
annotateline('p1', 3, True),
|
||||
annotateline('p2', 3),
|
||||
])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user