comparison mercurial/patch.py @ 24783:a7f8e3584ef3

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.
author Durham Goode <durham@fb.com>
date Thu, 16 Apr 2015 11:31:48 -0700
parents f5f4dc115fb2
children edf907bd8144
comparison
equal deleted inserted replaced
24782:4906dc0e038c 24783:a7f8e3584ef3
2125 hexfunc = short 2125 hexfunc = short
2126 revs = [hexfunc(node) for node in [ctx1.node(), ctx2.node()] if node] 2126 revs = [hexfunc(node) for node in [ctx1.node(), ctx2.node()] if node]
2127 2127
2128 copy = {} 2128 copy = {}
2129 if opts.git or opts.upgrade: 2129 if opts.git or opts.upgrade:
2130 copy = copies.pathcopies(ctx1, ctx2) 2130 copy = copies.pathcopies(ctx1, ctx2, match=match)
2131 2131
2132 if relroot is not None: 2132 if relroot is not None:
2133 if not relfiltered: 2133 if not relfiltered:
2134 # XXX this would ideally be done in the matcher, but that is 2134 # XXX this would ideally be done in the matcher, but that is
2135 # generally meant to 'or' patterns, not 'and' them. In this case we 2135 # generally meant to 'or' patterns, not 'and' them. In this case we