Show More
@@ -771,6 +771,9 b" coreconfigitem('merge', 'on-failure'," | |||||
771 | coreconfigitem('merge', 'preferancestor', |
|
771 | coreconfigitem('merge', 'preferancestor', | |
772 | default=lambda: ['*'], |
|
772 | default=lambda: ['*'], | |
773 | ) |
|
773 | ) | |
|
774 | coreconfigitem('merge', 'strict-capability-check', | |||
|
775 | default=False, | |||
|
776 | ) | |||
774 | coreconfigitem('merge-tools', '.*', |
|
777 | coreconfigitem('merge-tools', '.*', | |
775 | default=None, |
|
778 | default=None, | |
776 | generic=True, |
|
779 | generic=True, |
@@ -137,6 +137,8 b' def findexternaltool(ui, tool):' | |||||
137 | return procutil.findexe(util.expandpath(exe)) |
|
137 | return procutil.findexe(util.expandpath(exe)) | |
138 |
|
138 | |||
139 | def _picktool(repo, ui, path, binary, symlink, changedelete): |
|
139 | def _picktool(repo, ui, path, binary, symlink, changedelete): | |
|
140 | strictcheck = ui.configbool('merge', 'strict-capability-check') | |||
|
141 | ||||
140 | def hascapability(tool, capability, strict=False): |
|
142 | def hascapability(tool, capability, strict=False): | |
141 | if strict and tool in internals: |
|
143 | if strict and tool in internals: | |
142 | if internals[tool].capabilities.get(capability): |
|
144 | if internals[tool].capabilities.get(capability): | |
@@ -155,9 +157,9 b' def _picktool(repo, ui, path, binary, sy' | |||||
155 | ui.warn(_("couldn't find merge tool %s\n") % tmsg) |
|
157 | ui.warn(_("couldn't find merge tool %s\n") % tmsg) | |
156 | else: # configured but non-existing tools are more silent |
|
158 | else: # configured but non-existing tools are more silent | |
157 | ui.note(_("couldn't find merge tool %s\n") % tmsg) |
|
159 | ui.note(_("couldn't find merge tool %s\n") % tmsg) | |
158 | elif symlink and not hascapability(tool, "symlink"): |
|
160 | elif symlink and not hascapability(tool, "symlink", strictcheck): | |
159 | ui.warn(_("tool %s can't handle symlinks\n") % tmsg) |
|
161 | ui.warn(_("tool %s can't handle symlinks\n") % tmsg) | |
160 | elif binary and not hascapability(tool, "binary"): |
|
162 | elif binary and not hascapability(tool, "binary", strictcheck): | |
161 | ui.warn(_("tool %s can't handle binary\n") % tmsg) |
|
163 | ui.warn(_("tool %s can't handle binary\n") % tmsg) | |
162 | elif changedelete and not supportscd(tool): |
|
164 | elif changedelete and not supportscd(tool): | |
163 | # the nomerge tools are the only tools that support change/delete |
|
165 | # the nomerge tools are the only tools that support change/delete | |
@@ -192,9 +194,13 b' def _picktool(repo, ui, path, binary, sy' | |||||
192 | return (hgmerge, hgmerge) |
|
194 | return (hgmerge, hgmerge) | |
193 |
|
195 | |||
194 | # then patterns |
|
196 | # then patterns | |
|
197 | ||||
|
198 | # whether binary capability should be checked strictly | |||
|
199 | binarycap = binary and strictcheck | |||
|
200 | ||||
195 | for pat, tool in ui.configitems("merge-patterns"): |
|
201 | for pat, tool in ui.configitems("merge-patterns"): | |
196 | mf = match.match(repo.root, '', [pat]) |
|
202 | mf = match.match(repo.root, '', [pat]) | |
197 |
if mf(path) and check(tool, pat, symlink, |
|
203 | if mf(path) and check(tool, pat, symlink, binarycap, changedelete): | |
198 | if binary and not hascapability(tool, "binary", strict=True): |
|
204 | if binary and not hascapability(tool, "binary", strict=True): | |
199 | ui.warn(_("warning: check merge-patterns configurations," |
|
205 | ui.warn(_("warning: check merge-patterns configurations," | |
200 | " if %r for binary file %r is unintentional\n" |
|
206 | " if %r for binary file %r is unintentional\n" |
@@ -1347,6 +1347,11 b' This section specifies behavior during m' | |||||
1347 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1347 | halted, the repository is left in a normal ``unresolved`` merge state. | |
1348 | (default: ``continue``) |
|
1348 | (default: ``continue``) | |
1349 |
|
1349 | |||
|
1350 | ``strict-capability-check`` | |||
|
1351 | Whether capabilities of internal merge tools are checked strictly | |||
|
1352 | or not, while examining rules to decide merge tool to be used. | |||
|
1353 | (default: False) | |||
|
1354 | ||||
1350 | ``merge-patterns`` |
|
1355 | ``merge-patterns`` | |
1351 | ------------------ |
|
1356 | ------------------ | |
1352 |
|
1357 |
@@ -80,10 +80,14 b' step specified via binary symlink' | |||||
80 | ==== =============== ====== ======= |
|
80 | ==== =============== ====== ======= | |
81 | 1. --tool o o |
|
81 | 1. --tool o o | |
82 | 2. HGMERGE o o |
|
82 | 2. HGMERGE o o | |
83 |
3. merge-patterns o |
|
83 | 3. merge-patterns o (*) x (*) | |
84 |
4. ui.merge x |
|
84 | 4. ui.merge x (*) x (*) | |
85 | ==== =============== ====== ======= |
|
85 | ==== =============== ====== ======= | |
86 |
|
86 | |||
|
87 | If ``merge.strict-capability-check`` configuration is true, Mercurial | |||
|
88 | checks capabilities of internal merge tools strictly in (*) cases | |||
|
89 | above. It is false by default for backward compatibility. | |||
|
90 | ||||
87 | .. note:: |
|
91 | .. note:: | |
88 |
|
92 | |||
89 | After selecting a merge program, Mercurial will by default attempt |
|
93 | After selecting a merge program, Mercurial will by default attempt |
@@ -1913,8 +1913,12 b' Test dynamic list of merge tools only sh' | |||||
1913 | ---------------------------------- |
|
1913 | ---------------------------------- | |
1914 | 1. --tool o o |
|
1914 | 1. --tool o o | |
1915 | 2. HGMERGE o o |
|
1915 | 2. HGMERGE o o | |
1916 |
3. merge-patterns o |
|
1916 | 3. merge-patterns o (*) x (*) | |
1917 |
4. ui.merge x |
|
1917 | 4. ui.merge x (*) x (*) | |
|
1918 | ||||
|
1919 | If "merge.strict-capability-check" configuration is true, Mercurial checks | |||
|
1920 | capabilities of internal merge tools strictly in (*) cases above. It is | |||
|
1921 | false by default for backward compatibility. | |||
1918 |
|
1922 | |||
1919 | Note: |
|
1923 | Note: | |
1920 | After selecting a merge program, Mercurial will by default attempt to |
|
1924 | After selecting a merge program, Mercurial will by default attempt to |
@@ -1840,6 +1840,51 b' checked strictly.' | |||||
1840 | [1] |
|
1840 | [1] | |
1841 | $ hg merge --abort -q |
|
1841 | $ hg merge --abort -q | |
1842 |
|
1842 | |||
|
1843 | (for ui.merge, ignored unintentionally) | |||
|
1844 | ||||
|
1845 | $ hg merge 9 \ | |||
|
1846 | > --config ui.merge=:other | |||
|
1847 | tool :other (for pattern b) can't handle binary | |||
|
1848 | tool true can't handle binary | |||
|
1849 | tool false can't handle binary | |||
|
1850 | no tool found to merge b | |||
|
1851 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for b? u | |||
|
1852 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
1853 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |||
|
1854 | [1] | |||
|
1855 | $ hg merge --abort -q | |||
|
1856 | ||||
|
1857 | With merge.strict-capability-check=true, binary files capability of | |||
|
1858 | internal merge tools is checked strictly. | |||
|
1859 | ||||
|
1860 | $ f --hexdump b | |||
|
1861 | b: | |||
|
1862 | 0000: 03 02 01 00 |....| | |||
|
1863 | ||||
|
1864 | (for merge-patterns) | |||
|
1865 | ||||
|
1866 | $ hg merge 9 --config merge.strict-capability-check=true \ | |||
|
1867 | > --config merge-patterns.b=:merge-other \ | |||
|
1868 | > --config merge-patterns.re:[a-z]=:other | |||
|
1869 | tool :merge-other (for pattern b) can't handle binary | |||
|
1870 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
1871 | (branch merge, don't forget to commit) | |||
|
1872 | $ f --hexdump b | |||
|
1873 | b: | |||
|
1874 | 0000: 00 01 02 03 |....| | |||
|
1875 | $ hg merge --abort -q | |||
|
1876 | ||||
|
1877 | (for ui.merge) | |||
|
1878 | ||||
|
1879 | $ hg merge 9 --config merge.strict-capability-check=true \ | |||
|
1880 | > --config ui.merge=:other | |||
|
1881 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
1882 | (branch merge, don't forget to commit) | |||
|
1883 | $ f --hexdump b | |||
|
1884 | b: | |||
|
1885 | 0000: 00 01 02 03 |....| | |||
|
1886 | $ hg merge --abort -q | |||
|
1887 | ||||
1843 | Check that debugpicktool examines which merge tool is chosen for |
|
1888 | Check that debugpicktool examines which merge tool is chosen for | |
1844 | specified file as expected |
|
1889 | specified file as expected | |
1845 |
|
1890 | |||
@@ -1883,6 +1928,36 b' specified file as expected' | |||||
1883 | $ hg debugpickmergetool -r 6d00b3726f6e |
|
1928 | $ hg debugpickmergetool -r 6d00b3726f6e | |
1884 | f = :prompt |
|
1929 | f = :prompt | |
1885 |
|
1930 | |||
|
1931 | (by default, it is assumed that no internal merge tools has symlinks | |||
|
1932 | capability) | |||
|
1933 | ||||
|
1934 | $ hg debugpickmergetool \ | |||
|
1935 | > -r 6d00b3726f6e \ | |||
|
1936 | > --config merge-patterns.f=:merge-other \ | |||
|
1937 | > --config merge-patterns.re:[f]=:merge-local \ | |||
|
1938 | > --config merge-patterns.re:[a-z]=:other | |||
|
1939 | f = :prompt | |||
|
1940 | ||||
|
1941 | $ hg debugpickmergetool \ | |||
|
1942 | > -r 6d00b3726f6e \ | |||
|
1943 | > --config ui.merge=:other | |||
|
1944 | f = :prompt | |||
|
1945 | ||||
|
1946 | (with strict-capability-check=true, actual symlink capabilities are | |||
|
1947 | checked striclty) | |||
|
1948 | ||||
|
1949 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ | |||
|
1950 | > -r 6d00b3726f6e \ | |||
|
1951 | > --config merge-patterns.f=:merge-other \ | |||
|
1952 | > --config merge-patterns.re:[f]=:merge-local \ | |||
|
1953 | > --config merge-patterns.re:[a-z]=:other | |||
|
1954 | f = :other | |||
|
1955 | ||||
|
1956 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ | |||
|
1957 | > -r 6d00b3726f6e \ | |||
|
1958 | > --config ui.merge=:other | |||
|
1959 | f = :other | |||
|
1960 | ||||
1886 | #endif |
|
1961 | #endif | |
1887 |
|
1962 | |||
1888 | (--verbose shows some configurations) |
|
1963 | (--verbose shows some configurations) |
General Comments 0
You need to be logged in to leave comments.
Login now