Show More
@@ -2215,8 +2215,8 b' def difffeatureopts(ui, opts=None, untru' | |||
|
2215 | 2215 | |
|
2216 | 2216 | return mdiff.diffopts(**buildopts) |
|
2217 | 2217 | |
|
2218 |
def diff(repo, node1=None, node2=None, match=None, changes=None, |
|
|
2219 | losedatafn=None, prefix='', relroot='', copy=None): | |
|
2218 | def diff(repo, node1=None, node2=None, match=None, changes=None, | |
|
2219 | opts=None, losedatafn=None, prefix='', relroot='', copy=None): | |
|
2220 | 2220 | '''yields diff of changes to files between two nodes, or node and |
|
2221 | 2221 | working directory. |
|
2222 | 2222 | |
@@ -2239,6 +2239,24 b' def diff(repo, node1=None, node2=None, m' | |||
|
2239 | 2239 | |
|
2240 | 2240 | copy, if not empty, should contain mappings {dst@y: src@x} of copy |
|
2241 | 2241 | information.''' |
|
2242 | for header, hunks in diffhunks(repo, node1=node1, node2=node2, match=match, | |
|
2243 | changes=changes, opts=opts, | |
|
2244 | losedatafn=losedatafn, prefix=prefix, | |
|
2245 | relroot=relroot, copy=copy): | |
|
2246 | text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) | |
|
2247 | if header and (text or len(header) > 1): | |
|
2248 | yield '\n'.join(header) + '\n' | |
|
2249 | if text: | |
|
2250 | yield text | |
|
2251 | ||
|
2252 | def diffhunks(repo, node1=None, node2=None, match=None, changes=None, | |
|
2253 | opts=None, losedatafn=None, prefix='', relroot='', copy=None): | |
|
2254 | """Yield diff of changes to files in the form of (`header`, `hunks`) tuples | |
|
2255 | where `header` is a list of diff headers and `hunks` is an iterable of | |
|
2256 | (`hunkrange`, `hunklines`) tuples. | |
|
2257 | ||
|
2258 | See diff() for the meaning of parameters. | |
|
2259 | """ | |
|
2242 | 2260 | |
|
2243 | 2261 | if opts is None: |
|
2244 | 2262 | opts = mdiff.defaultopts |
@@ -2539,6 +2557,7 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||
|
2539 | 2557 | if text: |
|
2540 | 2558 | header.append('index %s..%s' % |
|
2541 | 2559 | (gitindex(content1), gitindex(content2))) |
|
2560 | hunks = (None, [text]), | |
|
2542 | 2561 | else: |
|
2543 | 2562 | if opts.git and opts.index > 0: |
|
2544 | 2563 | flag = flag1 |
@@ -2553,11 +2572,7 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||
|
2553 | 2572 | content2, date2, |
|
2554 | 2573 | path1, path2, opts=opts) |
|
2555 | 2574 | header.extend(uheaders) |
|
2556 | text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) | |
|
2557 | if header and (text or len(header) > 1): | |
|
2558 | yield '\n'.join(header) + '\n' | |
|
2559 | if text: | |
|
2560 | yield text | |
|
2575 | yield header, hunks | |
|
2561 | 2576 | |
|
2562 | 2577 | def diffstatsum(stats): |
|
2563 | 2578 | maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False |
General Comments 0
You need to be logged in to leave comments.
Login now