##// END OF EJS Templates
diff: use match.intersectmatchers()...
Martin von Zweigbergk -
r41639:a02c8b60 default
parent child Browse files
Show More
@@ -32,6 +32,7 b' from . import ('
32 32 encoding,
33 33 error,
34 34 mail,
35 match as matchmod,
35 36 mdiff,
36 37 pathutil,
37 38 pycompat,
@@ -2319,12 +2320,9 b' def diffhunks(repo, node1=None, node2=No'
2319 2320 ctx1 = repo[node1]
2320 2321 ctx2 = repo[node2]
2321 2322
2322 relfiltered = False
2323 if relroot != '' and match.always():
2324 # as a special case, create a new matcher with just the relroot
2325 pats = [relroot]
2326 match = scmutil.match(ctx2, pats, default='path')
2327 relfiltered = True
2323 if relroot:
2324 relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path')
2325 match = matchmod.intersectmatchers(match, relrootmatch)
2328 2326
2329 2327 if not changes:
2330 2328 changes = ctx1.status(ctx2, match=match)
@@ -2344,16 +2342,7 b' def diffhunks(repo, node1=None, node2=No'
2344 2342 if opts.git or opts.upgrade:
2345 2343 copy = copies.pathcopies(ctx1, ctx2, match=match)
2346 2344
2347 if relroot is not None:
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)
2345 if relroot:
2357 2346 # filter out copies where either side isn't inside the relative root
2358 2347 copy = dict(((dst, src) for (dst, src) in copy.iteritems()
2359 2348 if dst.startswith(relroot)
General Comments 0
You need to be logged in to leave comments. Login now