Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
) | ) | ||||
from . import ( | from . import ( | ||||
copies, | copies, | ||||
diffhelper, | diffhelper, | ||||
diffutil, | diffutil, | ||||
encoding, | encoding, | ||||
error, | error, | ||||
mail, | mail, | ||||
match as matchmod, | |||||
mdiff, | mdiff, | ||||
pathutil, | pathutil, | ||||
pycompat, | pycompat, | ||||
scmutil, | scmutil, | ||||
similar, | similar, | ||||
util, | util, | ||||
vfs as vfsmod, | vfs as vfsmod, | ||||
) | ) | ||||
order.append(f) | order.append(f) | ||||
return fctx | return fctx | ||||
return getfilectx | return getfilectx | ||||
getfilectx = lrugetfilectx() | getfilectx = lrugetfilectx() | ||||
ctx1 = repo[node1] | ctx1 = repo[node1] | ||||
ctx2 = repo[node2] | ctx2 = repo[node2] | ||||
relfiltered = False | if relroot: | ||||
if relroot != '' and match.always(): | relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') | ||||
# as a special case, create a new matcher with just the relroot | match = matchmod.intersectmatchers(match, relrootmatch) | ||||
pats = [relroot] | |||||
match = scmutil.match(ctx2, pats, default='path') | |||||
relfiltered = True | |||||
if not changes: | if not changes: | ||||
changes = ctx1.status(ctx2, match=match) | changes = ctx1.status(ctx2, match=match) | ||||
modified, added, removed = changes[:3] | modified, added, removed = changes[:3] | ||||
if not modified and not added and not removed: | if not modified and not added and not removed: | ||||
return [] | return [] | ||||
if repo.ui.debugflag: | if repo.ui.debugflag: | ||||
hexfunc = hex | hexfunc = hex | ||||
else: | else: | ||||
hexfunc = short | hexfunc = short | ||||
revs = [hexfunc(node) for node in [ctx1.node(), ctx2.node()] if node] | revs = [hexfunc(node) for node in [ctx1.node(), ctx2.node()] if node] | ||||
if copy is None: | if copy is None: | ||||
copy = {} | copy = {} | ||||
if opts.git or opts.upgrade: | if opts.git or opts.upgrade: | ||||
copy = copies.pathcopies(ctx1, ctx2, match=match) | copy = copies.pathcopies(ctx1, ctx2, match=match) | ||||
if relroot is not None: | if relroot: | ||||
if not relfiltered: | |||||
# XXX this would ideally be done in the matcher, but that is | |||||
# generally meant to 'or' patterns, not 'and' them. In this case we | |||||
# need to 'and' all the patterns from the matcher with relroot. | |||||
def filterrel(l): | |||||
return [f for f in l if f.startswith(relroot)] | |||||
modified = filterrel(modified) | |||||
added = filterrel(added) | |||||
removed = filterrel(removed) | |||||
# filter out copies where either side isn't inside the relative root | # filter out copies where either side isn't inside the relative root | ||||
copy = dict(((dst, src) for (dst, src) in copy.iteritems() | copy = dict(((dst, src) for (dst, src) in copy.iteritems() | ||||
if dst.startswith(relroot) | if dst.startswith(relroot) | ||||
and src.startswith(relroot))) | and src.startswith(relroot))) | ||||
modifiedset = set(modified) | modifiedset = set(modified) | ||||
addedset = set(added) | addedset = set(added) | ||||
removedset = set(removed) | removedset = set(removed) |