Show More
@@ -570,11 +570,9 b' def _diffsgen(context, repo, ctx, basect' | |||||
570 | m = match.always(repo.root, repo.getcwd()) |
|
570 | m = match.always(repo.root, repo.getcwd()) | |
571 |
|
571 | |||
572 | diffopts = patch.diffopts(repo.ui, untrusted=True) |
|
572 | diffopts = patch.diffopts(repo.ui, untrusted=True) | |
573 | node1 = basectx.node() |
|
|||
574 | node2 = ctx.node() |
|
|||
575 | parity = paritygen(stripecount) |
|
573 | parity = paritygen(stripecount) | |
576 |
|
574 | |||
577 |
diffhunks = patch.diffhunks(repo, |
|
575 | diffhunks = patch.diffhunks(repo, basectx, ctx, m, opts=diffopts) | |
578 | for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1): |
|
576 | for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1): | |
579 | if style != 'raw': |
|
577 | if style != 'raw': | |
580 | header = header[1:] |
|
578 | header = header[1:] |
@@ -2268,8 +2268,14 b' def diff(repo, node1=None, node2=None, m' | |||||
2268 | hunksfilterfn, if not None, should be a function taking a filectx and |
|
2268 | hunksfilterfn, if not None, should be a function taking a filectx and | |
2269 | hunks generator that may yield filtered hunks. |
|
2269 | hunks generator that may yield filtered hunks. | |
2270 | ''' |
|
2270 | ''' | |
|
2271 | if not node1 and not node2: | |||
|
2272 | node1 = repo.dirstate.p1() | |||
|
2273 | ||||
|
2274 | ctx1 = repo[node1] | |||
|
2275 | ctx2 = repo[node2] | |||
|
2276 | ||||
2271 | for fctx1, fctx2, hdr, hunks in diffhunks( |
|
2277 | for fctx1, fctx2, hdr, hunks in diffhunks( | |
2272 |
repo, |
|
2278 | repo, ctx1=ctx1, ctx2=ctx2, | |
2273 | match=match, changes=changes, opts=opts, |
|
2279 | match=match, changes=changes, opts=opts, | |
2274 | losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, |
|
2280 | losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, | |
2275 | ): |
|
2281 | ): | |
@@ -2286,7 +2292,7 b' def diff(repo, node1=None, node2=None, m' | |||||
2286 | if text: |
|
2292 | if text: | |
2287 | yield text |
|
2293 | yield text | |
2288 |
|
2294 | |||
2289 |
def diffhunks(repo, |
|
2295 | def diffhunks(repo, ctx1, ctx2, match=None, changes=None, | |
2290 | opts=None, losedatafn=None, prefix='', relroot='', copy=None): |
|
2296 | opts=None, losedatafn=None, prefix='', relroot='', copy=None): | |
2291 | """Yield diff of changes to files in the form of (`header`, `hunks`) tuples |
|
2297 | """Yield diff of changes to files in the form of (`header`, `hunks`) tuples | |
2292 | where `header` is a list of diff headers and `hunks` is an iterable of |
|
2298 | where `header` is a list of diff headers and `hunks` is an iterable of | |
@@ -2298,9 +2304,6 b' def diffhunks(repo, node1=None, node2=No' | |||||
2298 | if opts is None: |
|
2304 | if opts is None: | |
2299 | opts = mdiff.defaultopts |
|
2305 | opts = mdiff.defaultopts | |
2300 |
|
2306 | |||
2301 | if not node1 and not node2: |
|
|||
2302 | node1 = repo.dirstate.p1() |
|
|||
2303 |
|
||||
2304 | def lrugetfilectx(): |
|
2307 | def lrugetfilectx(): | |
2305 | cache = {} |
|
2308 | cache = {} | |
2306 | order = collections.deque() |
|
2309 | order = collections.deque() | |
@@ -2317,9 +2320,6 b' def diffhunks(repo, node1=None, node2=No' | |||||
2317 | return getfilectx |
|
2320 | return getfilectx | |
2318 | getfilectx = lrugetfilectx() |
|
2321 | getfilectx = lrugetfilectx() | |
2319 |
|
2322 | |||
2320 | ctx1 = repo[node1] |
|
|||
2321 | ctx2 = repo[node2] |
|
|||
2322 |
|
||||
2323 | if relroot: |
|
2323 | if relroot: | |
2324 | relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') |
|
2324 | relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') | |
2325 | match = matchmod.intersectmatchers(match, relrootmatch) |
|
2325 | match = matchmod.intersectmatchers(match, relrootmatch) |
General Comments 0
You need to be logged in to leave comments.
Login now