# HG changeset patch # User Martin von Zweigbergk # Date 1425075982 28800 # Node ID 30219bd46ed738b4d689f6d73f1467bf7da40009 # Parent 61aadba2396e07b3a6f2b19a65d4d4f0b8a0024f 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. diff -r 61aadba2396e -r 30219bd46ed7 mercurial/copies.py --- 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"