mercurial/helptext/merge-tools.txt
author Manuel Jacob <me@manueljacob.de>
Mon, 11 Jul 2022 01:51:20 +0200
branchstable
changeset 49378 094a5fa3cf52
parent 43632 2e017696181f
permissions -rw-r--r--
procutil: make stream detection in make_line_buffered more correct and strict In make_line_buffered(), we don’t want to wrap the stream if we know that lines get flushed to the underlying raw stream already. Previously, the heuristic was too optimistic. It assumed that any stream which is not an instance of io.BufferedIOBase doesn’t need wrapping. However, there are buffered streams that aren’t instances of io.BufferedIOBase, like Mercurial’s own winstdout. The new logic is different in two ways: First, only for the check, if unwraps any combination of WriteAllWrapper and winstdout. Second, it skips wrapping the stream only if it is an instance of io.RawIOBase (or already wrapped). If it is an instance of io.BufferedIOBase, it gets wrapped. In any other case, the function raises an exception. This ensures that, if an unknown stream is passed or we add another wrapper in the future, we don’t wrap the stream if it’s already line buffered or not wrap the stream if it’s not line buffered. In fact, this was already helpful during development of this change. Without it, I possibly would have forgot that WriteAllWrapper needs to be ignored for the check, leading to unnecessary wrapping if stdout is unbuffered. The alternative would have been to always wrap unknown streams. However, I don’t think that anyone would benefit from being less strict. We can expect streams from the standard library to be subclassing either io.RawIOBase or io.BufferedIOBase, so running Mercurial in the standard way should not regress by this change. Py2exe might replace sys.stdout and sys.stderr, but that currently breaks Mercurial anyway and also these streams don’t claim to be interactive, so this function is not called for them.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     1
To merge files Mercurial uses merge tools.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     2
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     3
A merge tool combines two different versions of a file into a merged
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     4
file. Merge tools are given the two files and the greatest common
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     5
ancestor of the two file versions, so they can determine the changes
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     6
made on both branches.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     7
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
     8
Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
     9
:hg:`backout` and in several extensions.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    10
12804
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    11
Usually, the merge tool tries to automatically reconcile the files by
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    12
combining all non-overlapping changes that occurred separately in
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    13
the two different evolutions of the same initial base file. Furthermore, some
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    14
interactive merge programs make it easier to manually resolve
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    15
conflicting merges, either in a graphical way, or by inserting some
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    16
conflict markers. Mercurial does not include any interactive merge
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    17
programs but relies on external tools for that.
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    18
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    19
Available merge tools
17267
979b107eaea2 doc: unify section level between help topics
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16126
diff changeset
    20
=====================
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    21
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    22
External merge tools and their properties are configured in the
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    23
merge-tools configuration section - see hgrc(5) - but they can often just
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    24
be named by their executable.
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    25
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    26
A merge tool is generally usable if its executable can be found on the
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    27
system and if it can handle the merge. The executable is found if it
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    28
is an absolute or relative executable path or the name of an
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    29
application in the executable search path. The tool is assumed to be
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    30
able to handle the merge if it can handle symlinks if the file is a
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    31
symlink, if it can handle binary files if the file is binary, and if a
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    32
GUI is available if the tool requires a GUI.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    33
12858
6eec9d7c6e0f help: fix typo in merge-tools topic
Wagner Bruna <wbruna@yahoo.com>
parents: 12838
diff changeset
    34
There are some internal merge tools which can be used. The internal
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    35
merge tools are:
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    36
16126
0c4bec9596d8 filemerge: create detail of internal merge tools from documentation string
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12858
diff changeset
    37
.. internaltoolsmarker
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    38
39126
e09fad982ef5 filemerge: show actual capabilities of internal merge tools
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39125
diff changeset
    39
Internal tools are always available and do not require a GUI but will
e09fad982ef5 filemerge: show actual capabilities of internal merge tools
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39125
diff changeset
    40
by default not handle symlinks or binary files. See next section for
e09fad982ef5 filemerge: show actual capabilities of internal merge tools
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39125
diff changeset
    41
detail about "actual capabilities" described above.
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    42
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    43
Choosing a merge tool
17267
979b107eaea2 doc: unify section level between help topics
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 16126
diff changeset
    44
=====================
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    45
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    46
Mercurial uses these rules when deciding which merge tool to use:
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    47
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    48
1. If a tool has been specified with the --tool option to merge or resolve, it
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    49
   is used.  If it is the name of a tool in the merge-tools configuration, its
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    50
   configuration is used. Otherwise the specified tool must be executable by
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    51
   the shell.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    52
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    53
2. If the ``HGMERGE`` environment variable is present, its value is used and
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    54
   must be executable by the shell.
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    55
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    56
3. If the filename of the file to be merged matches any of the patterns in the
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    57
   merge-patterns configuration section, the first usable merge tool
39121
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    58
   corresponding to a matching pattern is used.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    59
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    60
4. If ui.merge is set it will be considered next. If the value is not the name
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    61
   of a configured tool, the specified value is used and must be executable by
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    62
   the shell. Otherwise the named tool is used if it is usable.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    63
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    64
5. If any usable merge tools are present in the merge-tools configuration
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    65
   section, the one with the highest priority is used.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    66
12826
4d622380ab39 merge-tools.txt: 6 comes after 5
Patrick Mezard <pmezard@gmail.com>
parents: 12824
diff changeset
    67
6. If a program named ``hgmerge`` can be found on the system, it is used - but
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
    68
   it will by default not be used for symlinks and binary files.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    69
12824
93d6559a9cbc merge-tools.txt: fix typos, simplify, renumber from 1.
Patrick Mezard <pmezard@gmail.com>
parents: 12809
diff changeset
    70
7. If the file to be merged is not binary and is not a symlink, then
22707
38e0363dcbe0 filemerge: switch the default name for internal tools from internal:x to :x
Mads Kiilerich <madski@unity3d.com>
parents: 20532
diff changeset
    71
   internal ``:merge`` is used.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    72
32179
247bb7a2c492 help: describe about choice of :prompt as a fallback merge tool explicitly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22707
diff changeset
    73
8. Otherwise, ``:prompt`` is used.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    74
39268
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    75
For historical reason, Mercurial treats merge tools as below while
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    76
examining rules above.
39121
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    77
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    78
==== =============== ====== =======
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    79
step specified via   binary symlink
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    80
==== =============== ====== =======
39268
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    81
1.   --tool          o/o    o/o
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    82
2.   HGMERGE         o/o    o/o
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    83
3.   merge-patterns  o/o(*) x/?(*)
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    84
4.   ui.merge        x/?(*) x/?(*)
39121
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    85
==== =============== ====== =======
7c6044634957 help: describe more detail about capabilities while deciding merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 34948
diff changeset
    86
39268
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    87
Each capability column indicates Mercurial behavior for
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    88
internal/external merge tools at examining each rule.
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    89
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    90
- "o": "assume that a tool has capability"
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    91
- "x": "assume that a tool does not have capability"
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    92
- "?": "check actual capability of a tool"
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    93
39125
cded904f7acc filemerge: add config knob to check capabilities of internal merge tools
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39121
diff changeset
    94
If ``merge.strict-capability-check`` configuration is true, Mercurial
39268
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    95
checks capabilities of merge tools strictly in (*) cases above (= each
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    96
capability column becomes "?/?"). It is false by default for backward
0dfcc348d383 help: revise explanation about capability check while selecting merge tool
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39126
diff changeset
    97
compatibility.
39125
cded904f7acc filemerge: add config knob to check capabilities of internal merge tools
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39121
diff changeset
    98
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    99
.. note::
20532
f1a3ae7c15df help: remove last occurrences of ".. note::" without two newlines
Simon Heimberg <simohe@besonet.ch>
parents: 17267
diff changeset
   100
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
   101
   After selecting a merge program, Mercurial will by default attempt
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
   102
   to merge the files using a simple merge algorithm first. Only if it doesn't
34948
ff178743e59b help: minor copy editing for grammar
Matt Harbison <matt_harbison@yahoo.com>
parents: 32179
diff changeset
   103
   succeed because of conflicting changes will Mercurial actually execute the
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
   104
   merge program. Whether to use the simple merge algorithm first can be
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
   105
   controlled by the premerge setting of the merge tool. Premerge is enabled by
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
   106
   default unless the file is binary or a symlink.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
   107
12809
e5922564ab01 help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents: 12804
diff changeset
   108
See the merge-tools and ui sections of hgrc(5) for details on the
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
   109
configuration of merge tools.