Show More
@@ -54,12 +54,6 b' def diffordiffstat(ui, repo, diffopts, n' | |||||
54 | changes=None, stat=False, fp=None, prefix='', |
|
54 | changes=None, stat=False, fp=None, prefix='', | |
55 | root='', listsubrepos=False, hunksfilterfn=None): |
|
55 | root='', listsubrepos=False, hunksfilterfn=None): | |
56 | '''show diff or diffstat.''' |
|
56 | '''show diff or diffstat.''' | |
57 | if fp is None: |
|
|||
58 | write = ui.write |
|
|||
59 | else: |
|
|||
60 | def write(s, **kw): |
|
|||
61 | fp.write(s) |
|
|||
62 |
|
||||
63 | if root: |
|
57 | if root: | |
64 | relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) |
|
58 | relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) | |
65 | else: |
|
59 | else: | |
@@ -85,10 +79,11 b' def diffordiffstat(ui, repo, diffopts, n' | |||||
85 | hunksfilterfn=hunksfilterfn) |
|
79 | hunksfilterfn=hunksfilterfn) | |
86 |
|
80 | |||
87 | if fp is not None or ui.canwritewithoutlabels(): |
|
81 | if fp is not None or ui.canwritewithoutlabels(): | |
|
82 | out = fp or ui | |||
88 | if stat: |
|
83 | if stat: | |
89 | chunks = patch.diffstat(util.iterlines(chunks), width=width) |
|
84 | chunks = patch.diffstat(util.iterlines(chunks), width=width) | |
90 | for chunk in util.filechunkiter(util.chunkbuffer(chunks)): |
|
85 | for chunk in util.filechunkiter(util.chunkbuffer(chunks)): | |
91 | write(chunk) |
|
86 | out.write(chunk) | |
92 | else: |
|
87 | else: | |
93 | if stat: |
|
88 | if stat: | |
94 | chunks = patch.diffstatui(util.iterlines(chunks), width=width) |
|
89 | chunks = patch.diffstatui(util.iterlines(chunks), width=width) | |
@@ -100,10 +95,10 b' def diffordiffstat(ui, repo, diffopts, n' | |||||
100 | for chunk, label in chunks: |
|
95 | for chunk, label in chunks: | |
101 | yield ui.label(chunk, label=label) |
|
96 | yield ui.label(chunk, label=label) | |
102 | for chunk in util.filechunkiter(util.chunkbuffer(gen())): |
|
97 | for chunk in util.filechunkiter(util.chunkbuffer(gen())): | |
103 | write(chunk) |
|
98 | ui.write(chunk) | |
104 | else: |
|
99 | else: | |
105 | for chunk, label in chunks: |
|
100 | for chunk, label in chunks: | |
106 | write(chunk, label=label) |
|
101 | ui.write(chunk, label=label) | |
107 |
|
102 | |||
108 | if listsubrepos: |
|
103 | if listsubrepos: | |
109 | ctx1 = repo[node1] |
|
104 | ctx1 = repo[node1] |
General Comments 0
You need to be logged in to leave comments.
Login now