Show More
@@ -395,9 +395,9 b' def diffpatch(ui, repo, node1, node2, tm' | |||
|
395 | 395 | def diffrevs( |
|
396 | 396 | ui, |
|
397 | 397 | repo, |
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
|
398 | ctx1a, | |
|
399 | ctx1b, | |
|
400 | ctx2, | |
|
401 | 401 | matcher, |
|
402 | 402 | tmproot, |
|
403 | 403 | cmdline, |
@@ -409,10 +409,10 b' def diffrevs(' | |||
|
409 | 409 | subrepos = opts.get(b'subrepos') |
|
410 | 410 | |
|
411 | 411 | # calculate list of files changed between both revs |
|
412 |
st = |
|
|
412 | st = ctx1a.status(ctx2, matcher, listsubrepos=subrepos) | |
|
413 | 413 | mod_a, add_a, rem_a = set(st.modified), set(st.added), set(st.removed) |
|
414 | 414 | if do3way: |
|
415 |
stb = |
|
|
415 | stb = ctx1b.status(ctx2, matcher, listsubrepos=subrepos) | |
|
416 | 416 | mod_b, add_b, rem_b = ( |
|
417 | 417 | set(stb.modified), |
|
418 | 418 | set(stb.added), |
@@ -425,32 +425,34 b' def diffrevs(' | |||
|
425 | 425 | if not common: |
|
426 | 426 | return 0 |
|
427 | 427 | |
|
428 |
# Always make a copy of |
|
|
428 | # Always make a copy of ctx1a (and ctx1b, if applicable) | |
|
429 | 429 | # dir1a should contain files which are: |
|
430 |
# * modified or removed from |
|
|
431 |
# * modified or added from |
|
|
432 |
# (except file added from |
|
|
433 |
# |
|
|
430 | # * modified or removed from ctx1a to ctx2 | |
|
431 | # * modified or added from ctx1b to ctx2 | |
|
432 | # (except file added from ctx1a to ctx2 as they were not present in | |
|
433 | # ctx1a) | |
|
434 | 434 | dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a) |
|
435 |
dir1a = snapshot(ui, repo, dir1a_files, |
|
|
436 |
rev1a = b'@%d' % |
|
|
435 | dir1a = snapshot(ui, repo, dir1a_files, ctx1a.node(), tmproot, subrepos)[0] | |
|
436 | rev1a = b'@%d' % ctx1a.rev() | |
|
437 | 437 | if do3way: |
|
438 | 438 | # file calculation criteria same as dir1a |
|
439 | 439 | dir1b_files = mod_b | rem_b | ((mod_a | add_a) - add_b) |
|
440 | dir1b = snapshot(ui, repo, dir1b_files, node1b, tmproot, subrepos)[0] | |
|
441 | rev1b = b'@%d' % repo[node1b].rev() | |
|
440 | dir1b = snapshot( | |
|
441 | ui, repo, dir1b_files, ctx1b.node(), tmproot, subrepos | |
|
442 | )[0] | |
|
443 | rev1b = b'@%d' % ctx1b.rev() | |
|
442 | 444 | else: |
|
443 | 445 | dir1b = None |
|
444 | 446 | rev1b = b'' |
|
445 | 447 | |
|
446 | 448 | fnsandstat = [] |
|
447 | 449 | |
|
448 |
# If |
|
|
450 | # If ctx2 is not the wc or there is >1 change, copy it | |
|
449 | 451 | dir2root = b'' |
|
450 | 452 | rev2 = b'' |
|
451 | if node2: | |
|
452 |
dir2 = snapshot(ui, repo, modadd, |
|
|
453 |
rev2 = b'@%d' % |
|
|
453 | if ctx2.node() is not None: | |
|
454 | dir2 = snapshot(ui, repo, modadd, ctx2.node(), tmproot, subrepos)[0] | |
|
455 | rev2 = b'@%d' % ctx2.rev() | |
|
454 | 456 | elif len(common) > 1: |
|
455 | 457 | # we only actually need to get the files to copy back to |
|
456 | 458 | # the working dir in this case (because the other cases |
@@ -563,36 +565,34 b' def dodiff(ui, repo, cmdline, pats, opts' | |||
|
563 | 565 | else: |
|
564 | 566 | ctx1b = repo[nullid] |
|
565 | 567 | |
|
566 | node1a = ctx1a.node() | |
|
567 | node1b = ctx1b.node() | |
|
568 | node2 = ctx2.node() | |
|
569 | ||
|
570 | 568 | # Disable 3-way merge if there is only one parent |
|
571 | 569 | if do3way: |
|
572 |
if |
|
|
570 | if ctx1b.node() == nullid: | |
|
573 | 571 | do3way = False |
|
574 | 572 | |
|
575 |
matcher = scmutil.match( |
|
|
573 | matcher = scmutil.match(ctx2, pats, opts) | |
|
576 | 574 | |
|
577 | 575 | if opts.get(b'patch'): |
|
578 | 576 | if opts.get(b'subrepos'): |
|
579 | 577 | raise error.Abort(_(b'--patch cannot be used with --subrepos')) |
|
580 | 578 | if opts.get(b'per_file'): |
|
581 | 579 | raise error.Abort(_(b'--patch cannot be used with --per-file')) |
|
582 |
if |
|
|
580 | if ctx2.node() is None: | |
|
583 | 581 | raise error.Abort(_(b'--patch requires two revisions')) |
|
584 | 582 | |
|
585 | 583 | tmproot = pycompat.mkdtemp(prefix=b'extdiff.') |
|
586 | 584 | try: |
|
587 | 585 | if opts.get(b'patch'): |
|
588 | return diffpatch(ui, repo, node1a, node2, tmproot, matcher, cmdline) | |
|
586 | return diffpatch( | |
|
587 | ui, repo, ctx1a.node(), ctx2.node(), tmproot, matcher, cmdline | |
|
588 | ) | |
|
589 | 589 | |
|
590 | 590 | return diffrevs( |
|
591 | 591 | ui, |
|
592 | 592 | repo, |
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
|
593 | ctx1a, | |
|
594 | ctx1b, | |
|
595 | ctx2, | |
|
596 | 596 | matcher, |
|
597 | 597 | tmproot, |
|
598 | 598 | cmdline, |
General Comments 0
You need to be logged in to leave comments.
Login now