Show More
@@ -1008,7 +1008,7 def export(repo, revs, template='hg-%h.p | |||
|
1008 | 1008 | |
|
1009 | 1009 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, |
|
1010 | 1010 | changes=None, stat=False, fp=None, prefix='', |
|
1011 | listsubrepos=False): | |
|
1011 | relative='', listsubrepos=False): | |
|
1012 | 1012 | '''show diff or diffstat.''' |
|
1013 | 1013 | if fp is None: |
|
1014 | 1014 | write = ui.write |
@@ -1016,20 +1016,35 def diffordiffstat(ui, repo, diffopts, n | |||
|
1016 | 1016 | def write(s, **kw): |
|
1017 | 1017 | fp.write(s) |
|
1018 | 1018 | |
|
1019 | if relative: | |
|
1020 | relroot = pathutil.canonpath(repo.root, repo.getcwd(), relative) | |
|
1021 | else: | |
|
1022 | relroot = '' | |
|
1023 | if relroot != '': | |
|
1024 | # XXX relative roots currently don't work if the root is within a | |
|
1025 | # subrepo | |
|
1026 | uirelroot = match.uipath(relroot) | |
|
1027 | relroot += '/' | |
|
1028 | for matchroot in match.files(): | |
|
1029 | if not matchroot.startswith(relroot): | |
|
1030 | ui.warn(_('warning: %s not inside relative root %s\n') % ( | |
|
1031 | match.uipath(matchroot), uirelroot)) | |
|
1032 | ||
|
1019 | 1033 | if stat: |
|
1020 | 1034 | diffopts = diffopts.copy(context=0) |
|
1021 | 1035 | width = 80 |
|
1022 | 1036 | if not ui.plain(): |
|
1023 | 1037 | width = ui.termwidth() |
|
1024 | 1038 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts, |
|
1025 | prefix=prefix) | |
|
1039 | prefix=prefix, relroot=relroot) | |
|
1026 | 1040 | for chunk, label in patch.diffstatui(util.iterlines(chunks), |
|
1027 | 1041 | width=width, |
|
1028 | 1042 | git=diffopts.git): |
|
1029 | 1043 | write(chunk, label=label) |
|
1030 | 1044 | else: |
|
1031 | 1045 | for chunk, label in patch.diffui(repo, node1, node2, match, |
|
1032 |
changes, diffopts, prefix=prefix |
|
|
1046 | changes, diffopts, prefix=prefix, | |
|
1047 | relroot=relroot): | |
|
1033 | 1048 | write(chunk, label=label) |
|
1034 | 1049 | |
|
1035 | 1050 | if listsubrepos: |
General Comments 0
You need to be logged in to leave comments.
Login now