Show More
@@ -2586,12 +2586,6 b' def merge(ui, repo, node=None, **opts):' | |||||
2586 | if not node: |
|
2586 | if not node: | |
2587 | node = opts.get('rev') |
|
2587 | node = opts.get('rev') | |
2588 |
|
2588 | |||
2589 | t = opts.get('tool') |
|
|||
2590 | if t: |
|
|||
2591 | if 'HGMERGE' in os.environ: |
|
|||
2592 | os.environ['HGMERGE'] = '' |
|
|||
2593 | ui.setconfig('ui', 'merge', t) |
|
|||
2594 |
|
||||
2595 | if not node: |
|
2589 | if not node: | |
2596 | branch = repo.changectx(None).branch() |
|
2590 | branch = repo.changectx(None).branch() | |
2597 | bheads = repo.branchheads(branch) |
|
2591 | bheads = repo.branchheads(branch) | |
@@ -2632,7 +2626,12 b' def merge(ui, repo, node=None, **opts):' | |||||
2632 | displayer.close() |
|
2626 | displayer.close() | |
2633 | return 0 |
|
2627 | return 0 | |
2634 |
|
2628 | |||
2635 | return hg.merge(repo, node, force=opts.get('force')) |
|
2629 | try: | |
|
2630 | # ui.forcemerge is an internal variable, do not document | |||
|
2631 | ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | |||
|
2632 | return hg.merge(repo, node, force=opts.get('force')) | |||
|
2633 | finally: | |||
|
2634 | ui.setconfig('ui', 'forcemerge', '') | |||
2636 |
|
2635 | |||
2637 | def outgoing(ui, repo, dest=None, **opts): |
|
2636 | def outgoing(ui, repo, dest=None, **opts): | |
2638 | """show changesets not found in the destination |
|
2637 | """show changesets not found in the destination | |
@@ -2979,12 +2978,6 b' def resolve(ui, repo, *pats, **opts):' | |||||
2979 | raise util.Abort(_('no files or directories specified; ' |
|
2978 | raise util.Abort(_('no files or directories specified; ' | |
2980 | 'use --all to remerge all files')) |
|
2979 | 'use --all to remerge all files')) | |
2981 |
|
2980 | |||
2982 | t = opts.get('tool') |
|
|||
2983 | if t: |
|
|||
2984 | if 'HGMERGE' in os.environ: |
|
|||
2985 | os.environ['HGMERGE'] = '' |
|
|||
2986 | ui.setconfig('ui', 'merge', t) |
|
|||
2987 |
|
||||
2988 | ms = mergemod.mergestate(repo) |
|
2981 | ms = mergemod.mergestate(repo) | |
2989 | m = cmdutil.match(repo, pats, opts) |
|
2982 | m = cmdutil.match(repo, pats, opts) | |
2990 | ret = 0 |
|
2983 | ret = 0 | |
@@ -3010,9 +3003,13 b' def resolve(ui, repo, *pats, **opts):' | |||||
3010 | a = repo.wjoin(f) |
|
3003 | a = repo.wjoin(f) | |
3011 | util.copyfile(a, a + ".resolve") |
|
3004 | util.copyfile(a, a + ".resolve") | |
3012 |
|
3005 | |||
3013 |
|
|
3006 | try: | |
3014 |
|
|
3007 | # resolve file | |
3015 | ret = 1 |
|
3008 | ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | |
|
3009 | if ms.resolve(f, wctx, mctx): | |||
|
3010 | ret = 1 | |||
|
3011 | finally: | |||
|
3012 | ui.setconfig('ui', 'forcemerge', '') | |||
3016 |
|
3013 | |||
3017 | # replace filemerge's .orig file with our resolve file |
|
3014 | # replace filemerge's .orig file with our resolve file | |
3018 | util.rename(a + ".resolve", a + ".orig") |
|
3015 | util.rename(a + ".resolve", a + ".orig") |
@@ -54,7 +54,17 b' def _picktool(repo, ui, path, binary, sy' | |||||
54 | return True |
|
54 | return True | |
55 | return False |
|
55 | return False | |
56 |
|
56 | |||
57 | # HGMERGE takes precedence |
|
57 | # forcemerge comes from command line arguments, highest priority | |
|
58 | force = ui.config('ui', 'forcemerge') | |||
|
59 | if force: | |||
|
60 | toolpath = _findtool(ui, force) | |||
|
61 | if toolpath: | |||
|
62 | return (force, '"' + toolpath + '"') | |||
|
63 | else: | |||
|
64 | # mimic HGMERGE if given tool not found | |||
|
65 | return (force, force) | |||
|
66 | ||||
|
67 | # HGMERGE takes next precedence | |||
58 | hgmerge = os.environ.get("HGMERGE") |
|
68 | hgmerge = os.environ.get("HGMERGE") | |
59 | if hgmerge: |
|
69 | if hgmerge: | |
60 | return (hgmerge, hgmerge) |
|
70 | return (hgmerge, hgmerge) |
@@ -37,7 +37,7 b' a file, once as a link. Bundle was gener' | |||||
37 | Merge them and display *_ISLINK vars |
|
37 | Merge them and display *_ISLINK vars | |
38 | merge heads |
|
38 | merge heads | |
39 |
|
39 | |||
40 |
$ |
|
40 | $ hg merge --tool="python ../echo.py" | |
41 | HG_FILE l |
|
41 | HG_FILE l | |
42 | HG_MY_ISLINK 1 |
|
42 | HG_MY_ISLINK 1 | |
43 | HG_OTHER_ISLINK 0 |
|
43 | HG_OTHER_ISLINK 0 |
@@ -506,6 +506,49 b' Premerge' | |||||
506 | $ echo |
|
506 | $ echo | |
507 |
|
507 | |||
508 |
|
508 | |||
|
509 | ui.merge specifies internal:other but is overruled by --tool=false | |||
|
510 | ||||
|
511 | $ domerge -r 2 --config ui.merge=internal:other --tool=false | |||
|
512 | [merge-tools] | |||
|
513 | false.whatever= | |||
|
514 | true.priority=1 | |||
|
515 | true.executable=cat | |||
|
516 | # hg update -C 1 | |||
|
517 | # hg merge -r 2 --config ui.merge=internal:other --tool=false | |||
|
518 | merging f | |||
|
519 | merging f failed! | |||
|
520 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
521 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |||
|
522 | # cat f | |||
|
523 | revision 1 | |||
|
524 | space | |||
|
525 | # hg stat | |||
|
526 | M f | |||
|
527 | ? f.orig | |||
|
528 | ||||
|
529 | HGMERGE specifies internal:other but is overruled by --tool=false | |||
|
530 | ||||
|
531 | $ HGMERGE=internal:other ; export HGMERGE | |||
|
532 | $ domerge -r 2 --tool=false | |||
|
533 | [merge-tools] | |||
|
534 | false.whatever= | |||
|
535 | true.priority=1 | |||
|
536 | true.executable=cat | |||
|
537 | # hg update -C 1 | |||
|
538 | # hg merge -r 2 --tool=false | |||
|
539 | merging f | |||
|
540 | merging f failed! | |||
|
541 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
542 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |||
|
543 | # cat f | |||
|
544 | revision 1 | |||
|
545 | space | |||
|
546 | # hg stat | |||
|
547 | M f | |||
|
548 | ? f.orig | |||
|
549 | ||||
|
550 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests | |||
|
551 | ||||
509 | Default is silent simplemerge: |
|
552 | Default is silent simplemerge: | |
510 |
|
553 | |||
511 | $ domerge -r 3 |
|
554 | $ domerge -r 3 |
@@ -7,7 +7,6 b'' | |||||
7 | > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3])) |
|
7 | > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3])) | |
8 | > f.close() |
|
8 | > f.close() | |
9 | > EOF |
|
9 | > EOF | |
10 | $ HGMERGE="python ../merge"; export HGMERGE |
|
|||
11 |
|
10 | |||
12 |
|
|
11 | perform a test merge with possible renaming | |
13 | args: |
|
12 | args: | |
@@ -49,7 +48,7 b' args:' | |||||
49 | > echo "--------------" |
|
48 | > echo "--------------" | |
50 | > echo "test L:$1 R:$2 W:$3 - $4" |
|
49 | > echo "test L:$1 R:$2 W:$3 - $4" | |
51 | > echo "--------------" |
|
50 | > echo "--------------" | |
52 | > hg merge -y --debug --traceback |
|
51 | > hg merge -y --debug --traceback --tool="python ../merge" | |
53 | > |
|
52 | > | |
54 | > echo "--------------" |
|
53 | > echo "--------------" | |
55 | > hg status -camC -X rev |
|
54 | > hg status -camC -X rev |
@@ -21,7 +21,7 b' create a second head' | |||||
21 |
|
21 | |||
22 | failing merge |
|
22 | failing merge | |
23 |
|
23 | |||
24 | $ HGMERGE=internal:fail hg merge |
|
24 | $ hg merge --tool=internal:fail | |
25 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
25 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
26 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
26 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
27 | [1] |
|
27 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now