Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/logcmdutil.py @ 41631:74f53d3bd685
patch: accept second matcher that applies only to copy sources (API)
See previous patch for motivation.
Differential Revision: https://phab.mercurial-scm.org/D5893
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 06 Feb 2019 22:52:49 -0800 |
parents | 035cae1d197f |
children | 3d094bfaf885 |
comparison
equal
deleted
inserted
replaced
41630:035cae1d197f | 41631:74f53d3bd685 |
---|---|
62 ctx2 = repo[node2] | 62 ctx2 = repo[node2] |
63 if root: | 63 if root: |
64 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) | 64 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) |
65 else: | 65 else: |
66 relroot = '' | 66 relroot = '' |
67 copysourcematch = None | |
67 if relroot != '': | 68 if relroot != '': |
68 # XXX relative roots currently don't work if the root is within a | 69 # XXX relative roots currently don't work if the root is within a |
69 # subrepo | 70 # subrepo |
70 uirelroot = match.uipath(relroot) | 71 uirelroot = match.uipath(relroot) |
71 relroot += '/' | 72 relroot += '/' |
74 ui.warn(_('warning: %s not inside relative root %s\n') % ( | 75 ui.warn(_('warning: %s not inside relative root %s\n') % ( |
75 match.uipath(matchroot), uirelroot)) | 76 match.uipath(matchroot), uirelroot)) |
76 | 77 |
77 relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') | 78 relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') |
78 match = matchmod.intersectmatchers(match, relrootmatch) | 79 match = matchmod.intersectmatchers(match, relrootmatch) |
80 copysourcematch = relrootmatch | |
79 | 81 |
80 if stat: | 82 if stat: |
81 diffopts = diffopts.copy(context=0, noprefix=False) | 83 diffopts = diffopts.copy(context=0, noprefix=False) |
82 width = 80 | 84 width = 80 |
83 if not ui.plain(): | 85 if not ui.plain(): |
84 width = ui.termwidth() - graphwidth | 86 width = ui.termwidth() - graphwidth |
85 | 87 |
86 chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, prefix=prefix, | 88 chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, prefix=prefix, |
87 relroot=relroot, hunksfilterfn=hunksfilterfn) | 89 relroot=relroot, copysourcematch=copysourcematch, |
90 hunksfilterfn=hunksfilterfn) | |
88 | 91 |
89 if fp is not None or ui.canwritewithoutlabels(): | 92 if fp is not None or ui.canwritewithoutlabels(): |
90 out = fp or ui | 93 out = fp or ui |
91 if stat: | 94 if stat: |
92 chunks = [patch.diffstat(util.iterlines(chunks), width=width)] | 95 chunks = [patch.diffstat(util.iterlines(chunks), width=width)] |