Show More
@@ -350,6 +350,38 b' def _runperfilediff(' | |||||
350 | proc.wait() |
|
350 | proc.wait() | |
351 |
|
351 | |||
352 |
|
352 | |||
|
353 | def diffpatch(ui, repo, node1a, node2, tmproot, matcher, cmdline, do3way): | |||
|
354 | template = b'hg-%h.patch' | |||
|
355 | with formatter.nullformatter(ui, b'extdiff', {}) as fm: | |||
|
356 | cmdutil.export( | |||
|
357 | repo, | |||
|
358 | [repo[node1a].rev(), repo[node2].rev()], | |||
|
359 | fm, | |||
|
360 | fntemplate=repo.vfs.reljoin(tmproot, template), | |||
|
361 | match=matcher, | |||
|
362 | ) | |||
|
363 | label1a = cmdutil.makefilename(repo[node1a], template) | |||
|
364 | label2 = cmdutil.makefilename(repo[node2], template) | |||
|
365 | dir1a = repo.vfs.reljoin(tmproot, label1a) | |||
|
366 | dir2 = repo.vfs.reljoin(tmproot, label2) | |||
|
367 | dir1b = None | |||
|
368 | label1b = None | |||
|
369 | cmdline = formatcmdline( | |||
|
370 | cmdline, | |||
|
371 | repo.root, | |||
|
372 | do3way=do3way, | |||
|
373 | parent1=dir1a, | |||
|
374 | plabel1=label1a, | |||
|
375 | parent2=dir1b, | |||
|
376 | plabel2=label1b, | |||
|
377 | child=dir2, | |||
|
378 | clabel=label2, | |||
|
379 | ) | |||
|
380 | ui.debug(b'running %r in %s\n' % (pycompat.bytestr(cmdline), tmproot)) | |||
|
381 | ui.system(cmdline, cwd=tmproot, blockedtag=b'extdiff') | |||
|
382 | return 1 | |||
|
383 | ||||
|
384 | ||||
353 | def dodiff(ui, repo, cmdline, pats, opts, guitool=False): |
|
385 | def dodiff(ui, repo, cmdline, pats, opts, guitool=False): | |
354 | '''Do the actual diff: |
|
386 | '''Do the actual diff: | |
355 |
|
387 | |||
@@ -416,18 +448,20 b' def dodiff(ui, repo, cmdline, pats, opts' | |||||
416 |
|
448 | |||
417 | tmproot = pycompat.mkdtemp(prefix=b'extdiff.') |
|
449 | tmproot = pycompat.mkdtemp(prefix=b'extdiff.') | |
418 | try: |
|
450 | try: | |
419 |
if |
|
451 | if opts.get(b'patch'): | |
|
452 | return diffpatch( | |||
|
453 | ui, repo, node1a, node2, tmproot, matcher, cmdline, do3way | |||
|
454 | ) | |||
|
455 | ||||
420 |
|
|
456 | # Always make a copy of node1a (and node1b, if applicable) | |
421 |
|
|
457 | dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a) | |
422 |
|
|
458 | dir1a = snapshot(ui, repo, dir1a_files, node1a, tmproot, subrepos)[0] | |
423 | 0 |
|
|||
424 | ] |
|
|||
425 |
|
|
459 | rev1a = b'@%d' % repo[node1a].rev() | |
426 |
|
|
460 | if do3way: | |
427 |
|
|
461 | dir1b_files = mod_b | rem_b | ((mod_a | add_a) - add_b) | |
428 | dir1b = snapshot( |
|
462 | dir1b = snapshot(ui, repo, dir1b_files, node1b, tmproot, subrepos)[ | |
429 | ui, repo, dir1b_files, node1b, tmproot, subrepos |
|
463 | 0 | |
430 |
|
|
464 | ] | |
431 |
|
|
465 | rev1b = b'@%d' % repo[node1b].rev() | |
432 |
|
|
466 | else: | |
433 |
|
|
467 | dir1b = None | |
@@ -473,23 +507,6 b' def dodiff(ui, repo, cmdline, pats, opts' | |||||
473 |
|
|
507 | dir1b = pycompat.osdevnull | |
474 |
|
|
508 | dir2 = os.path.join(dir2root, dir2, common_file) | |
475 |
|
|
509 | label2 = common_file + rev2 | |
476 | else: |
|
|||
477 | template = b'hg-%h.patch' |
|
|||
478 | with formatter.nullformatter(ui, b'extdiff', {}) as fm: |
|
|||
479 | cmdutil.export( |
|
|||
480 | repo, |
|
|||
481 | [repo[node1a].rev(), repo[node2].rev()], |
|
|||
482 | fm, |
|
|||
483 | fntemplate=repo.vfs.reljoin(tmproot, template), |
|
|||
484 | match=matcher, |
|
|||
485 | ) |
|
|||
486 | label1a = cmdutil.makefilename(repo[node1a], template) |
|
|||
487 | label2 = cmdutil.makefilename(repo[node2], template) |
|
|||
488 | dir1a = repo.vfs.reljoin(tmproot, label1a) |
|
|||
489 | dir2 = repo.vfs.reljoin(tmproot, label2) |
|
|||
490 | dir1b = None |
|
|||
491 | label1b = None |
|
|||
492 | fnsandstat = [] |
|
|||
493 |
|
510 | |||
494 | if not perfile: |
|
511 | if not perfile: | |
495 | # Run the external tool on the 2 temp directories or the patches |
|
512 | # Run the external tool on the 2 temp directories or the patches |
General Comments 0
You need to be logged in to leave comments.
Login now