##// END OF EJS Templates
diff: use match.intersectmatchers()...
Martin von Zweigbergk -
r41545:6c216837 default draft
parent child Browse files
Show More
@@ -32,6 +32,7 b' from . import ('
32 encoding,
32 encoding,
33 error,
33 error,
34 mail,
34 mail,
35 match as matchmod,
35 mdiff,
36 mdiff,
36 pathutil,
37 pathutil,
37 pycompat,
38 pycompat,
@@ -2319,12 +2320,9 b' def diffhunks(repo, node1=None, node2=No'
2319 ctx1 = repo[node1]
2320 ctx1 = repo[node1]
2320 ctx2 = repo[node2]
2321 ctx2 = repo[node2]
2321
2322
2322 relfiltered = False
2323 if relroot:
2323 if relroot != '' and match.always():
2324 relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path')
2324 # as a special case, create a new matcher with just the relroot
2325 match = matchmod.intersectmatchers(match, relrootmatch)
2325 pats = [relroot]
2326 match = scmutil.match(ctx2, pats, default='path')
2327 relfiltered = True
2328
2326
2329 if not changes:
2327 if not changes:
2330 changes = ctx1.status(ctx2, match=match)
2328 changes = ctx1.status(ctx2, match=match)
@@ -2344,16 +2342,7 b' def diffhunks(repo, node1=None, node2=No'
2344 if opts.git or opts.upgrade:
2342 if opts.git or opts.upgrade:
2345 copy = copies.pathcopies(ctx1, ctx2, match=match)
2343 copy = copies.pathcopies(ctx1, ctx2, match=match)
2346
2344
2347 if relroot is not None:
2345 if relroot:
2348 if not relfiltered:
2349 # XXX this would ideally be done in the matcher, but that is
2350 # generally meant to 'or' patterns, not 'and' them. In this case we
2351 # need to 'and' all the patterns from the matcher with relroot.
2352 def filterrel(l):
2353 return [f for f in l if f.startswith(relroot)]
2354 modified = filterrel(modified)
2355 added = filterrel(added)
2356 removed = filterrel(removed)
2357 # filter out copies where either side isn't inside the relative root
2346 # filter out copies where either side isn't inside the relative root
2358 copy = dict(((dst, src) for (dst, src) in copy.iteritems()
2347 copy = dict(((dst, src) for (dst, src) in copy.iteritems()
2359 if dst.startswith(relroot)
2348 if dst.startswith(relroot)
General Comments 0
You need to be logged in to leave comments. Login now