Mercurial > hg
changeset 32483:f8fb8a441b4a
annotate: move pair function to top level
We'll want to make this more complicated and have unit tests for it in upcoming
patches.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 24 May 2017 17:38:28 -0700 |
parents | 579df5aaa425 |
children | c50f29b37aab |
files | mercurial/context.py |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Thu May 25 23:20:00 2017 +0900 +++ b/mercurial/context.py Wed May 24 17:38:28 2017 -0700 @@ -969,15 +969,6 @@ def decorate(text, rev): return ([(rev, False)] * lines(text), text) - def pair(parent, child): - blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts) - for (a1, a2, b1, b2), t in blocks: - # Changed blocks ('!') or blocks made only of blank lines ('~') - # belong to the child. - if t == '=': - child[0][b1:b2] = parent[0][a1:a2] - return child - getlog = util.lrucachefunc(lambda x: self._repo.file(x)) def parents(f): @@ -1054,7 +1045,7 @@ visit.pop() curr = decorate(f.data(), f) for p in pl: - curr = pair(hist[p], curr) + curr = _annotatepair(hist[p], curr, diffopts) if needed[p] == 1: del hist[p] del needed[p] @@ -1082,6 +1073,15 @@ c = visit.pop(max(visit)) yield c +def _annotatepair(parent, child, diffopts): + blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts) + for (a1, a2, b1, b2), t in blocks: + # Changed blocks ('!') or blocks made only of blank lines ('~') + # belong to the child. + if t == '=': + child[0][b1:b2] = parent[0][a1:a2] + return child + class filectx(basefilectx): """A filecontext object makes access to data related to a particular filerevision convenient."""