Patchwork copies: pass changectx instead of manifest to _computenonoverlap

login
register
mail settings
Submitter Durham Goode
Date April 3, 2015, 10:37 p.m.
Message ID <52d6d7910bec8d14a731.1428100649@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8492/
State Accepted
Headers show

Comments

Durham Goode - April 3, 2015, 10:37 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1428099514 25200
#      Fri Apr 03 15:18:34 2015 -0700
# Node ID 52d6d7910bec8d14a7312edcbb1819c90165ebe7
# Parent  d80819f67d5961a91da723e29677c78f8992b789
copies: pass changectx instead of manifest to _computenonoverlap

The _computenonoverlap function takes two manifests to allow extensions to hook
in and read the manifest nodes produced by the function. The remotefilelog
extension actually needs the entire changectx instead (which includes the
manifest) so it can prefetch the subset of files necessary for a sparse checkout
(and the sparse checkout depends on which commit is being accessed, hence the
need for the changectx).

I have tests in the remotefilelog extension that cover this.
Matt Mackall - April 6, 2015, 9:11 p.m.
On Fri, 2015-04-03 at 15:37 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1428099514 25200
> #      Fri Apr 03 15:18:34 2015 -0700
> # Node ID 52d6d7910bec8d14a7312edcbb1819c90165ebe7
> # Parent  d80819f67d5961a91da723e29677c78f8992b789
> copies: pass changectx instead of manifest to _computenonoverlap

Queued for default, thanks.

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -209,12 +209,12 @@  def pathcopies(x, y):
         return _backwardrenames(x, y)
     return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y))
 
-def _computenonoverlap(repo, m1, m2, 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
+def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2):
+    """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
+    and c2. This is its own function so extensions can easily wrap this call
     to see what files mergecopies is about to process.
 
-    Even though m1 and m2 are not used in this function, they are useful in
+    Even though c1 and c2 are not used in this function, they are useful in
     other extensions for being able to read the file nodes of the changed files.
     """
     u1 = sorted(addedinm1 - addedinm2)
@@ -310,7 +310,7 @@  def mergecopies(repo, c1, c2, ca):
 
     addedinm1 = m1.filesnotin(ma)
     addedinm2 = m2.filesnotin(ma)
-    u1, u2 = _computenonoverlap(repo, m1, m2, addedinm1, addedinm2)
+    u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
 
     for f in u1:
         ctx = setupctx(c1)