Patchwork [4,of,4] copies: only calculate 'addedinm[12]' sets once

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 27, 2015, 10:46 p.m.
Message ID <ec60e0d4a6a938c62b1f.1425077212@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7857/
State Accepted
Commit 30219bd46ed738b4d689f6d73f1467bf7da40009
Headers show

Comments

Martin von Zweigbergk - Feb. 27, 2015, 10:46 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1425075982 28800
#      Fri Feb 27 14:26:22 2015 -0800
# Node ID ec60e0d4a6a938c62b1ffe5f8e5d1ece6da2b145
# Parent  b3bcf58446fdebf3672edbbc55c24509e549eb22
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.
Durham Goode - Feb. 28, 2015, 1:10 a.m.
On 2/27/15, 2:46 PM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:

># HG changeset patch
># User Martin von Zweigbergk <martinvonz@google.com>
># Date 1425075982 28800
>#      Fri Feb 27 14:26:22 2015 -0800
># Node ID ec60e0d4a6a938c62b1ffe5f8e5d1ece6da2b145
># Parent  b3bcf58446fdebf3672edbbc55c24509e549eb22
>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.

This series LGTM.
Augie Fackler - March 3, 2015, 6:44 p.m.
On Sat, Feb 28, 2015 at 01:10:09AM +0000, Durham Goode wrote:
> On 2/27/15, 2:46 PM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:
>
> ># HG changeset patch
> ># User Martin von Zweigbergk <martinvonz@google.com>
> ># Date 1425075982 28800
> >#      Fri Feb 27 14:26:22 2015 -0800
> ># Node ID ec60e0d4a6a938c62b1ffe5f8e5d1ece6da2b145
> ># Parent  b3bcf58446fdebf3672edbbc55c24509e549eb22
> >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.
>
> This series LGTM.

Agreed. I'll queue it and fix up my lazymanifest stuff against it, and
then when it lands in main I'll resend lazymanifest.

>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r b3bcf58446fd -r ec60e0d4a6a9 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"