Show More
@@ -1008,7 +1008,7 def export(repo, revs, template='hg-%h.p | |||||
1008 |
|
1008 | |||
1009 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, |
|
1009 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, | |
1010 | changes=None, stat=False, fp=None, prefix='', |
|
1010 | changes=None, stat=False, fp=None, prefix='', | |
1011 | listsubrepos=False): |
|
1011 | relative='', listsubrepos=False): | |
1012 | '''show diff or diffstat.''' |
|
1012 | '''show diff or diffstat.''' | |
1013 | if fp is None: |
|
1013 | if fp is None: | |
1014 | write = ui.write |
|
1014 | write = ui.write | |
@@ -1016,20 +1016,35 def diffordiffstat(ui, repo, diffopts, n | |||||
1016 | def write(s, **kw): |
|
1016 | def write(s, **kw): | |
1017 | fp.write(s) |
|
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 | if stat: |
|
1033 | if stat: | |
1020 | diffopts = diffopts.copy(context=0) |
|
1034 | diffopts = diffopts.copy(context=0) | |
1021 | width = 80 |
|
1035 | width = 80 | |
1022 | if not ui.plain(): |
|
1036 | if not ui.plain(): | |
1023 | width = ui.termwidth() |
|
1037 | width = ui.termwidth() | |
1024 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts, |
|
1038 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts, | |
1025 | prefix=prefix) |
|
1039 | prefix=prefix, relroot=relroot) | |
1026 | for chunk, label in patch.diffstatui(util.iterlines(chunks), |
|
1040 | for chunk, label in patch.diffstatui(util.iterlines(chunks), | |
1027 | width=width, |
|
1041 | width=width, | |
1028 | git=diffopts.git): |
|
1042 | git=diffopts.git): | |
1029 | write(chunk, label=label) |
|
1043 | write(chunk, label=label) | |
1030 | else: |
|
1044 | else: | |
1031 | for chunk, label in patch.diffui(repo, node1, node2, match, |
|
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 | write(chunk, label=label) |
|
1048 | write(chunk, label=label) | |
1034 |
|
1049 | |||
1035 | if listsubrepos: |
|
1050 | if listsubrepos: |
General Comments 0
You need to be logged in to leave comments.
Login now