Mercurial > hg
changeset 24187:30219bd46ed7
copies: only calculate 'addedinm[12]' sets once
Pass the addedinm1 and addedinm2 instead of m1, m2, ma into
_computenonoverlap() instead of calculating the sets twice.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 27 Feb 2015 14:26:22 -0800 |
parents | 61aadba2396e |
children | 5a7920c4d2ea |
files | mercurial/copies.py |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/copies.py Fri Feb 27 14:03:01 2015 -0800 +++ b/mercurial/copies.py Fri Feb 27 14:26:22 2015 -0800 @@ -209,13 +209,11 @@ return _backwardrenames(x, y) return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y)) -def _computenonoverlap(repo, m1, m2, ma): - """Computes the files exclusive to m1 and m2. - This is its own function so extensions can easily wrap this call to see what - files mergecopies is about to process. +def _computenonoverlap(repo, addedinm1, addedinm2): + """Computes, based on addedinm1 and addedinm2, the files exclusive to m1 + and m2. This is its own function so extensions can easily wrap this call + to see what files mergecopies is about to process. """ - addedinm1 = m1.filesnotin(ma) - addedinm2 = m2.filesnotin(ma) u1 = sorted(addedinm1 - addedinm2) u2 = sorted(addedinm2 - addedinm1) @@ -280,7 +278,9 @@ repo.ui.debug(" searching for copies back to rev %d\n" % limit) - u1, u2 = _computenonoverlap(repo, m1, m2, ma) + addedinm1 = m1.filesnotin(ma) + addedinm2 = m2.filesnotin(ma) + u1, u2 = _computenonoverlap(repo, addedinm1, addedinm2) for f in u1: checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy) @@ -302,8 +302,6 @@ else: diverge2.update(fl) # reverse map for below - addedinm1 = m1.filesnotin(ma) - addedinm2 = m2.filesnotin(ma) bothnew = sorted(addedinm1 & addedinm2) if bothnew: repo.ui.debug(" unmatched files new in both:\n %s\n"