Show More
@@ -91,8 +91,10 b' update-pot: i18n/hg.pot' | |||
|
91 | 91 | |
|
92 | 92 | i18n/hg.pot: $(PYFILES) $(DOCFILES) |
|
93 | 93 | $(PYTHON) i18n/hggettext mercurial/commands.py \ |
|
94 |
hgext/*.py hgext/*/__init__.py |
|
|
94 | hgext/*.py hgext/*/__init__.py \ | |
|
95 | mercurial/fileset.py mercurial/revset.py \ | |
|
95 | 96 | mercurial/templatefilters.py mercurial/templatekw.py \ |
|
97 | mercurial/filemerge.py \ | |
|
96 | 98 | $(DOCFILES) > i18n/hg.pot |
|
97 | 99 | # All strings marked for translation in Mercurial contain |
|
98 | 100 | # ASCII characters only. But some files contain string |
@@ -19,19 +19,19 b' def _toolbool(ui, tool, part, default=Fa' | |||
|
19 | 19 | def _toollist(ui, tool, part, default=[]): |
|
20 | 20 | return ui.configlist("merge-tools", tool + "." + part, default) |
|
21 | 21 | |
|
22 |
|
|
|
22 | internals = {} | |
|
23 | 23 | |
|
24 | 24 | def internaltool(name, trymerge, onfailure=None): |
|
25 | 25 | '''return a decorator for populating internal merge tool table''' |
|
26 | 26 | def decorator(func): |
|
27 |
|
|
|
27 | internals[name] = func | |
|
28 | 28 | func.trymerge = trymerge |
|
29 | 29 | func.onfailure = onfailure |
|
30 | 30 | return func |
|
31 | 31 | return decorator |
|
32 | 32 | |
|
33 | 33 | def _findtool(ui, tool): |
|
34 |
if tool in |
|
|
34 | if tool in internals: | |
|
35 | 35 | return tool |
|
36 | 36 | for kn in ("regkey", "regkeyalt"): |
|
37 | 37 | k = _toolstr(ui, tool, kn) |
@@ -133,6 +133,9 b' def _matcheol(file, origfile):' | |||
|
133 | 133 | |
|
134 | 134 | @internaltool('internal:prompt', False) |
|
135 | 135 | def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf): |
|
136 | """``internal:prompt`` | |
|
137 | Asks the user which of the local or the other version to keep as | |
|
138 | the merged version.""" | |
|
136 | 139 | ui = repo.ui |
|
137 | 140 | fd = fcd.path() |
|
138 | 141 | |
@@ -145,15 +148,23 b' def _iprompt(repo, mynode, orig, fcd, fc' | |||
|
145 | 148 | |
|
146 | 149 | @internaltool('internal:local', False) |
|
147 | 150 | def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf): |
|
151 | """``internal:local`` | |
|
152 | Uses the local version of files as the merged version.""" | |
|
148 | 153 | return 0 |
|
149 | 154 | |
|
150 | 155 | @internaltool('internal:other', False) |
|
151 | 156 | def _iother(repo, mynode, orig, fcd, fco, fca, toolconf): |
|
157 | """``internal:other`` | |
|
158 | Uses the other version of files as the merged version.""" | |
|
152 | 159 | repo.wwrite(fcd.path(), fco.data(), fco.flags()) |
|
153 | 160 | return 0 |
|
154 | 161 | |
|
155 | 162 | @internaltool('internal:fail', False) |
|
156 | 163 | def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf): |
|
164 | """``internal:fail`` | |
|
165 | Rather than attempting to merge files that were modified on both | |
|
166 | branches, it marks them as unresolved. The resolve command must be | |
|
167 | used to resolve these conflicts.""" | |
|
157 | 168 | return 1 |
|
158 | 169 | |
|
159 | 170 | def _premerge(repo, toolconf, files): |
@@ -187,6 +198,10 b' def _premerge(repo, toolconf, files):' | |||
|
187 | 198 | _("merging %s incomplete! " |
|
188 | 199 | "(edit conflicts, then use 'hg resolve --mark')\n")) |
|
189 | 200 | def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files): |
|
201 | """``internal:merge`` | |
|
202 | Uses the internal non-interactive simple merge algorithm for merging | |
|
203 | files. It will fail if there are any conflicts and leave markers in | |
|
204 | the partially merged file.""" | |
|
190 | 205 | r = _premerge(repo, toolconf, files) |
|
191 | 206 | if r: |
|
192 | 207 | a, b, c, back = files |
@@ -199,6 +214,13 b' def _imerge(repo, mynode, orig, fcd, fco' | |||
|
199 | 214 | |
|
200 | 215 | @internaltool('internal:dump', True) |
|
201 | 216 | def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files): |
|
217 | """``internal:dump`` | |
|
218 | Creates three versions of the files to merge, containing the | |
|
219 | contents of local, other and base. These files can then be used to | |
|
220 | perform a merge manually. If the file to be merged is named | |
|
221 | ``a.txt``, these files will accordingly be named ``a.txt.local``, | |
|
222 | ``a.txt.other`` and ``a.txt.base`` and they will be placed in the | |
|
223 | same directory as ``a.txt``.""" | |
|
202 | 224 | r = _premerge(repo, toolconf, files) |
|
203 | 225 | if r: |
|
204 | 226 | a, b, c, back = files |
@@ -267,8 +289,8 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
267 | 289 | ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" % |
|
268 | 290 | (tool, fd, binary, symlink)) |
|
269 | 291 | |
|
270 |
if tool in |
|
|
271 |
func = |
|
|
292 | if tool in internals: | |
|
293 | func = internals[tool] | |
|
272 | 294 | trymerge = func.trymerge |
|
273 | 295 | onfailure = func.onfailure |
|
274 | 296 | else: |
@@ -340,3 +362,6 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
340 | 362 | os.unlink(b) |
|
341 | 363 | os.unlink(c) |
|
342 | 364 | return r |
|
365 | ||
|
366 | # tell hggettext to extract docstrings from these functions: | |
|
367 | i18nfunctions = internals.values() |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | from i18n import gettext, _ |
|
9 | 9 | import sys, os |
|
10 | import extensions, revset, fileset, templatekw, templatefilters | |
|
10 | import extensions, revset, fileset, templatekw, templatefilters, filemerge | |
|
11 | 11 | import util |
|
12 | 12 | |
|
13 | 13 | def listexts(header, exts, indent=1): |
@@ -105,6 +105,7 b' def addtopicsymbols(topic, marker, symbo' | |||
|
105 | 105 | addtopichook(topic, add) |
|
106 | 106 | |
|
107 | 107 | addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols) |
|
108 | addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals) | |
|
108 | 109 | addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols) |
|
109 | 110 | addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords) |
|
110 | 111 | addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters) |
@@ -34,33 +34,7 b' GUI is available if the tool requires a ' | |||
|
34 | 34 | There are some internal merge tools which can be used. The internal |
|
35 | 35 | merge tools are: |
|
36 | 36 | |
|
37 | ``internal:merge`` | |
|
38 | Uses the internal non-interactive simple merge algorithm for merging | |
|
39 | files. It will fail if there are any conflicts and leave markers in | |
|
40 | the partially merged file. | |
|
41 | ||
|
42 | ``internal:fail`` | |
|
43 | Rather than attempting to merge files that were modified on both | |
|
44 | branches, it marks them as unresolved. The resolve command must be | |
|
45 | used to resolve these conflicts. | |
|
46 | ||
|
47 | ``internal:local`` | |
|
48 | Uses the local version of files as the merged version. | |
|
49 | ||
|
50 | ``internal:other`` | |
|
51 | Uses the other version of files as the merged version. | |
|
52 | ||
|
53 | ``internal:prompt`` | |
|
54 | Asks the user which of the local or the other version to keep as | |
|
55 | the merged version. | |
|
56 | ||
|
57 | ``internal:dump`` | |
|
58 | Creates three versions of the files to merge, containing the | |
|
59 | contents of local, other and base. These files can then be used to | |
|
60 | perform a merge manually. If the file to be merged is named | |
|
61 | ``a.txt``, these files will accordingly be named ``a.txt.local``, | |
|
62 | ``a.txt.other`` and ``a.txt.base`` and they will be placed in the | |
|
63 | same directory as ``a.txt``. | |
|
37 | .. internaltoolsmarker | |
|
64 | 38 | |
|
65 | 39 | Internal tools are always available and do not require a GUI but will by default |
|
66 | 40 | not handle symlinks or binary files. |
General Comments 0
You need to be logged in to leave comments.
Login now