Patchwork [2,of,2] diff: pass the diff matcher to the copy logic

login
register
mail settings
Submitter Durham Goode
Date April 16, 2015, 7:03 p.m.
Message ID <6b80abe8862ed1f63774.1429210988@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8719/
State Accepted
Headers show

Comments

Durham Goode - April 16, 2015, 7:03 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1429209108 25200
#      Thu Apr 16 11:31:48 2015 -0700
# Node ID 6b80abe8862ed1f637748f6f3710b4ec6326a35b
# Parent  0270a44b46aabbaf794dbd62b08b622313fe1b85
diff: pass the diff matcher to the copy logic

This passes the existing diff matcher instance down to the copy logic so copy
tracing can be more efficient when possible and only trace copies for matching
files.

This only actually affects forwardcopies (i.e. Given A<-B<-C<-D, it works for
'hg diff -r B -r D foo.txt', but not for 'hg diff -r D -r B foo.txt') since
backward copies require walking all histories, and not just the individual
file's.

This reduces 'hg diff -r A -r B foo.txt' time from 15s to 1s when A and B have
80,000 files different.
Durham Goode - April 16, 2015, 7:30 p.m.
On 4/16/15 3:03 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1429209108 25200
> #      Thu Apr 16 11:31:48 2015 -0700
> # Node ID 6b80abe8862ed1f637748f6f3710b4ec6326a35b
> # Parent  0270a44b46aabbaf794dbd62b08b622313fe1b85
> diff: pass the diff matcher to the copy logic
>
It was brought to my attention that the freeze has started.  Feel free 
to disregard this series if it doesn't qualify.  Though a 14s perf win 
might meet the bar.
Matt Mackall - April 16, 2015, 11:08 p.m.
On Thu, 2015-04-16 at 15:30 -0400, Durham Goode wrote:
> On 4/16/15 3:03 PM, Durham Goode wrote:
> > # HG changeset patch
> > # User Durham Goode <durham@fb.com>
> > # Date 1429209108 25200
> > #      Thu Apr 16 11:31:48 2015 -0700
> > # Node ID 6b80abe8862ed1f637748f6f3710b4ec6326a35b
> > # Parent  0270a44b46aabbaf794dbd62b08b622313fe1b85
> > diff: pass the diff matcher to the copy logic
> >
> It was brought to my attention that the freeze has started.  Feel free 
> to disregard this series if it doesn't qualify.  Though a 14s perf win 
> might meet the bar.

Freeze starts when I push a -rc. But I reserve the right to defer
stragglers.
Matt Mackall - April 16, 2015, 11:14 p.m.
On Thu, 2015-04-16 at 12:03 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1429209108 25200
> #      Thu Apr 16 11:31:48 2015 -0700
> # Node ID 6b80abe8862ed1f637748f6f3710b4ec6326a35b
> # Parent  0270a44b46aabbaf794dbd62b08b622313fe1b85
> diff: pass the diff matcher to the copy logic

I've queued these with Martin's amendment to patch 1, thanks guys.

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2127,7 +2127,7 @@  def diff(repo, node1=None, node2=None, m
 
     copy = {}
     if opts.git or opts.upgrade:
-        copy = copies.pathcopies(ctx1, ctx2)
+        copy = copies.pathcopies(ctx1, ctx2, match=match)
 
     if relroot is not None:
         if not relfiltered: