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