Show More
@@ -1101,6 +1101,125 b' Test section lookup' | |||
|
1101 | 1101 | abort: help section not found |
|
1102 | 1102 | [255] |
|
1103 | 1103 | |
|
1104 | Test dynamic list of merge tools only shows up once | |
|
1105 | $ hg help merge-tools | |
|
1106 | Merge Tools | |
|
1107 | """"""""""" | |
|
1108 | ||
|
1109 | To merge files Mercurial uses merge tools. | |
|
1110 | ||
|
1111 | A merge tool combines two different versions of a file into a merged file. | |
|
1112 | Merge tools are given the two files and the greatest common ancestor of | |
|
1113 | the two file versions, so they can determine the changes made on both | |
|
1114 | branches. | |
|
1115 | ||
|
1116 | Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg | |
|
1117 | backout" and in several extensions. | |
|
1118 | ||
|
1119 | Usually, the merge tool tries to automatically reconcile the files by | |
|
1120 | combining all non-overlapping changes that occurred separately in the two | |
|
1121 | different evolutions of the same initial base file. Furthermore, some | |
|
1122 | interactive merge programs make it easier to manually resolve conflicting | |
|
1123 | merges, either in a graphical way, or by inserting some conflict markers. | |
|
1124 | Mercurial does not include any interactive merge programs but relies on | |
|
1125 | external tools for that. | |
|
1126 | ||
|
1127 | Available merge tools | |
|
1128 | ===================== | |
|
1129 | ||
|
1130 | External merge tools and their properties are configured in the merge- | |
|
1131 | tools configuration section - see hgrc(5) - but they can often just be | |
|
1132 | named by their executable. | |
|
1133 | ||
|
1134 | A merge tool is generally usable if its executable can be found on the | |
|
1135 | system and if it can handle the merge. The executable is found if it is an | |
|
1136 | absolute or relative executable path or the name of an application in the | |
|
1137 | executable search path. The tool is assumed to be able to handle the merge | |
|
1138 | if it can handle symlinks if the file is a symlink, if it can handle | |
|
1139 | binary files if the file is binary, and if a GUI is available if the tool | |
|
1140 | requires a GUI. | |
|
1141 | ||
|
1142 | There are some internal merge tools which can be used. The internal merge | |
|
1143 | tools are: | |
|
1144 | ||
|
1145 | ":dump" | |
|
1146 | Creates three versions of the files to merge, containing the contents of | |
|
1147 | local, other and base. These files can then be used to perform a merge | |
|
1148 | manually. If the file to be merged is named "a.txt", these files will | |
|
1149 | accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and | |
|
1150 | they will be placed in the same directory as "a.txt". | |
|
1151 | ||
|
1152 | ":fail" | |
|
1153 | Rather than attempting to merge files that were modified on both | |
|
1154 | branches, it marks them as unresolved. The resolve command must be used | |
|
1155 | to resolve these conflicts. | |
|
1156 | ||
|
1157 | ":local" | |
|
1158 | Uses the local version of files as the merged version. | |
|
1159 | ||
|
1160 | ":merge" | |
|
1161 | Uses the internal non-interactive simple merge algorithm for merging | |
|
1162 | files. It will fail if there are any conflicts and leave markers in the | |
|
1163 | partially merged file. Markers will have two sections, one for each side | |
|
1164 | of merge. | |
|
1165 | ||
|
1166 | ":merge3" | |
|
1167 | Uses the internal non-interactive simple merge algorithm for merging | |
|
1168 | files. It will fail if there are any conflicts and leave markers in the | |
|
1169 | partially merged file. Marker will have three sections, one from each | |
|
1170 | side of the merge and one for the base content. | |
|
1171 | ||
|
1172 | ":other" | |
|
1173 | Uses the other version of files as the merged version. | |
|
1174 | ||
|
1175 | ":prompt" | |
|
1176 | Asks the user which of the local or the other version to keep as the | |
|
1177 | merged version. | |
|
1178 | ||
|
1179 | ":tagmerge" | |
|
1180 | Uses the internal tag merge algorithm (experimental). | |
|
1181 | ||
|
1182 | Internal tools are always available and do not require a GUI but will by | |
|
1183 | default not handle symlinks or binary files. | |
|
1184 | ||
|
1185 | Choosing a merge tool | |
|
1186 | ===================== | |
|
1187 | ||
|
1188 | Mercurial uses these rules when deciding which merge tool to use: | |
|
1189 | ||
|
1190 | 1. If a tool has been specified with the --tool option to merge or | |
|
1191 | resolve, it is used. If it is the name of a tool in the merge-tools | |
|
1192 | configuration, its configuration is used. Otherwise the specified tool | |
|
1193 | must be executable by the shell. | |
|
1194 | 2. If the "HGMERGE" environment variable is present, its value is used and | |
|
1195 | must be executable by the shell. | |
|
1196 | 3. If the filename of the file to be merged matches any of the patterns in | |
|
1197 | the merge-patterns configuration section, the first usable merge tool | |
|
1198 | corresponding to a matching pattern is used. Here, binary capabilities | |
|
1199 | of the merge tool are not considered. | |
|
1200 | 4. If ui.merge is set it will be considered next. If the value is not the | |
|
1201 | name of a configured tool, the specified value is used and must be | |
|
1202 | executable by the shell. Otherwise the named tool is used if it is | |
|
1203 | usable. | |
|
1204 | 5. If any usable merge tools are present in the merge-tools configuration | |
|
1205 | section, the one with the highest priority is used. | |
|
1206 | 6. If a program named "hgmerge" can be found on the system, it is used - | |
|
1207 | but it will by default not be used for symlinks and binary files. | |
|
1208 | 7. If the file to be merged is not binary and is not a symlink, then | |
|
1209 | internal ":merge" is used. | |
|
1210 | 8. The merge of the file fails and must be resolved before commit. | |
|
1211 | ||
|
1212 | Note: | |
|
1213 | After selecting a merge program, Mercurial will by default attempt to | |
|
1214 | merge the files using a simple merge algorithm first. Only if it | |
|
1215 | doesn't succeed because of conflicting changes Mercurial will actually | |
|
1216 | execute the merge program. Whether to use the simple merge algorithm | |
|
1217 | first can be controlled by the premerge setting of the merge tool. | |
|
1218 | Premerge is enabled by default unless the file is binary or a symlink. | |
|
1219 | ||
|
1220 | See the merge-tools and ui sections of hgrc(5) for details on the | |
|
1221 | configuration of merge tools. | |
|
1222 | ||
|
1104 | 1223 | Test usage of section marks in help documents |
|
1105 | 1224 | |
|
1106 | 1225 | $ cd "$TESTDIR"/../doc |
General Comments 0
You need to be logged in to leave comments.
Login now