Show More
@@ -1,1002 +1,1001 b'' | |||||
1 | # filemerge.py - file-level merge handling for Mercurial |
|
1 | # filemerge.py - file-level merge handling for Mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import contextlib |
|
10 | import contextlib | |
11 | import os |
|
11 | import os | |
12 | import re |
|
12 | import re | |
13 | import shutil |
|
13 | import shutil | |
14 |
|
14 | |||
15 | from .i18n import _ |
|
15 | from .i18n import _ | |
16 | from .node import nullid, short |
|
16 | from .node import nullid, short | |
17 |
|
17 | |||
18 | from . import ( |
|
18 | from . import ( | |
19 | encoding, |
|
19 | encoding, | |
20 | error, |
|
20 | error, | |
21 | formatter, |
|
21 | formatter, | |
22 | match, |
|
22 | match, | |
23 | pycompat, |
|
23 | pycompat, | |
24 | registrar, |
|
24 | registrar, | |
25 | scmutil, |
|
25 | scmutil, | |
26 | simplemerge, |
|
26 | simplemerge, | |
27 | tagmerge, |
|
27 | tagmerge, | |
28 | templatekw, |
|
28 | templatekw, | |
29 | templater, |
|
29 | templater, | |
30 | util, |
|
30 | util, | |
31 | ) |
|
31 | ) | |
32 |
|
32 | |||
33 | from .utils import ( |
|
33 | from .utils import ( | |
34 | procutil, |
|
34 | procutil, | |
35 | stringutil, |
|
35 | stringutil, | |
36 | ) |
|
36 | ) | |
37 |
|
37 | |||
38 | def _toolstr(ui, tool, part, *args): |
|
38 | def _toolstr(ui, tool, part, *args): | |
39 | return ui.config("merge-tools", tool + "." + part, *args) |
|
39 | return ui.config("merge-tools", tool + "." + part, *args) | |
40 |
|
40 | |||
41 | def _toolbool(ui, tool, part,*args): |
|
41 | def _toolbool(ui, tool, part,*args): | |
42 | return ui.configbool("merge-tools", tool + "." + part, *args) |
|
42 | return ui.configbool("merge-tools", tool + "." + part, *args) | |
43 |
|
43 | |||
44 | def _toollist(ui, tool, part): |
|
44 | def _toollist(ui, tool, part): | |
45 | return ui.configlist("merge-tools", tool + "." + part) |
|
45 | return ui.configlist("merge-tools", tool + "." + part) | |
46 |
|
46 | |||
47 | internals = {} |
|
47 | internals = {} | |
48 | # Merge tools to document. |
|
48 | # Merge tools to document. | |
49 | internalsdoc = {} |
|
49 | internalsdoc = {} | |
50 |
|
50 | |||
51 | internaltool = registrar.internalmerge() |
|
51 | internaltool = registrar.internalmerge() | |
52 |
|
52 | |||
53 | # internal tool merge types |
|
53 | # internal tool merge types | |
54 | nomerge = internaltool.nomerge |
|
54 | nomerge = internaltool.nomerge | |
55 | mergeonly = internaltool.mergeonly # just the full merge, no premerge |
|
55 | mergeonly = internaltool.mergeonly # just the full merge, no premerge | |
56 | fullmerge = internaltool.fullmerge # both premerge and merge |
|
56 | fullmerge = internaltool.fullmerge # both premerge and merge | |
57 |
|
57 | |||
58 | _localchangedotherdeletedmsg = _( |
|
58 | _localchangedotherdeletedmsg = _( | |
59 | "local%(l)s changed %(fd)s which other%(o)s deleted\n" |
|
59 | "local%(l)s changed %(fd)s which other%(o)s deleted\n" | |
60 | "use (c)hanged version, (d)elete, or leave (u)nresolved?" |
|
60 | "use (c)hanged version, (d)elete, or leave (u)nresolved?" | |
61 | "$$ &Changed $$ &Delete $$ &Unresolved") |
|
61 | "$$ &Changed $$ &Delete $$ &Unresolved") | |
62 |
|
62 | |||
63 | _otherchangedlocaldeletedmsg = _( |
|
63 | _otherchangedlocaldeletedmsg = _( | |
64 | "other%(o)s changed %(fd)s which local%(l)s deleted\n" |
|
64 | "other%(o)s changed %(fd)s which local%(l)s deleted\n" | |
65 | "use (c)hanged version, leave (d)eleted, or " |
|
65 | "use (c)hanged version, leave (d)eleted, or " | |
66 | "leave (u)nresolved?" |
|
66 | "leave (u)nresolved?" | |
67 | "$$ &Changed $$ &Deleted $$ &Unresolved") |
|
67 | "$$ &Changed $$ &Deleted $$ &Unresolved") | |
68 |
|
68 | |||
69 | class absentfilectx(object): |
|
69 | class absentfilectx(object): | |
70 | """Represents a file that's ostensibly in a context but is actually not |
|
70 | """Represents a file that's ostensibly in a context but is actually not | |
71 | present in it. |
|
71 | present in it. | |
72 |
|
72 | |||
73 | This is here because it's very specific to the filemerge code for now -- |
|
73 | This is here because it's very specific to the filemerge code for now -- | |
74 | other code is likely going to break with the values this returns.""" |
|
74 | other code is likely going to break with the values this returns.""" | |
75 | def __init__(self, ctx, f): |
|
75 | def __init__(self, ctx, f): | |
76 | self._ctx = ctx |
|
76 | self._ctx = ctx | |
77 | self._f = f |
|
77 | self._f = f | |
78 |
|
78 | |||
79 | def path(self): |
|
79 | def path(self): | |
80 | return self._f |
|
80 | return self._f | |
81 |
|
81 | |||
82 | def size(self): |
|
82 | def size(self): | |
83 | return None |
|
83 | return None | |
84 |
|
84 | |||
85 | def data(self): |
|
85 | def data(self): | |
86 | return None |
|
86 | return None | |
87 |
|
87 | |||
88 | def filenode(self): |
|
88 | def filenode(self): | |
89 | return nullid |
|
89 | return nullid | |
90 |
|
90 | |||
91 | _customcmp = True |
|
91 | _customcmp = True | |
92 | def cmp(self, fctx): |
|
92 | def cmp(self, fctx): | |
93 | """compare with other file context |
|
93 | """compare with other file context | |
94 |
|
94 | |||
95 | returns True if different from fctx. |
|
95 | returns True if different from fctx. | |
96 | """ |
|
96 | """ | |
97 | return not (fctx.isabsent() and |
|
97 | return not (fctx.isabsent() and | |
98 | fctx.ctx() == self.ctx() and |
|
98 | fctx.ctx() == self.ctx() and | |
99 | fctx.path() == self.path()) |
|
99 | fctx.path() == self.path()) | |
100 |
|
100 | |||
101 | def flags(self): |
|
101 | def flags(self): | |
102 | return '' |
|
102 | return '' | |
103 |
|
103 | |||
104 | def changectx(self): |
|
104 | def changectx(self): | |
105 | return self._ctx |
|
105 | return self._ctx | |
106 |
|
106 | |||
107 | def isbinary(self): |
|
107 | def isbinary(self): | |
108 | return False |
|
108 | return False | |
109 |
|
109 | |||
110 | def isabsent(self): |
|
110 | def isabsent(self): | |
111 | return True |
|
111 | return True | |
112 |
|
112 | |||
113 | def _findtool(ui, tool): |
|
113 | def _findtool(ui, tool): | |
114 | if tool in internals: |
|
114 | if tool in internals: | |
115 | return tool |
|
115 | return tool | |
116 | cmd = _toolstr(ui, tool, "executable", tool) |
|
116 | cmd = _toolstr(ui, tool, "executable", tool) | |
117 | if cmd.startswith('python:'): |
|
117 | if cmd.startswith('python:'): | |
118 | return cmd |
|
118 | return cmd | |
119 | return findexternaltool(ui, tool) |
|
119 | return findexternaltool(ui, tool) | |
120 |
|
120 | |||
121 | def _quotetoolpath(cmd): |
|
121 | def _quotetoolpath(cmd): | |
122 | if cmd.startswith('python:'): |
|
122 | if cmd.startswith('python:'): | |
123 | return cmd |
|
123 | return cmd | |
124 | return procutil.shellquote(cmd) |
|
124 | return procutil.shellquote(cmd) | |
125 |
|
125 | |||
126 | def findexternaltool(ui, tool): |
|
126 | def findexternaltool(ui, tool): | |
127 | for kn in ("regkey", "regkeyalt"): |
|
127 | for kn in ("regkey", "regkeyalt"): | |
128 | k = _toolstr(ui, tool, kn) |
|
128 | k = _toolstr(ui, tool, kn) | |
129 | if not k: |
|
129 | if not k: | |
130 | continue |
|
130 | continue | |
131 | p = util.lookupreg(k, _toolstr(ui, tool, "regname")) |
|
131 | p = util.lookupreg(k, _toolstr(ui, tool, "regname")) | |
132 | if p: |
|
132 | if p: | |
133 | p = procutil.findexe(p + _toolstr(ui, tool, "regappend", "")) |
|
133 | p = procutil.findexe(p + _toolstr(ui, tool, "regappend", "")) | |
134 | if p: |
|
134 | if p: | |
135 | return p |
|
135 | return p | |
136 | exe = _toolstr(ui, tool, "executable", tool) |
|
136 | exe = _toolstr(ui, tool, "executable", 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') |
|
140 | strictcheck = ui.configbool('merge', 'strict-capability-check') | |
141 |
|
141 | |||
142 | def hascapability(tool, capability, strict=False): |
|
142 | def hascapability(tool, capability, strict=False): | |
143 |
if |
|
143 | if tool in internals: | |
144 |
|
|
144 | return strict and internals[tool].capabilities.get(capability) | |
145 | return True |
|
|||
146 | return _toolbool(ui, tool, capability) |
|
145 | return _toolbool(ui, tool, capability) | |
147 |
|
146 | |||
148 | def supportscd(tool): |
|
147 | def supportscd(tool): | |
149 | return tool in internals and internals[tool].mergetype == nomerge |
|
148 | return tool in internals and internals[tool].mergetype == nomerge | |
150 |
|
149 | |||
151 | def check(tool, pat, symlink, binary, changedelete): |
|
150 | def check(tool, pat, symlink, binary, changedelete): | |
152 | tmsg = tool |
|
151 | tmsg = tool | |
153 | if pat: |
|
152 | if pat: | |
154 | tmsg = _("%s (for pattern %s)") % (tool, pat) |
|
153 | tmsg = _("%s (for pattern %s)") % (tool, pat) | |
155 | if not _findtool(ui, tool): |
|
154 | if not _findtool(ui, tool): | |
156 | if pat: # explicitly requested tool deserves a warning |
|
155 | if pat: # explicitly requested tool deserves a warning | |
157 | ui.warn(_("couldn't find merge tool %s\n") % tmsg) |
|
156 | ui.warn(_("couldn't find merge tool %s\n") % tmsg) | |
158 | else: # configured but non-existing tools are more silent |
|
157 | else: # configured but non-existing tools are more silent | |
159 | ui.note(_("couldn't find merge tool %s\n") % tmsg) |
|
158 | ui.note(_("couldn't find merge tool %s\n") % tmsg) | |
160 | elif symlink and not hascapability(tool, "symlink", strictcheck): |
|
159 | elif symlink and not hascapability(tool, "symlink", strictcheck): | |
161 | ui.warn(_("tool %s can't handle symlinks\n") % tmsg) |
|
160 | ui.warn(_("tool %s can't handle symlinks\n") % tmsg) | |
162 | elif binary and not hascapability(tool, "binary", strictcheck): |
|
161 | elif binary and not hascapability(tool, "binary", strictcheck): | |
163 | ui.warn(_("tool %s can't handle binary\n") % tmsg) |
|
162 | ui.warn(_("tool %s can't handle binary\n") % tmsg) | |
164 | elif changedelete and not supportscd(tool): |
|
163 | elif changedelete and not supportscd(tool): | |
165 | # the nomerge tools are the only tools that support change/delete |
|
164 | # the nomerge tools are the only tools that support change/delete | |
166 | # conflicts |
|
165 | # conflicts | |
167 | pass |
|
166 | pass | |
168 | elif not procutil.gui() and _toolbool(ui, tool, "gui"): |
|
167 | elif not procutil.gui() and _toolbool(ui, tool, "gui"): | |
169 | ui.warn(_("tool %s requires a GUI\n") % tmsg) |
|
168 | ui.warn(_("tool %s requires a GUI\n") % tmsg) | |
170 | else: |
|
169 | else: | |
171 | return True |
|
170 | return True | |
172 | return False |
|
171 | return False | |
173 |
|
172 | |||
174 | # internal config: ui.forcemerge |
|
173 | # internal config: ui.forcemerge | |
175 | # forcemerge comes from command line arguments, highest priority |
|
174 | # forcemerge comes from command line arguments, highest priority | |
176 | force = ui.config('ui', 'forcemerge') |
|
175 | force = ui.config('ui', 'forcemerge') | |
177 | if force: |
|
176 | if force: | |
178 | toolpath = _findtool(ui, force) |
|
177 | toolpath = _findtool(ui, force) | |
179 | if changedelete and not supportscd(toolpath): |
|
178 | if changedelete and not supportscd(toolpath): | |
180 | return ":prompt", None |
|
179 | return ":prompt", None | |
181 | else: |
|
180 | else: | |
182 | if toolpath: |
|
181 | if toolpath: | |
183 | return (force, _quotetoolpath(toolpath)) |
|
182 | return (force, _quotetoolpath(toolpath)) | |
184 | else: |
|
183 | else: | |
185 | # mimic HGMERGE if given tool not found |
|
184 | # mimic HGMERGE if given tool not found | |
186 | return (force, force) |
|
185 | return (force, force) | |
187 |
|
186 | |||
188 | # HGMERGE takes next precedence |
|
187 | # HGMERGE takes next precedence | |
189 | hgmerge = encoding.environ.get("HGMERGE") |
|
188 | hgmerge = encoding.environ.get("HGMERGE") | |
190 | if hgmerge: |
|
189 | if hgmerge: | |
191 | if changedelete and not supportscd(hgmerge): |
|
190 | if changedelete and not supportscd(hgmerge): | |
192 | return ":prompt", None |
|
191 | return ":prompt", None | |
193 | else: |
|
192 | else: | |
194 | return (hgmerge, hgmerge) |
|
193 | return (hgmerge, hgmerge) | |
195 |
|
194 | |||
196 | # then patterns |
|
195 | # then patterns | |
197 |
|
196 | |||
198 | # whether binary capability should be checked strictly |
|
197 | # whether binary capability should be checked strictly | |
199 | binarycap = binary and strictcheck |
|
198 | binarycap = binary and strictcheck | |
200 |
|
199 | |||
201 | for pat, tool in ui.configitems("merge-patterns"): |
|
200 | for pat, tool in ui.configitems("merge-patterns"): | |
202 | mf = match.match(repo.root, '', [pat]) |
|
201 | mf = match.match(repo.root, '', [pat]) | |
203 | if mf(path) and check(tool, pat, symlink, binarycap, changedelete): |
|
202 | if mf(path) and check(tool, pat, symlink, binarycap, changedelete): | |
204 | if binary and not hascapability(tool, "binary", strict=True): |
|
203 | if binary and not hascapability(tool, "binary", strict=True): | |
205 | ui.warn(_("warning: check merge-patterns configurations," |
|
204 | ui.warn(_("warning: check merge-patterns configurations," | |
206 | " if %r for binary file %r is unintentional\n" |
|
205 | " if %r for binary file %r is unintentional\n" | |
207 | "(see 'hg help merge-tools'" |
|
206 | "(see 'hg help merge-tools'" | |
208 | " for binary files capability)\n") |
|
207 | " for binary files capability)\n") | |
209 | % (pycompat.bytestr(tool), pycompat.bytestr(path))) |
|
208 | % (pycompat.bytestr(tool), pycompat.bytestr(path))) | |
210 | toolpath = _findtool(ui, tool) |
|
209 | toolpath = _findtool(ui, tool) | |
211 | return (tool, _quotetoolpath(toolpath)) |
|
210 | return (tool, _quotetoolpath(toolpath)) | |
212 |
|
211 | |||
213 | # then merge tools |
|
212 | # then merge tools | |
214 | tools = {} |
|
213 | tools = {} | |
215 | disabled = set() |
|
214 | disabled = set() | |
216 | for k, v in ui.configitems("merge-tools"): |
|
215 | for k, v in ui.configitems("merge-tools"): | |
217 | t = k.split('.')[0] |
|
216 | t = k.split('.')[0] | |
218 | if t not in tools: |
|
217 | if t not in tools: | |
219 | tools[t] = int(_toolstr(ui, t, "priority")) |
|
218 | tools[t] = int(_toolstr(ui, t, "priority")) | |
220 | if _toolbool(ui, t, "disabled"): |
|
219 | if _toolbool(ui, t, "disabled"): | |
221 | disabled.add(t) |
|
220 | disabled.add(t) | |
222 | names = tools.keys() |
|
221 | names = tools.keys() | |
223 | tools = sorted([(-p, tool) for tool, p in tools.items() |
|
222 | tools = sorted([(-p, tool) for tool, p in tools.items() | |
224 | if tool not in disabled]) |
|
223 | if tool not in disabled]) | |
225 | uimerge = ui.config("ui", "merge") |
|
224 | uimerge = ui.config("ui", "merge") | |
226 | if uimerge: |
|
225 | if uimerge: | |
227 | # external tools defined in uimerge won't be able to handle |
|
226 | # external tools defined in uimerge won't be able to handle | |
228 | # change/delete conflicts |
|
227 | # change/delete conflicts | |
229 | if check(uimerge, path, symlink, binary, changedelete): |
|
228 | if check(uimerge, path, symlink, binary, changedelete): | |
230 | if uimerge not in names and not changedelete: |
|
229 | if uimerge not in names and not changedelete: | |
231 | return (uimerge, uimerge) |
|
230 | return (uimerge, uimerge) | |
232 | tools.insert(0, (None, uimerge)) # highest priority |
|
231 | tools.insert(0, (None, uimerge)) # highest priority | |
233 | tools.append((None, "hgmerge")) # the old default, if found |
|
232 | tools.append((None, "hgmerge")) # the old default, if found | |
234 | for p, t in tools: |
|
233 | for p, t in tools: | |
235 | if check(t, None, symlink, binary, changedelete): |
|
234 | if check(t, None, symlink, binary, changedelete): | |
236 | toolpath = _findtool(ui, t) |
|
235 | toolpath = _findtool(ui, t) | |
237 | return (t, _quotetoolpath(toolpath)) |
|
236 | return (t, _quotetoolpath(toolpath)) | |
238 |
|
237 | |||
239 | # internal merge or prompt as last resort |
|
238 | # internal merge or prompt as last resort | |
240 | if symlink or binary or changedelete: |
|
239 | if symlink or binary or changedelete: | |
241 | if not changedelete and len(tools): |
|
240 | if not changedelete and len(tools): | |
242 | # any tool is rejected by capability for symlink or binary |
|
241 | # any tool is rejected by capability for symlink or binary | |
243 | ui.warn(_("no tool found to merge %s\n") % path) |
|
242 | ui.warn(_("no tool found to merge %s\n") % path) | |
244 | return ":prompt", None |
|
243 | return ":prompt", None | |
245 | return ":merge", None |
|
244 | return ":merge", None | |
246 |
|
245 | |||
247 | def _eoltype(data): |
|
246 | def _eoltype(data): | |
248 | "Guess the EOL type of a file" |
|
247 | "Guess the EOL type of a file" | |
249 | if '\0' in data: # binary |
|
248 | if '\0' in data: # binary | |
250 | return None |
|
249 | return None | |
251 | if '\r\n' in data: # Windows |
|
250 | if '\r\n' in data: # Windows | |
252 | return '\r\n' |
|
251 | return '\r\n' | |
253 | if '\r' in data: # Old Mac |
|
252 | if '\r' in data: # Old Mac | |
254 | return '\r' |
|
253 | return '\r' | |
255 | if '\n' in data: # UNIX |
|
254 | if '\n' in data: # UNIX | |
256 | return '\n' |
|
255 | return '\n' | |
257 | return None # unknown |
|
256 | return None # unknown | |
258 |
|
257 | |||
259 | def _matcheol(file, back): |
|
258 | def _matcheol(file, back): | |
260 | "Convert EOL markers in a file to match origfile" |
|
259 | "Convert EOL markers in a file to match origfile" | |
261 | tostyle = _eoltype(back.data()) # No repo.wread filters? |
|
260 | tostyle = _eoltype(back.data()) # No repo.wread filters? | |
262 | if tostyle: |
|
261 | if tostyle: | |
263 | data = util.readfile(file) |
|
262 | data = util.readfile(file) | |
264 | style = _eoltype(data) |
|
263 | style = _eoltype(data) | |
265 | if style: |
|
264 | if style: | |
266 | newdata = data.replace(style, tostyle) |
|
265 | newdata = data.replace(style, tostyle) | |
267 | if newdata != data: |
|
266 | if newdata != data: | |
268 | util.writefile(file, newdata) |
|
267 | util.writefile(file, newdata) | |
269 |
|
268 | |||
270 | @internaltool('prompt', nomerge) |
|
269 | @internaltool('prompt', nomerge) | |
271 | def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): |
|
270 | def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | |
272 | """Asks the user which of the local `p1()` or the other `p2()` version to |
|
271 | """Asks the user which of the local `p1()` or the other `p2()` version to | |
273 | keep as the merged version.""" |
|
272 | keep as the merged version.""" | |
274 | ui = repo.ui |
|
273 | ui = repo.ui | |
275 | fd = fcd.path() |
|
274 | fd = fcd.path() | |
276 |
|
275 | |||
277 | # Avoid prompting during an in-memory merge since it doesn't support merge |
|
276 | # Avoid prompting during an in-memory merge since it doesn't support merge | |
278 | # conflicts. |
|
277 | # conflicts. | |
279 | if fcd.changectx().isinmemory(): |
|
278 | if fcd.changectx().isinmemory(): | |
280 | raise error.InMemoryMergeConflictsError('in-memory merge does not ' |
|
279 | raise error.InMemoryMergeConflictsError('in-memory merge does not ' | |
281 | 'support file conflicts') |
|
280 | 'support file conflicts') | |
282 |
|
281 | |||
283 | prompts = partextras(labels) |
|
282 | prompts = partextras(labels) | |
284 | prompts['fd'] = fd |
|
283 | prompts['fd'] = fd | |
285 | try: |
|
284 | try: | |
286 | if fco.isabsent(): |
|
285 | if fco.isabsent(): | |
287 | index = ui.promptchoice( |
|
286 | index = ui.promptchoice( | |
288 | _localchangedotherdeletedmsg % prompts, 2) |
|
287 | _localchangedotherdeletedmsg % prompts, 2) | |
289 | choice = ['local', 'other', 'unresolved'][index] |
|
288 | choice = ['local', 'other', 'unresolved'][index] | |
290 | elif fcd.isabsent(): |
|
289 | elif fcd.isabsent(): | |
291 | index = ui.promptchoice( |
|
290 | index = ui.promptchoice( | |
292 | _otherchangedlocaldeletedmsg % prompts, 2) |
|
291 | _otherchangedlocaldeletedmsg % prompts, 2) | |
293 | choice = ['other', 'local', 'unresolved'][index] |
|
292 | choice = ['other', 'local', 'unresolved'][index] | |
294 | else: |
|
293 | else: | |
295 | index = ui.promptchoice( |
|
294 | index = ui.promptchoice( | |
296 | _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved" |
|
295 | _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved" | |
297 | " for %(fd)s?" |
|
296 | " for %(fd)s?" | |
298 | "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2) |
|
297 | "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2) | |
299 | choice = ['local', 'other', 'unresolved'][index] |
|
298 | choice = ['local', 'other', 'unresolved'][index] | |
300 |
|
299 | |||
301 | if choice == 'other': |
|
300 | if choice == 'other': | |
302 | return _iother(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
301 | return _iother(repo, mynode, orig, fcd, fco, fca, toolconf, | |
303 | labels) |
|
302 | labels) | |
304 | elif choice == 'local': |
|
303 | elif choice == 'local': | |
305 | return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
304 | return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, | |
306 | labels) |
|
305 | labels) | |
307 | elif choice == 'unresolved': |
|
306 | elif choice == 'unresolved': | |
308 | return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
307 | return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, | |
309 | labels) |
|
308 | labels) | |
310 | except error.ResponseExpected: |
|
309 | except error.ResponseExpected: | |
311 | ui.write("\n") |
|
310 | ui.write("\n") | |
312 | return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
311 | return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, | |
313 | labels) |
|
312 | labels) | |
314 |
|
313 | |||
315 | @internaltool('local', nomerge) |
|
314 | @internaltool('local', nomerge) | |
316 | def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): |
|
315 | def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | |
317 | """Uses the local `p1()` version of files as the merged version.""" |
|
316 | """Uses the local `p1()` version of files as the merged version.""" | |
318 | return 0, fcd.isabsent() |
|
317 | return 0, fcd.isabsent() | |
319 |
|
318 | |||
320 | @internaltool('other', nomerge) |
|
319 | @internaltool('other', nomerge) | |
321 | def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): |
|
320 | def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | |
322 | """Uses the other `p2()` version of files as the merged version.""" |
|
321 | """Uses the other `p2()` version of files as the merged version.""" | |
323 | if fco.isabsent(): |
|
322 | if fco.isabsent(): | |
324 | # local changed, remote deleted -- 'deleted' picked |
|
323 | # local changed, remote deleted -- 'deleted' picked | |
325 | _underlyingfctxifabsent(fcd).remove() |
|
324 | _underlyingfctxifabsent(fcd).remove() | |
326 | deleted = True |
|
325 | deleted = True | |
327 | else: |
|
326 | else: | |
328 | _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags()) |
|
327 | _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags()) | |
329 | deleted = False |
|
328 | deleted = False | |
330 | return 0, deleted |
|
329 | return 0, deleted | |
331 |
|
330 | |||
332 | @internaltool('fail', nomerge) |
|
331 | @internaltool('fail', nomerge) | |
333 | def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): |
|
332 | def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None): | |
334 | """ |
|
333 | """ | |
335 | Rather than attempting to merge files that were modified on both |
|
334 | Rather than attempting to merge files that were modified on both | |
336 | branches, it marks them as unresolved. The resolve command must be |
|
335 | branches, it marks them as unresolved. The resolve command must be | |
337 | used to resolve these conflicts.""" |
|
336 | used to resolve these conflicts.""" | |
338 | # for change/delete conflicts write out the changed version, then fail |
|
337 | # for change/delete conflicts write out the changed version, then fail | |
339 | if fcd.isabsent(): |
|
338 | if fcd.isabsent(): | |
340 | _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags()) |
|
339 | _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags()) | |
341 | return 1, False |
|
340 | return 1, False | |
342 |
|
341 | |||
343 | def _underlyingfctxifabsent(filectx): |
|
342 | def _underlyingfctxifabsent(filectx): | |
344 | """Sometimes when resolving, our fcd is actually an absentfilectx, but |
|
343 | """Sometimes when resolving, our fcd is actually an absentfilectx, but | |
345 | we want to write to it (to do the resolve). This helper returns the |
|
344 | we want to write to it (to do the resolve). This helper returns the | |
346 | underyling workingfilectx in that case. |
|
345 | underyling workingfilectx in that case. | |
347 | """ |
|
346 | """ | |
348 | if filectx.isabsent(): |
|
347 | if filectx.isabsent(): | |
349 | return filectx.changectx()[filectx.path()] |
|
348 | return filectx.changectx()[filectx.path()] | |
350 | else: |
|
349 | else: | |
351 | return filectx |
|
350 | return filectx | |
352 |
|
351 | |||
353 | def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None): |
|
352 | def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None): | |
354 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
353 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
355 | if symlink or fcd.isabsent() or fco.isabsent(): |
|
354 | if symlink or fcd.isabsent() or fco.isabsent(): | |
356 | return 1 |
|
355 | return 1 | |
357 | unused, unused, unused, back = files |
|
356 | unused, unused, unused, back = files | |
358 |
|
357 | |||
359 | ui = repo.ui |
|
358 | ui = repo.ui | |
360 |
|
359 | |||
361 | validkeep = ['keep', 'keep-merge3'] |
|
360 | validkeep = ['keep', 'keep-merge3'] | |
362 |
|
361 | |||
363 | # do we attempt to simplemerge first? |
|
362 | # do we attempt to simplemerge first? | |
364 | try: |
|
363 | try: | |
365 | premerge = _toolbool(ui, tool, "premerge", not binary) |
|
364 | premerge = _toolbool(ui, tool, "premerge", not binary) | |
366 | except error.ConfigError: |
|
365 | except error.ConfigError: | |
367 | premerge = _toolstr(ui, tool, "premerge", "").lower() |
|
366 | premerge = _toolstr(ui, tool, "premerge", "").lower() | |
368 | if premerge not in validkeep: |
|
367 | if premerge not in validkeep: | |
369 | _valid = ', '.join(["'" + v + "'" for v in validkeep]) |
|
368 | _valid = ', '.join(["'" + v + "'" for v in validkeep]) | |
370 | raise error.ConfigError(_("%s.premerge not valid " |
|
369 | raise error.ConfigError(_("%s.premerge not valid " | |
371 | "('%s' is neither boolean nor %s)") % |
|
370 | "('%s' is neither boolean nor %s)") % | |
372 | (tool, premerge, _valid)) |
|
371 | (tool, premerge, _valid)) | |
373 |
|
372 | |||
374 | if premerge: |
|
373 | if premerge: | |
375 | if premerge == 'keep-merge3': |
|
374 | if premerge == 'keep-merge3': | |
376 | if not labels: |
|
375 | if not labels: | |
377 | labels = _defaultconflictlabels |
|
376 | labels = _defaultconflictlabels | |
378 | if len(labels) < 3: |
|
377 | if len(labels) < 3: | |
379 | labels.append('base') |
|
378 | labels.append('base') | |
380 | r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels) |
|
379 | r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels) | |
381 | if not r: |
|
380 | if not r: | |
382 | ui.debug(" premerge successful\n") |
|
381 | ui.debug(" premerge successful\n") | |
383 | return 0 |
|
382 | return 0 | |
384 | if premerge not in validkeep: |
|
383 | if premerge not in validkeep: | |
385 | # restore from backup and try again |
|
384 | # restore from backup and try again | |
386 | _restorebackup(fcd, back) |
|
385 | _restorebackup(fcd, back) | |
387 | return 1 # continue merging |
|
386 | return 1 # continue merging | |
388 |
|
387 | |||
389 | def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf): |
|
388 | def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf): | |
390 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
389 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
391 | if symlink: |
|
390 | if symlink: | |
392 | repo.ui.warn(_('warning: internal %s cannot merge symlinks ' |
|
391 | repo.ui.warn(_('warning: internal %s cannot merge symlinks ' | |
393 | 'for %s\n') % (tool, fcd.path())) |
|
392 | 'for %s\n') % (tool, fcd.path())) | |
394 | return False |
|
393 | return False | |
395 | if fcd.isabsent() or fco.isabsent(): |
|
394 | if fcd.isabsent() or fco.isabsent(): | |
396 | repo.ui.warn(_('warning: internal %s cannot merge change/delete ' |
|
395 | repo.ui.warn(_('warning: internal %s cannot merge change/delete ' | |
397 | 'conflict for %s\n') % (tool, fcd.path())) |
|
396 | 'conflict for %s\n') % (tool, fcd.path())) | |
398 | return False |
|
397 | return False | |
399 | return True |
|
398 | return True | |
400 |
|
399 | |||
401 | def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode): |
|
400 | def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode): | |
402 | """ |
|
401 | """ | |
403 | Uses the internal non-interactive simple merge algorithm for merging |
|
402 | Uses the internal non-interactive simple merge algorithm for merging | |
404 | files. It will fail if there are any conflicts and leave markers in |
|
403 | files. It will fail if there are any conflicts and leave markers in | |
405 | the partially merged file. Markers will have two sections, one for each side |
|
404 | the partially merged file. Markers will have two sections, one for each side | |
406 | of merge, unless mode equals 'union' which suppresses the markers.""" |
|
405 | of merge, unless mode equals 'union' which suppresses the markers.""" | |
407 | ui = repo.ui |
|
406 | ui = repo.ui | |
408 |
|
407 | |||
409 | r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode) |
|
408 | r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode) | |
410 | return True, r, False |
|
409 | return True, r, False | |
411 |
|
410 | |||
412 | @internaltool('union', fullmerge, |
|
411 | @internaltool('union', fullmerge, | |
413 | _("warning: conflicts while merging %s! " |
|
412 | _("warning: conflicts while merging %s! " | |
414 | "(edit, then use 'hg resolve --mark')\n"), |
|
413 | "(edit, then use 'hg resolve --mark')\n"), | |
415 | precheck=_mergecheck) |
|
414 | precheck=_mergecheck) | |
416 | def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
415 | def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
417 | """ |
|
416 | """ | |
418 | Uses the internal non-interactive simple merge algorithm for merging |
|
417 | Uses the internal non-interactive simple merge algorithm for merging | |
419 | files. It will use both left and right sides for conflict regions. |
|
418 | files. It will use both left and right sides for conflict regions. | |
420 | No markers are inserted.""" |
|
419 | No markers are inserted.""" | |
421 | return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
420 | return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, | |
422 | files, labels, 'union') |
|
421 | files, labels, 'union') | |
423 |
|
422 | |||
424 | @internaltool('merge', fullmerge, |
|
423 | @internaltool('merge', fullmerge, | |
425 | _("warning: conflicts while merging %s! " |
|
424 | _("warning: conflicts while merging %s! " | |
426 | "(edit, then use 'hg resolve --mark')\n"), |
|
425 | "(edit, then use 'hg resolve --mark')\n"), | |
427 | precheck=_mergecheck) |
|
426 | precheck=_mergecheck) | |
428 | def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
427 | def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
429 | """ |
|
428 | """ | |
430 | Uses the internal non-interactive simple merge algorithm for merging |
|
429 | Uses the internal non-interactive simple merge algorithm for merging | |
431 | files. It will fail if there are any conflicts and leave markers in |
|
430 | files. It will fail if there are any conflicts and leave markers in | |
432 | the partially merged file. Markers will have two sections, one for each side |
|
431 | the partially merged file. Markers will have two sections, one for each side | |
433 | of merge.""" |
|
432 | of merge.""" | |
434 | return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, |
|
433 | return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, | |
435 | files, labels, 'merge') |
|
434 | files, labels, 'merge') | |
436 |
|
435 | |||
437 | @internaltool('merge3', fullmerge, |
|
436 | @internaltool('merge3', fullmerge, | |
438 | _("warning: conflicts while merging %s! " |
|
437 | _("warning: conflicts while merging %s! " | |
439 | "(edit, then use 'hg resolve --mark')\n"), |
|
438 | "(edit, then use 'hg resolve --mark')\n"), | |
440 | precheck=_mergecheck) |
|
439 | precheck=_mergecheck) | |
441 | def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
440 | def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
442 | """ |
|
441 | """ | |
443 | Uses the internal non-interactive simple merge algorithm for merging |
|
442 | Uses the internal non-interactive simple merge algorithm for merging | |
444 | files. It will fail if there are any conflicts and leave markers in |
|
443 | files. It will fail if there are any conflicts and leave markers in | |
445 | the partially merged file. Marker will have three sections, one from each |
|
444 | the partially merged file. Marker will have three sections, one from each | |
446 | side of the merge and one for the base content.""" |
|
445 | side of the merge and one for the base content.""" | |
447 | if not labels: |
|
446 | if not labels: | |
448 | labels = _defaultconflictlabels |
|
447 | labels = _defaultconflictlabels | |
449 | if len(labels) < 3: |
|
448 | if len(labels) < 3: | |
450 | labels.append('base') |
|
449 | labels.append('base') | |
451 | return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels) |
|
450 | return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels) | |
452 |
|
451 | |||
453 | def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files, |
|
452 | def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files, | |
454 | labels=None, localorother=None): |
|
453 | labels=None, localorother=None): | |
455 | """ |
|
454 | """ | |
456 | Generic driver for _imergelocal and _imergeother |
|
455 | Generic driver for _imergelocal and _imergeother | |
457 | """ |
|
456 | """ | |
458 | assert localorother is not None |
|
457 | assert localorother is not None | |
459 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
458 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
460 | r = simplemerge.simplemerge(repo.ui, fcd, fca, fco, label=labels, |
|
459 | r = simplemerge.simplemerge(repo.ui, fcd, fca, fco, label=labels, | |
461 | localorother=localorother) |
|
460 | localorother=localorother) | |
462 | return True, r |
|
461 | return True, r | |
463 |
|
462 | |||
464 | @internaltool('merge-local', mergeonly, precheck=_mergecheck) |
|
463 | @internaltool('merge-local', mergeonly, precheck=_mergecheck) | |
465 | def _imergelocal(*args, **kwargs): |
|
464 | def _imergelocal(*args, **kwargs): | |
466 | """ |
|
465 | """ | |
467 | Like :merge, but resolve all conflicts non-interactively in favor |
|
466 | Like :merge, but resolve all conflicts non-interactively in favor | |
468 | of the local `p1()` changes.""" |
|
467 | of the local `p1()` changes.""" | |
469 | success, status = _imergeauto(localorother='local', *args, **kwargs) |
|
468 | success, status = _imergeauto(localorother='local', *args, **kwargs) | |
470 | return success, status, False |
|
469 | return success, status, False | |
471 |
|
470 | |||
472 | @internaltool('merge-other', mergeonly, precheck=_mergecheck) |
|
471 | @internaltool('merge-other', mergeonly, precheck=_mergecheck) | |
473 | def _imergeother(*args, **kwargs): |
|
472 | def _imergeother(*args, **kwargs): | |
474 | """ |
|
473 | """ | |
475 | Like :merge, but resolve all conflicts non-interactively in favor |
|
474 | Like :merge, but resolve all conflicts non-interactively in favor | |
476 | of the other `p2()` changes.""" |
|
475 | of the other `p2()` changes.""" | |
477 | success, status = _imergeauto(localorother='other', *args, **kwargs) |
|
476 | success, status = _imergeauto(localorother='other', *args, **kwargs) | |
478 | return success, status, False |
|
477 | return success, status, False | |
479 |
|
478 | |||
480 | @internaltool('tagmerge', mergeonly, |
|
479 | @internaltool('tagmerge', mergeonly, | |
481 | _("automatic tag merging of %s failed! " |
|
480 | _("automatic tag merging of %s failed! " | |
482 | "(use 'hg resolve --tool :merge' or another merge " |
|
481 | "(use 'hg resolve --tool :merge' or another merge " | |
483 | "tool of your choice)\n")) |
|
482 | "tool of your choice)\n")) | |
484 | def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
483 | def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
485 | """ |
|
484 | """ | |
486 | Uses the internal tag merge algorithm (experimental). |
|
485 | Uses the internal tag merge algorithm (experimental). | |
487 | """ |
|
486 | """ | |
488 | success, status = tagmerge.merge(repo, fcd, fco, fca) |
|
487 | success, status = tagmerge.merge(repo, fcd, fco, fca) | |
489 | return success, status, False |
|
488 | return success, status, False | |
490 |
|
489 | |||
491 | @internaltool('dump', fullmerge, binary=True, symlink=True) |
|
490 | @internaltool('dump', fullmerge, binary=True, symlink=True) | |
492 | def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
491 | def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
493 | """ |
|
492 | """ | |
494 | Creates three versions of the files to merge, containing the |
|
493 | Creates three versions of the files to merge, containing the | |
495 | contents of local, other and base. These files can then be used to |
|
494 | contents of local, other and base. These files can then be used to | |
496 | perform a merge manually. If the file to be merged is named |
|
495 | perform a merge manually. If the file to be merged is named | |
497 | ``a.txt``, these files will accordingly be named ``a.txt.local``, |
|
496 | ``a.txt``, these files will accordingly be named ``a.txt.local``, | |
498 | ``a.txt.other`` and ``a.txt.base`` and they will be placed in the |
|
497 | ``a.txt.other`` and ``a.txt.base`` and they will be placed in the | |
499 | same directory as ``a.txt``. |
|
498 | same directory as ``a.txt``. | |
500 |
|
499 | |||
501 | This implies premerge. Therefore, files aren't dumped, if premerge |
|
500 | This implies premerge. Therefore, files aren't dumped, if premerge | |
502 | runs successfully. Use :forcedump to forcibly write files out. |
|
501 | runs successfully. Use :forcedump to forcibly write files out. | |
503 | """ |
|
502 | """ | |
504 | a = _workingpath(repo, fcd) |
|
503 | a = _workingpath(repo, fcd) | |
505 | fd = fcd.path() |
|
504 | fd = fcd.path() | |
506 |
|
505 | |||
507 | from . import context |
|
506 | from . import context | |
508 | if isinstance(fcd, context.overlayworkingfilectx): |
|
507 | if isinstance(fcd, context.overlayworkingfilectx): | |
509 | raise error.InMemoryMergeConflictsError('in-memory merge does not ' |
|
508 | raise error.InMemoryMergeConflictsError('in-memory merge does not ' | |
510 | 'support the :dump tool.') |
|
509 | 'support the :dump tool.') | |
511 |
|
510 | |||
512 | util.writefile(a + ".local", fcd.decodeddata()) |
|
511 | util.writefile(a + ".local", fcd.decodeddata()) | |
513 | repo.wwrite(fd + ".other", fco.data(), fco.flags()) |
|
512 | repo.wwrite(fd + ".other", fco.data(), fco.flags()) | |
514 | repo.wwrite(fd + ".base", fca.data(), fca.flags()) |
|
513 | repo.wwrite(fd + ".base", fca.data(), fca.flags()) | |
515 | return False, 1, False |
|
514 | return False, 1, False | |
516 |
|
515 | |||
517 | @internaltool('forcedump', mergeonly, binary=True, symlink=True) |
|
516 | @internaltool('forcedump', mergeonly, binary=True, symlink=True) | |
518 | def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, |
|
517 | def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, | |
519 | labels=None): |
|
518 | labels=None): | |
520 | """ |
|
519 | """ | |
521 | Creates three versions of the files as same as :dump, but omits premerge. |
|
520 | Creates three versions of the files as same as :dump, but omits premerge. | |
522 | """ |
|
521 | """ | |
523 | return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, |
|
522 | return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, | |
524 | labels=labels) |
|
523 | labels=labels) | |
525 |
|
524 | |||
526 | def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
525 | def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
527 | # In-memory merge simply raises an exception on all external merge tools, |
|
526 | # In-memory merge simply raises an exception on all external merge tools, | |
528 | # for now. |
|
527 | # for now. | |
529 | # |
|
528 | # | |
530 | # It would be possible to run most tools with temporary files, but this |
|
529 | # It would be possible to run most tools with temporary files, but this | |
531 | # raises the question of what to do if the user only partially resolves the |
|
530 | # raises the question of what to do if the user only partially resolves the | |
532 | # file -- we can't leave a merge state. (Copy to somewhere in the .hg/ |
|
531 | # file -- we can't leave a merge state. (Copy to somewhere in the .hg/ | |
533 | # directory and tell the user how to get it is my best idea, but it's |
|
532 | # directory and tell the user how to get it is my best idea, but it's | |
534 | # clunky.) |
|
533 | # clunky.) | |
535 | raise error.InMemoryMergeConflictsError('in-memory merge does not support ' |
|
534 | raise error.InMemoryMergeConflictsError('in-memory merge does not support ' | |
536 | 'external merge tools') |
|
535 | 'external merge tools') | |
537 |
|
536 | |||
538 | def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
|
537 | def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): | |
539 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
538 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
540 | if fcd.isabsent() or fco.isabsent(): |
|
539 | if fcd.isabsent() or fco.isabsent(): | |
541 | repo.ui.warn(_('warning: %s cannot merge change/delete conflict ' |
|
540 | repo.ui.warn(_('warning: %s cannot merge change/delete conflict ' | |
542 | 'for %s\n') % (tool, fcd.path())) |
|
541 | 'for %s\n') % (tool, fcd.path())) | |
543 | return False, 1, None |
|
542 | return False, 1, None | |
544 | unused, unused, unused, back = files |
|
543 | unused, unused, unused, back = files | |
545 | localpath = _workingpath(repo, fcd) |
|
544 | localpath = _workingpath(repo, fcd) | |
546 | args = _toolstr(repo.ui, tool, "args") |
|
545 | args = _toolstr(repo.ui, tool, "args") | |
547 |
|
546 | |||
548 | with _maketempfiles(repo, fco, fca, repo.wvfs.join(back.path()), |
|
547 | with _maketempfiles(repo, fco, fca, repo.wvfs.join(back.path()), | |
549 | "$output" in args) as temppaths: |
|
548 | "$output" in args) as temppaths: | |
550 | basepath, otherpath, localoutputpath = temppaths |
|
549 | basepath, otherpath, localoutputpath = temppaths | |
551 | outpath = "" |
|
550 | outpath = "" | |
552 | mylabel, otherlabel = labels[:2] |
|
551 | mylabel, otherlabel = labels[:2] | |
553 | if len(labels) >= 3: |
|
552 | if len(labels) >= 3: | |
554 | baselabel = labels[2] |
|
553 | baselabel = labels[2] | |
555 | else: |
|
554 | else: | |
556 | baselabel = 'base' |
|
555 | baselabel = 'base' | |
557 | env = {'HG_FILE': fcd.path(), |
|
556 | env = {'HG_FILE': fcd.path(), | |
558 | 'HG_MY_NODE': short(mynode), |
|
557 | 'HG_MY_NODE': short(mynode), | |
559 | 'HG_OTHER_NODE': short(fco.changectx().node()), |
|
558 | 'HG_OTHER_NODE': short(fco.changectx().node()), | |
560 | 'HG_BASE_NODE': short(fca.changectx().node()), |
|
559 | 'HG_BASE_NODE': short(fca.changectx().node()), | |
561 | 'HG_MY_ISLINK': 'l' in fcd.flags(), |
|
560 | 'HG_MY_ISLINK': 'l' in fcd.flags(), | |
562 | 'HG_OTHER_ISLINK': 'l' in fco.flags(), |
|
561 | 'HG_OTHER_ISLINK': 'l' in fco.flags(), | |
563 | 'HG_BASE_ISLINK': 'l' in fca.flags(), |
|
562 | 'HG_BASE_ISLINK': 'l' in fca.flags(), | |
564 | 'HG_MY_LABEL': mylabel, |
|
563 | 'HG_MY_LABEL': mylabel, | |
565 | 'HG_OTHER_LABEL': otherlabel, |
|
564 | 'HG_OTHER_LABEL': otherlabel, | |
566 | 'HG_BASE_LABEL': baselabel, |
|
565 | 'HG_BASE_LABEL': baselabel, | |
567 | } |
|
566 | } | |
568 | ui = repo.ui |
|
567 | ui = repo.ui | |
569 |
|
568 | |||
570 | if "$output" in args: |
|
569 | if "$output" in args: | |
571 | # read input from backup, write to original |
|
570 | # read input from backup, write to original | |
572 | outpath = localpath |
|
571 | outpath = localpath | |
573 | localpath = localoutputpath |
|
572 | localpath = localoutputpath | |
574 | replace = {'local': localpath, 'base': basepath, 'other': otherpath, |
|
573 | replace = {'local': localpath, 'base': basepath, 'other': otherpath, | |
575 | 'output': outpath, 'labellocal': mylabel, |
|
574 | 'output': outpath, 'labellocal': mylabel, | |
576 | 'labelother': otherlabel, 'labelbase': baselabel} |
|
575 | 'labelother': otherlabel, 'labelbase': baselabel} | |
577 | args = util.interpolate( |
|
576 | args = util.interpolate( | |
578 | br'\$', replace, args, |
|
577 | br'\$', replace, args, | |
579 | lambda s: procutil.shellquote(util.localpath(s))) |
|
578 | lambda s: procutil.shellquote(util.localpath(s))) | |
580 | if _toolbool(ui, tool, "gui"): |
|
579 | if _toolbool(ui, tool, "gui"): | |
581 | repo.ui.status(_('running merge tool %s for file %s\n') % |
|
580 | repo.ui.status(_('running merge tool %s for file %s\n') % | |
582 | (tool, fcd.path())) |
|
581 | (tool, fcd.path())) | |
583 | if scriptfn is None: |
|
582 | if scriptfn is None: | |
584 | cmd = toolpath + ' ' + args |
|
583 | cmd = toolpath + ' ' + args | |
585 | repo.ui.debug('launching merge tool: %s\n' % cmd) |
|
584 | repo.ui.debug('launching merge tool: %s\n' % cmd) | |
586 | r = ui.system(cmd, cwd=repo.root, environ=env, |
|
585 | r = ui.system(cmd, cwd=repo.root, environ=env, | |
587 | blockedtag='mergetool') |
|
586 | blockedtag='mergetool') | |
588 | else: |
|
587 | else: | |
589 | repo.ui.debug('launching python merge script: %s:%s\n' % |
|
588 | repo.ui.debug('launching python merge script: %s:%s\n' % | |
590 | (toolpath, scriptfn)) |
|
589 | (toolpath, scriptfn)) | |
591 | r = 0 |
|
590 | r = 0 | |
592 | try: |
|
591 | try: | |
593 | # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil |
|
592 | # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil | |
594 | from . import extensions |
|
593 | from . import extensions | |
595 | mod = extensions.loadpath(toolpath, 'hgmerge.%s' % tool) |
|
594 | mod = extensions.loadpath(toolpath, 'hgmerge.%s' % tool) | |
596 | except Exception: |
|
595 | except Exception: | |
597 | raise error.Abort(_("loading python merge script failed: %s") % |
|
596 | raise error.Abort(_("loading python merge script failed: %s") % | |
598 | toolpath) |
|
597 | toolpath) | |
599 | mergefn = getattr(mod, scriptfn, None) |
|
598 | mergefn = getattr(mod, scriptfn, None) | |
600 | if mergefn is None: |
|
599 | if mergefn is None: | |
601 | raise error.Abort(_("%s does not have function: %s") % |
|
600 | raise error.Abort(_("%s does not have function: %s") % | |
602 | (toolpath, scriptfn)) |
|
601 | (toolpath, scriptfn)) | |
603 | argslist = procutil.shellsplit(args) |
|
602 | argslist = procutil.shellsplit(args) | |
604 | # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil |
|
603 | # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil | |
605 | from . import hook |
|
604 | from . import hook | |
606 | ret, raised = hook.pythonhook(ui, repo, "merge", toolpath, |
|
605 | ret, raised = hook.pythonhook(ui, repo, "merge", toolpath, | |
607 | mergefn, {'args': argslist}, True) |
|
606 | mergefn, {'args': argslist}, True) | |
608 | if raised: |
|
607 | if raised: | |
609 | r = 1 |
|
608 | r = 1 | |
610 | repo.ui.debug('merge tool returned: %d\n' % r) |
|
609 | repo.ui.debug('merge tool returned: %d\n' % r) | |
611 | return True, r, False |
|
610 | return True, r, False | |
612 |
|
611 | |||
613 | def _formatconflictmarker(ctx, template, label, pad): |
|
612 | def _formatconflictmarker(ctx, template, label, pad): | |
614 | """Applies the given template to the ctx, prefixed by the label. |
|
613 | """Applies the given template to the ctx, prefixed by the label. | |
615 |
|
614 | |||
616 | Pad is the minimum width of the label prefix, so that multiple markers |
|
615 | Pad is the minimum width of the label prefix, so that multiple markers | |
617 | can have aligned templated parts. |
|
616 | can have aligned templated parts. | |
618 | """ |
|
617 | """ | |
619 | if ctx.node() is None: |
|
618 | if ctx.node() is None: | |
620 | ctx = ctx.p1() |
|
619 | ctx = ctx.p1() | |
621 |
|
620 | |||
622 | props = {'ctx': ctx} |
|
621 | props = {'ctx': ctx} | |
623 | templateresult = template.renderdefault(props) |
|
622 | templateresult = template.renderdefault(props) | |
624 |
|
623 | |||
625 | label = ('%s:' % label).ljust(pad + 1) |
|
624 | label = ('%s:' % label).ljust(pad + 1) | |
626 | mark = '%s %s' % (label, templateresult) |
|
625 | mark = '%s %s' % (label, templateresult) | |
627 |
|
626 | |||
628 | if mark: |
|
627 | if mark: | |
629 | mark = mark.splitlines()[0] # split for safety |
|
628 | mark = mark.splitlines()[0] # split for safety | |
630 |
|
629 | |||
631 | # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ') |
|
630 | # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ') | |
632 | return stringutil.ellipsis(mark, 80 - 8) |
|
631 | return stringutil.ellipsis(mark, 80 - 8) | |
633 |
|
632 | |||
634 | _defaultconflictlabels = ['local', 'other'] |
|
633 | _defaultconflictlabels = ['local', 'other'] | |
635 |
|
634 | |||
636 | def _formatlabels(repo, fcd, fco, fca, labels, tool=None): |
|
635 | def _formatlabels(repo, fcd, fco, fca, labels, tool=None): | |
637 | """Formats the given labels using the conflict marker template. |
|
636 | """Formats the given labels using the conflict marker template. | |
638 |
|
637 | |||
639 | Returns a list of formatted labels. |
|
638 | Returns a list of formatted labels. | |
640 | """ |
|
639 | """ | |
641 | cd = fcd.changectx() |
|
640 | cd = fcd.changectx() | |
642 | co = fco.changectx() |
|
641 | co = fco.changectx() | |
643 | ca = fca.changectx() |
|
642 | ca = fca.changectx() | |
644 |
|
643 | |||
645 | ui = repo.ui |
|
644 | ui = repo.ui | |
646 | template = ui.config('ui', 'mergemarkertemplate') |
|
645 | template = ui.config('ui', 'mergemarkertemplate') | |
647 | if tool is not None: |
|
646 | if tool is not None: | |
648 | template = _toolstr(ui, tool, 'mergemarkertemplate', template) |
|
647 | template = _toolstr(ui, tool, 'mergemarkertemplate', template) | |
649 | template = templater.unquotestring(template) |
|
648 | template = templater.unquotestring(template) | |
650 | tres = formatter.templateresources(ui, repo) |
|
649 | tres = formatter.templateresources(ui, repo) | |
651 | tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords, |
|
650 | tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords, | |
652 | resources=tres) |
|
651 | resources=tres) | |
653 |
|
652 | |||
654 | pad = max(len(l) for l in labels) |
|
653 | pad = max(len(l) for l in labels) | |
655 |
|
654 | |||
656 | newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad), |
|
655 | newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad), | |
657 | _formatconflictmarker(co, tmpl, labels[1], pad)] |
|
656 | _formatconflictmarker(co, tmpl, labels[1], pad)] | |
658 | if len(labels) > 2: |
|
657 | if len(labels) > 2: | |
659 | newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad)) |
|
658 | newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad)) | |
660 | return newlabels |
|
659 | return newlabels | |
661 |
|
660 | |||
662 | def partextras(labels): |
|
661 | def partextras(labels): | |
663 | """Return a dictionary of extra labels for use in prompts to the user |
|
662 | """Return a dictionary of extra labels for use in prompts to the user | |
664 |
|
663 | |||
665 | Intended use is in strings of the form "(l)ocal%(l)s". |
|
664 | Intended use is in strings of the form "(l)ocal%(l)s". | |
666 | """ |
|
665 | """ | |
667 | if labels is None: |
|
666 | if labels is None: | |
668 | return { |
|
667 | return { | |
669 | "l": "", |
|
668 | "l": "", | |
670 | "o": "", |
|
669 | "o": "", | |
671 | } |
|
670 | } | |
672 |
|
671 | |||
673 | return { |
|
672 | return { | |
674 | "l": " [%s]" % labels[0], |
|
673 | "l": " [%s]" % labels[0], | |
675 | "o": " [%s]" % labels[1], |
|
674 | "o": " [%s]" % labels[1], | |
676 | } |
|
675 | } | |
677 |
|
676 | |||
678 | def _restorebackup(fcd, back): |
|
677 | def _restorebackup(fcd, back): | |
679 | # TODO: Add a workingfilectx.write(otherfilectx) path so we can use |
|
678 | # TODO: Add a workingfilectx.write(otherfilectx) path so we can use | |
680 | # util.copy here instead. |
|
679 | # util.copy here instead. | |
681 | fcd.write(back.data(), fcd.flags()) |
|
680 | fcd.write(back.data(), fcd.flags()) | |
682 |
|
681 | |||
683 | def _makebackup(repo, ui, wctx, fcd, premerge): |
|
682 | def _makebackup(repo, ui, wctx, fcd, premerge): | |
684 | """Makes and returns a filectx-like object for ``fcd``'s backup file. |
|
683 | """Makes and returns a filectx-like object for ``fcd``'s backup file. | |
685 |
|
684 | |||
686 | In addition to preserving the user's pre-existing modifications to `fcd` |
|
685 | In addition to preserving the user's pre-existing modifications to `fcd` | |
687 | (if any), the backup is used to undo certain premerges, confirm whether a |
|
686 | (if any), the backup is used to undo certain premerges, confirm whether a | |
688 | merge changed anything, and determine what line endings the new file should |
|
687 | merge changed anything, and determine what line endings the new file should | |
689 | have. |
|
688 | have. | |
690 |
|
689 | |||
691 | Backups only need to be written once (right before the premerge) since their |
|
690 | Backups only need to be written once (right before the premerge) since their | |
692 | content doesn't change afterwards. |
|
691 | content doesn't change afterwards. | |
693 | """ |
|
692 | """ | |
694 | if fcd.isabsent(): |
|
693 | if fcd.isabsent(): | |
695 | return None |
|
694 | return None | |
696 | # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset -> |
|
695 | # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset -> | |
697 | # merge -> filemerge). (I suspect the fileset import is the weakest link) |
|
696 | # merge -> filemerge). (I suspect the fileset import is the weakest link) | |
698 | from . import context |
|
697 | from . import context | |
699 | a = _workingpath(repo, fcd) |
|
698 | a = _workingpath(repo, fcd) | |
700 | back = scmutil.origpath(ui, repo, a) |
|
699 | back = scmutil.origpath(ui, repo, a) | |
701 | inworkingdir = (back.startswith(repo.wvfs.base) and not |
|
700 | inworkingdir = (back.startswith(repo.wvfs.base) and not | |
702 | back.startswith(repo.vfs.base)) |
|
701 | back.startswith(repo.vfs.base)) | |
703 | if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir: |
|
702 | if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir: | |
704 | # If the backup file is to be in the working directory, and we're |
|
703 | # If the backup file is to be in the working directory, and we're | |
705 | # merging in-memory, we must redirect the backup to the memory context |
|
704 | # merging in-memory, we must redirect the backup to the memory context | |
706 | # so we don't disturb the working directory. |
|
705 | # so we don't disturb the working directory. | |
707 | relpath = back[len(repo.wvfs.base) + 1:] |
|
706 | relpath = back[len(repo.wvfs.base) + 1:] | |
708 | if premerge: |
|
707 | if premerge: | |
709 | wctx[relpath].write(fcd.data(), fcd.flags()) |
|
708 | wctx[relpath].write(fcd.data(), fcd.flags()) | |
710 | return wctx[relpath] |
|
709 | return wctx[relpath] | |
711 | else: |
|
710 | else: | |
712 | if premerge: |
|
711 | if premerge: | |
713 | # Otherwise, write to wherever path the user specified the backups |
|
712 | # Otherwise, write to wherever path the user specified the backups | |
714 | # should go. We still need to switch based on whether the source is |
|
713 | # should go. We still need to switch based on whether the source is | |
715 | # in-memory so we can use the fast path of ``util.copy`` if both are |
|
714 | # in-memory so we can use the fast path of ``util.copy`` if both are | |
716 | # on disk. |
|
715 | # on disk. | |
717 | if isinstance(fcd, context.overlayworkingfilectx): |
|
716 | if isinstance(fcd, context.overlayworkingfilectx): | |
718 | util.writefile(back, fcd.data()) |
|
717 | util.writefile(back, fcd.data()) | |
719 | else: |
|
718 | else: | |
720 | util.copyfile(a, back) |
|
719 | util.copyfile(a, back) | |
721 | # A arbitraryfilectx is returned, so we can run the same functions on |
|
720 | # A arbitraryfilectx is returned, so we can run the same functions on | |
722 | # the backup context regardless of where it lives. |
|
721 | # the backup context regardless of where it lives. | |
723 | return context.arbitraryfilectx(back, repo=repo) |
|
722 | return context.arbitraryfilectx(back, repo=repo) | |
724 |
|
723 | |||
725 | @contextlib.contextmanager |
|
724 | @contextlib.contextmanager | |
726 | def _maketempfiles(repo, fco, fca, localpath, uselocalpath): |
|
725 | def _maketempfiles(repo, fco, fca, localpath, uselocalpath): | |
727 | """Writes out `fco` and `fca` as temporary files, and (if uselocalpath) |
|
726 | """Writes out `fco` and `fca` as temporary files, and (if uselocalpath) | |
728 | copies `localpath` to another temporary file, so an external merge tool may |
|
727 | copies `localpath` to another temporary file, so an external merge tool may | |
729 | use them. |
|
728 | use them. | |
730 | """ |
|
729 | """ | |
731 | tmproot = None |
|
730 | tmproot = None | |
732 | tmprootprefix = repo.ui.config('experimental', 'mergetempdirprefix') |
|
731 | tmprootprefix = repo.ui.config('experimental', 'mergetempdirprefix') | |
733 | if tmprootprefix: |
|
732 | if tmprootprefix: | |
734 | tmproot = pycompat.mkdtemp(prefix=tmprootprefix) |
|
733 | tmproot = pycompat.mkdtemp(prefix=tmprootprefix) | |
735 |
|
734 | |||
736 | def maketempfrompath(prefix, path): |
|
735 | def maketempfrompath(prefix, path): | |
737 | fullbase, ext = os.path.splitext(path) |
|
736 | fullbase, ext = os.path.splitext(path) | |
738 | pre = "%s~%s" % (os.path.basename(fullbase), prefix) |
|
737 | pre = "%s~%s" % (os.path.basename(fullbase), prefix) | |
739 | if tmproot: |
|
738 | if tmproot: | |
740 | name = os.path.join(tmproot, pre) |
|
739 | name = os.path.join(tmproot, pre) | |
741 | if ext: |
|
740 | if ext: | |
742 | name += ext |
|
741 | name += ext | |
743 | f = open(name, r"wb") |
|
742 | f = open(name, r"wb") | |
744 | else: |
|
743 | else: | |
745 | fd, name = pycompat.mkstemp(prefix=pre + '.', suffix=ext) |
|
744 | fd, name = pycompat.mkstemp(prefix=pre + '.', suffix=ext) | |
746 | f = os.fdopen(fd, r"wb") |
|
745 | f = os.fdopen(fd, r"wb") | |
747 | return f, name |
|
746 | return f, name | |
748 |
|
747 | |||
749 | def tempfromcontext(prefix, ctx): |
|
748 | def tempfromcontext(prefix, ctx): | |
750 | f, name = maketempfrompath(prefix, ctx.path()) |
|
749 | f, name = maketempfrompath(prefix, ctx.path()) | |
751 | data = repo.wwritedata(ctx.path(), ctx.data()) |
|
750 | data = repo.wwritedata(ctx.path(), ctx.data()) | |
752 | f.write(data) |
|
751 | f.write(data) | |
753 | f.close() |
|
752 | f.close() | |
754 | return name |
|
753 | return name | |
755 |
|
754 | |||
756 | b = tempfromcontext("base", fca) |
|
755 | b = tempfromcontext("base", fca) | |
757 | c = tempfromcontext("other", fco) |
|
756 | c = tempfromcontext("other", fco) | |
758 | d = localpath |
|
757 | d = localpath | |
759 | if uselocalpath: |
|
758 | if uselocalpath: | |
760 | # We start off with this being the backup filename, so remove the .orig |
|
759 | # We start off with this being the backup filename, so remove the .orig | |
761 | # to make syntax-highlighting more likely. |
|
760 | # to make syntax-highlighting more likely. | |
762 | if d.endswith('.orig'): |
|
761 | if d.endswith('.orig'): | |
763 | d, _ = os.path.splitext(d) |
|
762 | d, _ = os.path.splitext(d) | |
764 | f, d = maketempfrompath("local", d) |
|
763 | f, d = maketempfrompath("local", d) | |
765 | with open(localpath, 'rb') as src: |
|
764 | with open(localpath, 'rb') as src: | |
766 | f.write(src.read()) |
|
765 | f.write(src.read()) | |
767 | f.close() |
|
766 | f.close() | |
768 |
|
767 | |||
769 | try: |
|
768 | try: | |
770 | yield b, c, d |
|
769 | yield b, c, d | |
771 | finally: |
|
770 | finally: | |
772 | if tmproot: |
|
771 | if tmproot: | |
773 | shutil.rmtree(tmproot) |
|
772 | shutil.rmtree(tmproot) | |
774 | else: |
|
773 | else: | |
775 | util.unlink(b) |
|
774 | util.unlink(b) | |
776 | util.unlink(c) |
|
775 | util.unlink(c) | |
777 | # if not uselocalpath, d is the 'orig'/backup file which we |
|
776 | # if not uselocalpath, d is the 'orig'/backup file which we | |
778 | # shouldn't delete. |
|
777 | # shouldn't delete. | |
779 | if d and uselocalpath: |
|
778 | if d and uselocalpath: | |
780 | util.unlink(d) |
|
779 | util.unlink(d) | |
781 |
|
780 | |||
782 | def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None): |
|
781 | def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None): | |
783 | """perform a 3-way merge in the working directory |
|
782 | """perform a 3-way merge in the working directory | |
784 |
|
783 | |||
785 | premerge = whether this is a premerge |
|
784 | premerge = whether this is a premerge | |
786 | mynode = parent node before merge |
|
785 | mynode = parent node before merge | |
787 | orig = original local filename before merge |
|
786 | orig = original local filename before merge | |
788 | fco = other file context |
|
787 | fco = other file context | |
789 | fca = ancestor file context |
|
788 | fca = ancestor file context | |
790 | fcd = local file context for current/destination file |
|
789 | fcd = local file context for current/destination file | |
791 |
|
790 | |||
792 | Returns whether the merge is complete, the return value of the merge, and |
|
791 | Returns whether the merge is complete, the return value of the merge, and | |
793 | a boolean indicating whether the file was deleted from disk.""" |
|
792 | a boolean indicating whether the file was deleted from disk.""" | |
794 |
|
793 | |||
795 | if not fco.cmp(fcd): # files identical? |
|
794 | if not fco.cmp(fcd): # files identical? | |
796 | return True, None, False |
|
795 | return True, None, False | |
797 |
|
796 | |||
798 | ui = repo.ui |
|
797 | ui = repo.ui | |
799 | fd = fcd.path() |
|
798 | fd = fcd.path() | |
800 | binary = fcd.isbinary() or fco.isbinary() or fca.isbinary() |
|
799 | binary = fcd.isbinary() or fco.isbinary() or fca.isbinary() | |
801 | symlink = 'l' in fcd.flags() + fco.flags() |
|
800 | symlink = 'l' in fcd.flags() + fco.flags() | |
802 | changedelete = fcd.isabsent() or fco.isabsent() |
|
801 | changedelete = fcd.isabsent() or fco.isabsent() | |
803 | tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete) |
|
802 | tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete) | |
804 | scriptfn = None |
|
803 | scriptfn = None | |
805 | if tool in internals and tool.startswith('internal:'): |
|
804 | if tool in internals and tool.startswith('internal:'): | |
806 | # normalize to new-style names (':merge' etc) |
|
805 | # normalize to new-style names (':merge' etc) | |
807 | tool = tool[len('internal'):] |
|
806 | tool = tool[len('internal'):] | |
808 | if toolpath and toolpath.startswith('python:'): |
|
807 | if toolpath and toolpath.startswith('python:'): | |
809 | invalidsyntax = False |
|
808 | invalidsyntax = False | |
810 | if toolpath.count(':') >= 2: |
|
809 | if toolpath.count(':') >= 2: | |
811 | script, scriptfn = toolpath[7:].rsplit(':', 1) |
|
810 | script, scriptfn = toolpath[7:].rsplit(':', 1) | |
812 | if not scriptfn: |
|
811 | if not scriptfn: | |
813 | invalidsyntax = True |
|
812 | invalidsyntax = True | |
814 | # missing :callable can lead to spliting on windows drive letter |
|
813 | # missing :callable can lead to spliting on windows drive letter | |
815 | if '\\' in scriptfn or '/' in scriptfn: |
|
814 | if '\\' in scriptfn or '/' in scriptfn: | |
816 | invalidsyntax = True |
|
815 | invalidsyntax = True | |
817 | else: |
|
816 | else: | |
818 | invalidsyntax = True |
|
817 | invalidsyntax = True | |
819 | if invalidsyntax: |
|
818 | if invalidsyntax: | |
820 | raise error.Abort(_("invalid 'python:' syntax: %s") % toolpath) |
|
819 | raise error.Abort(_("invalid 'python:' syntax: %s") % toolpath) | |
821 | toolpath = script |
|
820 | toolpath = script | |
822 | ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n" |
|
821 | ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n" | |
823 | % (tool, fd, pycompat.bytestr(binary), pycompat.bytestr(symlink), |
|
822 | % (tool, fd, pycompat.bytestr(binary), pycompat.bytestr(symlink), | |
824 | pycompat.bytestr(changedelete))) |
|
823 | pycompat.bytestr(changedelete))) | |
825 |
|
824 | |||
826 | if tool in internals: |
|
825 | if tool in internals: | |
827 | func = internals[tool] |
|
826 | func = internals[tool] | |
828 | mergetype = func.mergetype |
|
827 | mergetype = func.mergetype | |
829 | onfailure = func.onfailure |
|
828 | onfailure = func.onfailure | |
830 | precheck = func.precheck |
|
829 | precheck = func.precheck | |
831 | isexternal = False |
|
830 | isexternal = False | |
832 | else: |
|
831 | else: | |
833 | if wctx.isinmemory(): |
|
832 | if wctx.isinmemory(): | |
834 | func = _xmergeimm |
|
833 | func = _xmergeimm | |
835 | else: |
|
834 | else: | |
836 | func = _xmerge |
|
835 | func = _xmerge | |
837 | mergetype = fullmerge |
|
836 | mergetype = fullmerge | |
838 | onfailure = _("merging %s failed!\n") |
|
837 | onfailure = _("merging %s failed!\n") | |
839 | precheck = None |
|
838 | precheck = None | |
840 | isexternal = True |
|
839 | isexternal = True | |
841 |
|
840 | |||
842 | toolconf = tool, toolpath, binary, symlink, scriptfn |
|
841 | toolconf = tool, toolpath, binary, symlink, scriptfn | |
843 |
|
842 | |||
844 | if mergetype == nomerge: |
|
843 | if mergetype == nomerge: | |
845 | r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels) |
|
844 | r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels) | |
846 | return True, r, deleted |
|
845 | return True, r, deleted | |
847 |
|
846 | |||
848 | if premerge: |
|
847 | if premerge: | |
849 | if orig != fco.path(): |
|
848 | if orig != fco.path(): | |
850 | ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
|
849 | ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) | |
851 | else: |
|
850 | else: | |
852 | ui.status(_("merging %s\n") % fd) |
|
851 | ui.status(_("merging %s\n") % fd) | |
853 |
|
852 | |||
854 | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) |
|
853 | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | |
855 |
|
854 | |||
856 | if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, |
|
855 | if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | |
857 | toolconf): |
|
856 | toolconf): | |
858 | if onfailure: |
|
857 | if onfailure: | |
859 | if wctx.isinmemory(): |
|
858 | if wctx.isinmemory(): | |
860 | raise error.InMemoryMergeConflictsError('in-memory merge does ' |
|
859 | raise error.InMemoryMergeConflictsError('in-memory merge does ' | |
861 | 'not support merge ' |
|
860 | 'not support merge ' | |
862 | 'conflicts') |
|
861 | 'conflicts') | |
863 | ui.warn(onfailure % fd) |
|
862 | ui.warn(onfailure % fd) | |
864 | return True, 1, False |
|
863 | return True, 1, False | |
865 |
|
864 | |||
866 | back = _makebackup(repo, ui, wctx, fcd, premerge) |
|
865 | back = _makebackup(repo, ui, wctx, fcd, premerge) | |
867 | files = (None, None, None, back) |
|
866 | files = (None, None, None, back) | |
868 | r = 1 |
|
867 | r = 1 | |
869 | try: |
|
868 | try: | |
870 | internalmarkerstyle = ui.config('ui', 'mergemarkers') |
|
869 | internalmarkerstyle = ui.config('ui', 'mergemarkers') | |
871 | if isexternal: |
|
870 | if isexternal: | |
872 | markerstyle = _toolstr(ui, tool, 'mergemarkers') |
|
871 | markerstyle = _toolstr(ui, tool, 'mergemarkers') | |
873 | else: |
|
872 | else: | |
874 | markerstyle = internalmarkerstyle |
|
873 | markerstyle = internalmarkerstyle | |
875 |
|
874 | |||
876 | if not labels: |
|
875 | if not labels: | |
877 | labels = _defaultconflictlabels |
|
876 | labels = _defaultconflictlabels | |
878 | formattedlabels = labels |
|
877 | formattedlabels = labels | |
879 | if markerstyle != 'basic': |
|
878 | if markerstyle != 'basic': | |
880 | formattedlabels = _formatlabels(repo, fcd, fco, fca, labels, |
|
879 | formattedlabels = _formatlabels(repo, fcd, fco, fca, labels, | |
881 | tool=tool) |
|
880 | tool=tool) | |
882 |
|
881 | |||
883 | if premerge and mergetype == fullmerge: |
|
882 | if premerge and mergetype == fullmerge: | |
884 | # conflict markers generated by premerge will use 'detailed' |
|
883 | # conflict markers generated by premerge will use 'detailed' | |
885 | # settings if either ui.mergemarkers or the tool's mergemarkers |
|
884 | # settings if either ui.mergemarkers or the tool's mergemarkers | |
886 | # setting is 'detailed'. This way tools can have basic labels in |
|
885 | # setting is 'detailed'. This way tools can have basic labels in | |
887 | # space-constrained areas of the UI, but still get full information |
|
886 | # space-constrained areas of the UI, but still get full information | |
888 | # in conflict markers if premerge is 'keep' or 'keep-merge3'. |
|
887 | # in conflict markers if premerge is 'keep' or 'keep-merge3'. | |
889 | premergelabels = labels |
|
888 | premergelabels = labels | |
890 | labeltool = None |
|
889 | labeltool = None | |
891 | if markerstyle != 'basic': |
|
890 | if markerstyle != 'basic': | |
892 | # respect 'tool's mergemarkertemplate (which defaults to |
|
891 | # respect 'tool's mergemarkertemplate (which defaults to | |
893 | # ui.mergemarkertemplate) |
|
892 | # ui.mergemarkertemplate) | |
894 | labeltool = tool |
|
893 | labeltool = tool | |
895 | if internalmarkerstyle != 'basic' or markerstyle != 'basic': |
|
894 | if internalmarkerstyle != 'basic' or markerstyle != 'basic': | |
896 | premergelabels = _formatlabels(repo, fcd, fco, fca, |
|
895 | premergelabels = _formatlabels(repo, fcd, fco, fca, | |
897 | premergelabels, tool=labeltool) |
|
896 | premergelabels, tool=labeltool) | |
898 |
|
897 | |||
899 | r = _premerge(repo, fcd, fco, fca, toolconf, files, |
|
898 | r = _premerge(repo, fcd, fco, fca, toolconf, files, | |
900 | labels=premergelabels) |
|
899 | labels=premergelabels) | |
901 | # complete if premerge successful (r is 0) |
|
900 | # complete if premerge successful (r is 0) | |
902 | return not r, r, False |
|
901 | return not r, r, False | |
903 |
|
902 | |||
904 | needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, |
|
903 | needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, | |
905 | toolconf, files, labels=formattedlabels) |
|
904 | toolconf, files, labels=formattedlabels) | |
906 |
|
905 | |||
907 | if needcheck: |
|
906 | if needcheck: | |
908 | r = _check(repo, r, ui, tool, fcd, files) |
|
907 | r = _check(repo, r, ui, tool, fcd, files) | |
909 |
|
908 | |||
910 | if r: |
|
909 | if r: | |
911 | if onfailure: |
|
910 | if onfailure: | |
912 | if wctx.isinmemory(): |
|
911 | if wctx.isinmemory(): | |
913 | raise error.InMemoryMergeConflictsError('in-memory merge ' |
|
912 | raise error.InMemoryMergeConflictsError('in-memory merge ' | |
914 | 'does not support ' |
|
913 | 'does not support ' | |
915 | 'merge conflicts') |
|
914 | 'merge conflicts') | |
916 | ui.warn(onfailure % fd) |
|
915 | ui.warn(onfailure % fd) | |
917 | _onfilemergefailure(ui) |
|
916 | _onfilemergefailure(ui) | |
918 |
|
917 | |||
919 | return True, r, deleted |
|
918 | return True, r, deleted | |
920 | finally: |
|
919 | finally: | |
921 | if not r and back is not None: |
|
920 | if not r and back is not None: | |
922 | back.remove() |
|
921 | back.remove() | |
923 |
|
922 | |||
924 | def _haltmerge(): |
|
923 | def _haltmerge(): | |
925 | msg = _('merge halted after failed merge (see hg resolve)') |
|
924 | msg = _('merge halted after failed merge (see hg resolve)') | |
926 | raise error.InterventionRequired(msg) |
|
925 | raise error.InterventionRequired(msg) | |
927 |
|
926 | |||
928 | def _onfilemergefailure(ui): |
|
927 | def _onfilemergefailure(ui): | |
929 | action = ui.config('merge', 'on-failure') |
|
928 | action = ui.config('merge', 'on-failure') | |
930 | if action == 'prompt': |
|
929 | if action == 'prompt': | |
931 | msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No') |
|
930 | msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No') | |
932 | if ui.promptchoice(msg, 0) == 1: |
|
931 | if ui.promptchoice(msg, 0) == 1: | |
933 | _haltmerge() |
|
932 | _haltmerge() | |
934 | if action == 'halt': |
|
933 | if action == 'halt': | |
935 | _haltmerge() |
|
934 | _haltmerge() | |
936 | # default action is 'continue', in which case we neither prompt nor halt |
|
935 | # default action is 'continue', in which case we neither prompt nor halt | |
937 |
|
936 | |||
938 | def hasconflictmarkers(data): |
|
937 | def hasconflictmarkers(data): | |
939 | return bool(re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", data, |
|
938 | return bool(re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", data, | |
940 | re.MULTILINE)) |
|
939 | re.MULTILINE)) | |
941 |
|
940 | |||
942 | def _check(repo, r, ui, tool, fcd, files): |
|
941 | def _check(repo, r, ui, tool, fcd, files): | |
943 | fd = fcd.path() |
|
942 | fd = fcd.path() | |
944 | unused, unused, unused, back = files |
|
943 | unused, unused, unused, back = files | |
945 |
|
944 | |||
946 | if not r and (_toolbool(ui, tool, "checkconflicts") or |
|
945 | if not r and (_toolbool(ui, tool, "checkconflicts") or | |
947 | 'conflicts' in _toollist(ui, tool, "check")): |
|
946 | 'conflicts' in _toollist(ui, tool, "check")): | |
948 | if hasconflictmarkers(fcd.data()): |
|
947 | if hasconflictmarkers(fcd.data()): | |
949 | r = 1 |
|
948 | r = 1 | |
950 |
|
949 | |||
951 | checked = False |
|
950 | checked = False | |
952 | if 'prompt' in _toollist(ui, tool, "check"): |
|
951 | if 'prompt' in _toollist(ui, tool, "check"): | |
953 | checked = True |
|
952 | checked = True | |
954 | if ui.promptchoice(_("was merge of '%s' successful (yn)?" |
|
953 | if ui.promptchoice(_("was merge of '%s' successful (yn)?" | |
955 | "$$ &Yes $$ &No") % fd, 1): |
|
954 | "$$ &Yes $$ &No") % fd, 1): | |
956 | r = 1 |
|
955 | r = 1 | |
957 |
|
956 | |||
958 | if not r and not checked and (_toolbool(ui, tool, "checkchanged") or |
|
957 | if not r and not checked and (_toolbool(ui, tool, "checkchanged") or | |
959 | 'changed' in |
|
958 | 'changed' in | |
960 | _toollist(ui, tool, "check")): |
|
959 | _toollist(ui, tool, "check")): | |
961 | if back is not None and not fcd.cmp(back): |
|
960 | if back is not None and not fcd.cmp(back): | |
962 | if ui.promptchoice(_(" output file %s appears unchanged\n" |
|
961 | if ui.promptchoice(_(" output file %s appears unchanged\n" | |
963 | "was merge successful (yn)?" |
|
962 | "was merge successful (yn)?" | |
964 | "$$ &Yes $$ &No") % fd, 1): |
|
963 | "$$ &Yes $$ &No") % fd, 1): | |
965 | r = 1 |
|
964 | r = 1 | |
966 |
|
965 | |||
967 | if back is not None and _toolbool(ui, tool, "fixeol"): |
|
966 | if back is not None and _toolbool(ui, tool, "fixeol"): | |
968 | _matcheol(_workingpath(repo, fcd), back) |
|
967 | _matcheol(_workingpath(repo, fcd), back) | |
969 |
|
968 | |||
970 | return r |
|
969 | return r | |
971 |
|
970 | |||
972 | def _workingpath(repo, ctx): |
|
971 | def _workingpath(repo, ctx): | |
973 | return repo.wjoin(ctx.path()) |
|
972 | return repo.wjoin(ctx.path()) | |
974 |
|
973 | |||
975 | def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None): |
|
974 | def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None): | |
976 | return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca, |
|
975 | return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca, | |
977 | labels=labels) |
|
976 | labels=labels) | |
978 |
|
977 | |||
979 | def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None): |
|
978 | def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None): | |
980 | return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca, |
|
979 | return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca, | |
981 | labels=labels) |
|
980 | labels=labels) | |
982 |
|
981 | |||
983 | def loadinternalmerge(ui, extname, registrarobj): |
|
982 | def loadinternalmerge(ui, extname, registrarobj): | |
984 | """Load internal merge tool from specified registrarobj |
|
983 | """Load internal merge tool from specified registrarobj | |
985 | """ |
|
984 | """ | |
986 | for name, func in registrarobj._table.iteritems(): |
|
985 | for name, func in registrarobj._table.iteritems(): | |
987 | fullname = ':' + name |
|
986 | fullname = ':' + name | |
988 | internals[fullname] = func |
|
987 | internals[fullname] = func | |
989 | internals['internal:' + name] = func |
|
988 | internals['internal:' + name] = func | |
990 | internalsdoc[fullname] = func |
|
989 | internalsdoc[fullname] = func | |
991 |
|
990 | |||
992 | capabilities = sorted([k for k, v in func.capabilities.items() if v]) |
|
991 | capabilities = sorted([k for k, v in func.capabilities.items() if v]) | |
993 | if capabilities: |
|
992 | if capabilities: | |
994 | capdesc = _("(actual capabilities: %s)") % ', '.join(capabilities) |
|
993 | capdesc = _("(actual capabilities: %s)") % ', '.join(capabilities) | |
995 | func.__doc__ = (func.__doc__ + |
|
994 | func.__doc__ = (func.__doc__ + | |
996 | pycompat.sysstr("\n\n %s" % capdesc)) |
|
995 | pycompat.sysstr("\n\n %s" % capdesc)) | |
997 |
|
996 | |||
998 | # load built-in merge tools explicitly to setup internalsdoc |
|
997 | # load built-in merge tools explicitly to setup internalsdoc | |
999 | loadinternalmerge(None, None, internaltool) |
|
998 | loadinternalmerge(None, None, internaltool) | |
1000 |
|
999 | |||
1001 | # tell hggettext to extract docstrings from these functions: |
|
1000 | # tell hggettext to extract docstrings from these functions: | |
1002 | i18nfunctions = internals.values() |
|
1001 | i18nfunctions = internals.values() |
@@ -1,2038 +1,2050 b'' | |||||
1 | test merge-tools configuration - mostly exercising filemerge.py |
|
1 | test merge-tools configuration - mostly exercising filemerge.py | |
2 |
|
2 | |||
3 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test |
|
3 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test | |
4 | $ hg init repo |
|
4 | $ hg init repo | |
5 | $ cd repo |
|
5 | $ cd repo | |
6 |
|
6 | |||
7 | revision 0 |
|
7 | revision 0 | |
8 |
|
8 | |||
9 | $ echo "revision 0" > f |
|
9 | $ echo "revision 0" > f | |
10 | $ echo "space" >> f |
|
10 | $ echo "space" >> f | |
11 | $ hg commit -Am "revision 0" |
|
11 | $ hg commit -Am "revision 0" | |
12 | adding f |
|
12 | adding f | |
13 |
|
13 | |||
14 | revision 1 |
|
14 | revision 1 | |
15 |
|
15 | |||
16 | $ echo "revision 1" > f |
|
16 | $ echo "revision 1" > f | |
17 | $ echo "space" >> f |
|
17 | $ echo "space" >> f | |
18 | $ hg commit -Am "revision 1" |
|
18 | $ hg commit -Am "revision 1" | |
19 | $ hg update 0 > /dev/null |
|
19 | $ hg update 0 > /dev/null | |
20 |
|
20 | |||
21 | revision 2 |
|
21 | revision 2 | |
22 |
|
22 | |||
23 | $ echo "revision 2" > f |
|
23 | $ echo "revision 2" > f | |
24 | $ echo "space" >> f |
|
24 | $ echo "space" >> f | |
25 | $ hg commit -Am "revision 2" |
|
25 | $ hg commit -Am "revision 2" | |
26 | created new head |
|
26 | created new head | |
27 | $ hg update 0 > /dev/null |
|
27 | $ hg update 0 > /dev/null | |
28 |
|
28 | |||
29 | revision 3 - simple to merge |
|
29 | revision 3 - simple to merge | |
30 |
|
30 | |||
31 | $ echo "revision 3" >> f |
|
31 | $ echo "revision 3" >> f | |
32 | $ hg commit -Am "revision 3" |
|
32 | $ hg commit -Am "revision 3" | |
33 | created new head |
|
33 | created new head | |
34 |
|
34 | |||
35 | revision 4 - hard to merge |
|
35 | revision 4 - hard to merge | |
36 |
|
36 | |||
37 | $ hg update 0 > /dev/null |
|
37 | $ hg update 0 > /dev/null | |
38 | $ echo "revision 4" > f |
|
38 | $ echo "revision 4" > f | |
39 | $ hg commit -Am "revision 4" |
|
39 | $ hg commit -Am "revision 4" | |
40 | created new head |
|
40 | created new head | |
41 |
|
41 | |||
42 | $ echo "[merge-tools]" > .hg/hgrc |
|
42 | $ echo "[merge-tools]" > .hg/hgrc | |
43 |
|
43 | |||
44 | $ beforemerge() { |
|
44 | $ beforemerge() { | |
45 | > cat .hg/hgrc |
|
45 | > cat .hg/hgrc | |
46 | > echo "# hg update -C 1" |
|
46 | > echo "# hg update -C 1" | |
47 | > hg update -C 1 > /dev/null |
|
47 | > hg update -C 1 > /dev/null | |
48 | > } |
|
48 | > } | |
49 | $ aftermerge() { |
|
49 | $ aftermerge() { | |
50 | > echo "# cat f" |
|
50 | > echo "# cat f" | |
51 | > cat f |
|
51 | > cat f | |
52 | > echo "# hg stat" |
|
52 | > echo "# hg stat" | |
53 | > hg stat |
|
53 | > hg stat | |
54 | > echo "# hg resolve --list" |
|
54 | > echo "# hg resolve --list" | |
55 | > hg resolve --list |
|
55 | > hg resolve --list | |
56 | > rm -f f.orig |
|
56 | > rm -f f.orig | |
57 | > } |
|
57 | > } | |
58 |
|
58 | |||
59 | Tool selection |
|
59 | Tool selection | |
60 |
|
60 | |||
61 | default is internal merge: |
|
61 | default is internal merge: | |
62 |
|
62 | |||
63 | $ beforemerge |
|
63 | $ beforemerge | |
64 | [merge-tools] |
|
64 | [merge-tools] | |
65 | # hg update -C 1 |
|
65 | # hg update -C 1 | |
66 |
|
66 | |||
67 | hg merge -r 2 |
|
67 | hg merge -r 2 | |
68 | override $PATH to ensure hgmerge not visible; use $PYTHON in case we're |
|
68 | override $PATH to ensure hgmerge not visible; use $PYTHON in case we're | |
69 | running from a devel copy, not a temp installation |
|
69 | running from a devel copy, not a temp installation | |
70 |
|
70 | |||
71 | $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
|
71 | $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | |
72 | merging f |
|
72 | merging f | |
73 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
73 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
74 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
74 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
75 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
75 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
76 | [1] |
|
76 | [1] | |
77 | $ aftermerge |
|
77 | $ aftermerge | |
78 | # cat f |
|
78 | # cat f | |
79 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
79 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
80 | revision 1 |
|
80 | revision 1 | |
81 | ======= |
|
81 | ======= | |
82 | revision 2 |
|
82 | revision 2 | |
83 | >>>>>>> merge rev: 0185f4e0cf02 - test: revision 2 |
|
83 | >>>>>>> merge rev: 0185f4e0cf02 - test: revision 2 | |
84 | space |
|
84 | space | |
85 | # hg stat |
|
85 | # hg stat | |
86 | M f |
|
86 | M f | |
87 | ? f.orig |
|
87 | ? f.orig | |
88 | # hg resolve --list |
|
88 | # hg resolve --list | |
89 | U f |
|
89 | U f | |
90 |
|
90 | |||
91 | simplest hgrc using false for merge: |
|
91 | simplest hgrc using false for merge: | |
92 |
|
92 | |||
93 | $ echo "false.whatever=" >> .hg/hgrc |
|
93 | $ echo "false.whatever=" >> .hg/hgrc | |
94 | $ beforemerge |
|
94 | $ beforemerge | |
95 | [merge-tools] |
|
95 | [merge-tools] | |
96 | false.whatever= |
|
96 | false.whatever= | |
97 | # hg update -C 1 |
|
97 | # hg update -C 1 | |
98 | $ hg merge -r 2 |
|
98 | $ hg merge -r 2 | |
99 | merging f |
|
99 | merging f | |
100 | merging f failed! |
|
100 | merging f failed! | |
101 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
101 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
102 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
102 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
103 | [1] |
|
103 | [1] | |
104 | $ aftermerge |
|
104 | $ aftermerge | |
105 | # cat f |
|
105 | # cat f | |
106 | revision 1 |
|
106 | revision 1 | |
107 | space |
|
107 | space | |
108 | # hg stat |
|
108 | # hg stat | |
109 | M f |
|
109 | M f | |
110 | ? f.orig |
|
110 | ? f.orig | |
111 | # hg resolve --list |
|
111 | # hg resolve --list | |
112 | U f |
|
112 | U f | |
113 |
|
113 | |||
114 | #if unix-permissions |
|
114 | #if unix-permissions | |
115 |
|
115 | |||
116 | unexecutable file in $PATH shouldn't be found: |
|
116 | unexecutable file in $PATH shouldn't be found: | |
117 |
|
117 | |||
118 | $ echo "echo fail" > false |
|
118 | $ echo "echo fail" > false | |
119 | $ hg up -qC 1 |
|
119 | $ hg up -qC 1 | |
120 | $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
|
120 | $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | |
121 | merging f |
|
121 | merging f | |
122 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
122 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
123 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
123 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
124 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
124 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
125 | [1] |
|
125 | [1] | |
126 | $ rm false |
|
126 | $ rm false | |
127 |
|
127 | |||
128 | #endif |
|
128 | #endif | |
129 |
|
129 | |||
130 | executable directory in $PATH shouldn't be found: |
|
130 | executable directory in $PATH shouldn't be found: | |
131 |
|
131 | |||
132 | $ mkdir false |
|
132 | $ mkdir false | |
133 | $ hg up -qC 1 |
|
133 | $ hg up -qC 1 | |
134 | $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
|
134 | $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | |
135 | merging f |
|
135 | merging f | |
136 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
136 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
137 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
137 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
138 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
138 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
139 | [1] |
|
139 | [1] | |
140 | $ rmdir false |
|
140 | $ rmdir false | |
141 |
|
141 | |||
142 | true with higher .priority gets precedence: |
|
142 | true with higher .priority gets precedence: | |
143 |
|
143 | |||
144 | $ echo "true.priority=1" >> .hg/hgrc |
|
144 | $ echo "true.priority=1" >> .hg/hgrc | |
145 | $ beforemerge |
|
145 | $ beforemerge | |
146 | [merge-tools] |
|
146 | [merge-tools] | |
147 | false.whatever= |
|
147 | false.whatever= | |
148 | true.priority=1 |
|
148 | true.priority=1 | |
149 | # hg update -C 1 |
|
149 | # hg update -C 1 | |
150 | $ hg merge -r 2 |
|
150 | $ hg merge -r 2 | |
151 | merging f |
|
151 | merging f | |
152 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
152 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
153 | (branch merge, don't forget to commit) |
|
153 | (branch merge, don't forget to commit) | |
154 | $ aftermerge |
|
154 | $ aftermerge | |
155 | # cat f |
|
155 | # cat f | |
156 | revision 1 |
|
156 | revision 1 | |
157 | space |
|
157 | space | |
158 | # hg stat |
|
158 | # hg stat | |
159 | M f |
|
159 | M f | |
160 | # hg resolve --list |
|
160 | # hg resolve --list | |
161 | R f |
|
161 | R f | |
162 |
|
162 | |||
163 | unless lowered on command line: |
|
163 | unless lowered on command line: | |
164 |
|
164 | |||
165 | $ beforemerge |
|
165 | $ beforemerge | |
166 | [merge-tools] |
|
166 | [merge-tools] | |
167 | false.whatever= |
|
167 | false.whatever= | |
168 | true.priority=1 |
|
168 | true.priority=1 | |
169 | # hg update -C 1 |
|
169 | # hg update -C 1 | |
170 | $ hg merge -r 2 --config merge-tools.true.priority=-7 |
|
170 | $ hg merge -r 2 --config merge-tools.true.priority=-7 | |
171 | merging f |
|
171 | merging f | |
172 | merging f failed! |
|
172 | merging f failed! | |
173 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
173 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
174 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
174 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
175 | [1] |
|
175 | [1] | |
176 | $ aftermerge |
|
176 | $ aftermerge | |
177 | # cat f |
|
177 | # cat f | |
178 | revision 1 |
|
178 | revision 1 | |
179 | space |
|
179 | space | |
180 | # hg stat |
|
180 | # hg stat | |
181 | M f |
|
181 | M f | |
182 | ? f.orig |
|
182 | ? f.orig | |
183 | # hg resolve --list |
|
183 | # hg resolve --list | |
184 | U f |
|
184 | U f | |
185 |
|
185 | |||
186 | or false set higher on command line: |
|
186 | or false set higher on command line: | |
187 |
|
187 | |||
188 | $ beforemerge |
|
188 | $ beforemerge | |
189 | [merge-tools] |
|
189 | [merge-tools] | |
190 | false.whatever= |
|
190 | false.whatever= | |
191 | true.priority=1 |
|
191 | true.priority=1 | |
192 | # hg update -C 1 |
|
192 | # hg update -C 1 | |
193 | $ hg merge -r 2 --config merge-tools.false.priority=117 |
|
193 | $ hg merge -r 2 --config merge-tools.false.priority=117 | |
194 | merging f |
|
194 | merging f | |
195 | merging f failed! |
|
195 | merging f failed! | |
196 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
196 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
197 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
197 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
198 | [1] |
|
198 | [1] | |
199 | $ aftermerge |
|
199 | $ aftermerge | |
200 | # cat f |
|
200 | # cat f | |
201 | revision 1 |
|
201 | revision 1 | |
202 | space |
|
202 | space | |
203 | # hg stat |
|
203 | # hg stat | |
204 | M f |
|
204 | M f | |
205 | ? f.orig |
|
205 | ? f.orig | |
206 | # hg resolve --list |
|
206 | # hg resolve --list | |
207 | U f |
|
207 | U f | |
208 |
|
208 | |||
209 | or true set to disabled: |
|
209 | or true set to disabled: | |
210 | $ beforemerge |
|
210 | $ beforemerge | |
211 | [merge-tools] |
|
211 | [merge-tools] | |
212 | false.whatever= |
|
212 | false.whatever= | |
213 | true.priority=1 |
|
213 | true.priority=1 | |
214 | # hg update -C 1 |
|
214 | # hg update -C 1 | |
215 | $ hg merge -r 2 --config merge-tools.true.disabled=yes |
|
215 | $ hg merge -r 2 --config merge-tools.true.disabled=yes | |
216 | merging f |
|
216 | merging f | |
217 | merging f failed! |
|
217 | merging f failed! | |
218 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
218 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
219 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
219 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
220 | [1] |
|
220 | [1] | |
221 | $ aftermerge |
|
221 | $ aftermerge | |
222 | # cat f |
|
222 | # cat f | |
223 | revision 1 |
|
223 | revision 1 | |
224 | space |
|
224 | space | |
225 | # hg stat |
|
225 | # hg stat | |
226 | M f |
|
226 | M f | |
227 | ? f.orig |
|
227 | ? f.orig | |
228 | # hg resolve --list |
|
228 | # hg resolve --list | |
229 | U f |
|
229 | U f | |
230 |
|
230 | |||
231 | or true.executable not found in PATH: |
|
231 | or true.executable not found in PATH: | |
232 |
|
232 | |||
233 | $ beforemerge |
|
233 | $ beforemerge | |
234 | [merge-tools] |
|
234 | [merge-tools] | |
235 | false.whatever= |
|
235 | false.whatever= | |
236 | true.priority=1 |
|
236 | true.priority=1 | |
237 | # hg update -C 1 |
|
237 | # hg update -C 1 | |
238 | $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool |
|
238 | $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool | |
239 | merging f |
|
239 | merging f | |
240 | merging f failed! |
|
240 | merging f failed! | |
241 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
241 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
242 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
242 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
243 | [1] |
|
243 | [1] | |
244 | $ aftermerge |
|
244 | $ aftermerge | |
245 | # cat f |
|
245 | # cat f | |
246 | revision 1 |
|
246 | revision 1 | |
247 | space |
|
247 | space | |
248 | # hg stat |
|
248 | # hg stat | |
249 | M f |
|
249 | M f | |
250 | ? f.orig |
|
250 | ? f.orig | |
251 | # hg resolve --list |
|
251 | # hg resolve --list | |
252 | U f |
|
252 | U f | |
253 |
|
253 | |||
254 | or true.executable with bogus path: |
|
254 | or true.executable with bogus path: | |
255 |
|
255 | |||
256 | $ beforemerge |
|
256 | $ beforemerge | |
257 | [merge-tools] |
|
257 | [merge-tools] | |
258 | false.whatever= |
|
258 | false.whatever= | |
259 | true.priority=1 |
|
259 | true.priority=1 | |
260 | # hg update -C 1 |
|
260 | # hg update -C 1 | |
261 | $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool |
|
261 | $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool | |
262 | merging f |
|
262 | merging f | |
263 | merging f failed! |
|
263 | merging f failed! | |
264 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
264 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
265 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
265 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
266 | [1] |
|
266 | [1] | |
267 | $ aftermerge |
|
267 | $ aftermerge | |
268 | # cat f |
|
268 | # cat f | |
269 | revision 1 |
|
269 | revision 1 | |
270 | space |
|
270 | space | |
271 | # hg stat |
|
271 | # hg stat | |
272 | M f |
|
272 | M f | |
273 | ? f.orig |
|
273 | ? f.orig | |
274 | # hg resolve --list |
|
274 | # hg resolve --list | |
275 | U f |
|
275 | U f | |
276 |
|
276 | |||
277 | but true.executable set to cat found in PATH works: |
|
277 | but true.executable set to cat found in PATH works: | |
278 |
|
278 | |||
279 | $ echo "true.executable=cat" >> .hg/hgrc |
|
279 | $ echo "true.executable=cat" >> .hg/hgrc | |
280 | $ beforemerge |
|
280 | $ beforemerge | |
281 | [merge-tools] |
|
281 | [merge-tools] | |
282 | false.whatever= |
|
282 | false.whatever= | |
283 | true.priority=1 |
|
283 | true.priority=1 | |
284 | true.executable=cat |
|
284 | true.executable=cat | |
285 | # hg update -C 1 |
|
285 | # hg update -C 1 | |
286 | $ hg merge -r 2 |
|
286 | $ hg merge -r 2 | |
287 | merging f |
|
287 | merging f | |
288 | revision 1 |
|
288 | revision 1 | |
289 | space |
|
289 | space | |
290 | revision 0 |
|
290 | revision 0 | |
291 | space |
|
291 | space | |
292 | revision 2 |
|
292 | revision 2 | |
293 | space |
|
293 | space | |
294 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
294 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
295 | (branch merge, don't forget to commit) |
|
295 | (branch merge, don't forget to commit) | |
296 | $ aftermerge |
|
296 | $ aftermerge | |
297 | # cat f |
|
297 | # cat f | |
298 | revision 1 |
|
298 | revision 1 | |
299 | space |
|
299 | space | |
300 | # hg stat |
|
300 | # hg stat | |
301 | M f |
|
301 | M f | |
302 | # hg resolve --list |
|
302 | # hg resolve --list | |
303 | R f |
|
303 | R f | |
304 |
|
304 | |||
305 | and true.executable set to cat with path works: |
|
305 | and true.executable set to cat with path works: | |
306 |
|
306 | |||
307 | $ beforemerge |
|
307 | $ beforemerge | |
308 | [merge-tools] |
|
308 | [merge-tools] | |
309 | false.whatever= |
|
309 | false.whatever= | |
310 | true.priority=1 |
|
310 | true.priority=1 | |
311 | true.executable=cat |
|
311 | true.executable=cat | |
312 | # hg update -C 1 |
|
312 | # hg update -C 1 | |
313 | $ hg merge -r 2 --config merge-tools.true.executable=cat |
|
313 | $ hg merge -r 2 --config merge-tools.true.executable=cat | |
314 | merging f |
|
314 | merging f | |
315 | revision 1 |
|
315 | revision 1 | |
316 | space |
|
316 | space | |
317 | revision 0 |
|
317 | revision 0 | |
318 | space |
|
318 | space | |
319 | revision 2 |
|
319 | revision 2 | |
320 | space |
|
320 | space | |
321 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
321 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
322 | (branch merge, don't forget to commit) |
|
322 | (branch merge, don't forget to commit) | |
323 | $ aftermerge |
|
323 | $ aftermerge | |
324 | # cat f |
|
324 | # cat f | |
325 | revision 1 |
|
325 | revision 1 | |
326 | space |
|
326 | space | |
327 | # hg stat |
|
327 | # hg stat | |
328 | M f |
|
328 | M f | |
329 | # hg resolve --list |
|
329 | # hg resolve --list | |
330 | R f |
|
330 | R f | |
331 |
|
331 | |||
332 | executable set to python script that succeeds: |
|
332 | executable set to python script that succeeds: | |
333 |
|
333 | |||
334 | $ cat > "$TESTTMP/myworkingmerge.py" <<EOF |
|
334 | $ cat > "$TESTTMP/myworkingmerge.py" <<EOF | |
335 | > def myworkingmergefn(ui, repo, args, **kwargs): |
|
335 | > def myworkingmergefn(ui, repo, args, **kwargs): | |
336 | > return False |
|
336 | > return False | |
337 | > EOF |
|
337 | > EOF | |
338 | $ beforemerge |
|
338 | $ beforemerge | |
339 | [merge-tools] |
|
339 | [merge-tools] | |
340 | false.whatever= |
|
340 | false.whatever= | |
341 | true.priority=1 |
|
341 | true.priority=1 | |
342 | true.executable=cat |
|
342 | true.executable=cat | |
343 | # hg update -C 1 |
|
343 | # hg update -C 1 | |
344 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:myworkingmergefn" |
|
344 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:myworkingmergefn" | |
345 | merging f |
|
345 | merging f | |
346 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
346 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
347 | (branch merge, don't forget to commit) |
|
347 | (branch merge, don't forget to commit) | |
348 | $ aftermerge |
|
348 | $ aftermerge | |
349 | # cat f |
|
349 | # cat f | |
350 | revision 1 |
|
350 | revision 1 | |
351 | space |
|
351 | space | |
352 | # hg stat |
|
352 | # hg stat | |
353 | M f |
|
353 | M f | |
354 | # hg resolve --list |
|
354 | # hg resolve --list | |
355 | R f |
|
355 | R f | |
356 |
|
356 | |||
357 | executable set to python script that fails: |
|
357 | executable set to python script that fails: | |
358 |
|
358 | |||
359 | $ cat > "$TESTTMP/mybrokenmerge.py" <<EOF |
|
359 | $ cat > "$TESTTMP/mybrokenmerge.py" <<EOF | |
360 | > def mybrokenmergefn(ui, repo, args, **kwargs): |
|
360 | > def mybrokenmergefn(ui, repo, args, **kwargs): | |
361 | > ui.write(b"some fail message\n") |
|
361 | > ui.write(b"some fail message\n") | |
362 | > return True |
|
362 | > return True | |
363 | > EOF |
|
363 | > EOF | |
364 | $ beforemerge |
|
364 | $ beforemerge | |
365 | [merge-tools] |
|
365 | [merge-tools] | |
366 | false.whatever= |
|
366 | false.whatever= | |
367 | true.priority=1 |
|
367 | true.priority=1 | |
368 | true.executable=cat |
|
368 | true.executable=cat | |
369 | # hg update -C 1 |
|
369 | # hg update -C 1 | |
370 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/mybrokenmerge.py:mybrokenmergefn" |
|
370 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/mybrokenmerge.py:mybrokenmergefn" | |
371 | merging f |
|
371 | merging f | |
372 | some fail message |
|
372 | some fail message | |
373 | abort: $TESTTMP/mybrokenmerge.py hook failed |
|
373 | abort: $TESTTMP/mybrokenmerge.py hook failed | |
374 | [255] |
|
374 | [255] | |
375 | $ aftermerge |
|
375 | $ aftermerge | |
376 | # cat f |
|
376 | # cat f | |
377 | revision 1 |
|
377 | revision 1 | |
378 | space |
|
378 | space | |
379 | # hg stat |
|
379 | # hg stat | |
380 | ? f.orig |
|
380 | ? f.orig | |
381 | # hg resolve --list |
|
381 | # hg resolve --list | |
382 | U f |
|
382 | U f | |
383 |
|
383 | |||
384 | executable set to python script that is missing function: |
|
384 | executable set to python script that is missing function: | |
385 |
|
385 | |||
386 | $ beforemerge |
|
386 | $ beforemerge | |
387 | [merge-tools] |
|
387 | [merge-tools] | |
388 | false.whatever= |
|
388 | false.whatever= | |
389 | true.priority=1 |
|
389 | true.priority=1 | |
390 | true.executable=cat |
|
390 | true.executable=cat | |
391 | # hg update -C 1 |
|
391 | # hg update -C 1 | |
392 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:missingFunction" |
|
392 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:missingFunction" | |
393 | merging f |
|
393 | merging f | |
394 | abort: $TESTTMP/myworkingmerge.py does not have function: missingFunction |
|
394 | abort: $TESTTMP/myworkingmerge.py does not have function: missingFunction | |
395 | [255] |
|
395 | [255] | |
396 | $ aftermerge |
|
396 | $ aftermerge | |
397 | # cat f |
|
397 | # cat f | |
398 | revision 1 |
|
398 | revision 1 | |
399 | space |
|
399 | space | |
400 | # hg stat |
|
400 | # hg stat | |
401 | ? f.orig |
|
401 | ? f.orig | |
402 | # hg resolve --list |
|
402 | # hg resolve --list | |
403 | U f |
|
403 | U f | |
404 |
|
404 | |||
405 | executable set to missing python script: |
|
405 | executable set to missing python script: | |
406 |
|
406 | |||
407 | $ beforemerge |
|
407 | $ beforemerge | |
408 | [merge-tools] |
|
408 | [merge-tools] | |
409 | false.whatever= |
|
409 | false.whatever= | |
410 | true.priority=1 |
|
410 | true.priority=1 | |
411 | true.executable=cat |
|
411 | true.executable=cat | |
412 | # hg update -C 1 |
|
412 | # hg update -C 1 | |
413 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/missingpythonscript.py:mergefn" |
|
413 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/missingpythonscript.py:mergefn" | |
414 | merging f |
|
414 | merging f | |
415 | abort: loading python merge script failed: $TESTTMP/missingpythonscript.py |
|
415 | abort: loading python merge script failed: $TESTTMP/missingpythonscript.py | |
416 | [255] |
|
416 | [255] | |
417 | $ aftermerge |
|
417 | $ aftermerge | |
418 | # cat f |
|
418 | # cat f | |
419 | revision 1 |
|
419 | revision 1 | |
420 | space |
|
420 | space | |
421 | # hg stat |
|
421 | # hg stat | |
422 | ? f.orig |
|
422 | ? f.orig | |
423 | # hg resolve --list |
|
423 | # hg resolve --list | |
424 | U f |
|
424 | U f | |
425 |
|
425 | |||
426 | executable set to python script but callable function is missing: |
|
426 | executable set to python script but callable function is missing: | |
427 |
|
427 | |||
428 | $ beforemerge |
|
428 | $ beforemerge | |
429 | [merge-tools] |
|
429 | [merge-tools] | |
430 | false.whatever= |
|
430 | false.whatever= | |
431 | true.priority=1 |
|
431 | true.priority=1 | |
432 | true.executable=cat |
|
432 | true.executable=cat | |
433 | # hg update -C 1 |
|
433 | # hg update -C 1 | |
434 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py" |
|
434 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py" | |
435 | abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py |
|
435 | abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py | |
436 | [255] |
|
436 | [255] | |
437 | $ aftermerge |
|
437 | $ aftermerge | |
438 | # cat f |
|
438 | # cat f | |
439 | revision 1 |
|
439 | revision 1 | |
440 | space |
|
440 | space | |
441 | # hg stat |
|
441 | # hg stat | |
442 | # hg resolve --list |
|
442 | # hg resolve --list | |
443 | U f |
|
443 | U f | |
444 |
|
444 | |||
445 | executable set to python script but callable function is empty string: |
|
445 | executable set to python script but callable function is empty string: | |
446 |
|
446 | |||
447 | $ beforemerge |
|
447 | $ beforemerge | |
448 | [merge-tools] |
|
448 | [merge-tools] | |
449 | false.whatever= |
|
449 | false.whatever= | |
450 | true.priority=1 |
|
450 | true.priority=1 | |
451 | true.executable=cat |
|
451 | true.executable=cat | |
452 | # hg update -C 1 |
|
452 | # hg update -C 1 | |
453 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:" |
|
453 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/myworkingmerge.py:" | |
454 | abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py: |
|
454 | abort: invalid 'python:' syntax: python:$TESTTMP/myworkingmerge.py: | |
455 | [255] |
|
455 | [255] | |
456 | $ aftermerge |
|
456 | $ aftermerge | |
457 | # cat f |
|
457 | # cat f | |
458 | revision 1 |
|
458 | revision 1 | |
459 | space |
|
459 | space | |
460 | # hg stat |
|
460 | # hg stat | |
461 | # hg resolve --list |
|
461 | # hg resolve --list | |
462 | U f |
|
462 | U f | |
463 |
|
463 | |||
464 | executable set to python script but callable function is missing and path contains colon: |
|
464 | executable set to python script but callable function is missing and path contains colon: | |
465 |
|
465 | |||
466 | $ beforemerge |
|
466 | $ beforemerge | |
467 | [merge-tools] |
|
467 | [merge-tools] | |
468 | false.whatever= |
|
468 | false.whatever= | |
469 | true.priority=1 |
|
469 | true.priority=1 | |
470 | true.executable=cat |
|
470 | true.executable=cat | |
471 | # hg update -C 1 |
|
471 | # hg update -C 1 | |
472 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/some:dir/myworkingmerge.py" |
|
472 | $ hg merge -r 2 --config merge-tools.true.executable="python:$TESTTMP/some:dir/myworkingmerge.py" | |
473 | abort: invalid 'python:' syntax: python:$TESTTMP/some:dir/myworkingmerge.py |
|
473 | abort: invalid 'python:' syntax: python:$TESTTMP/some:dir/myworkingmerge.py | |
474 | [255] |
|
474 | [255] | |
475 | $ aftermerge |
|
475 | $ aftermerge | |
476 | # cat f |
|
476 | # cat f | |
477 | revision 1 |
|
477 | revision 1 | |
478 | space |
|
478 | space | |
479 | # hg stat |
|
479 | # hg stat | |
480 | # hg resolve --list |
|
480 | # hg resolve --list | |
481 | U f |
|
481 | U f | |
482 |
|
482 | |||
483 | executable set to python script filename that contains spaces: |
|
483 | executable set to python script filename that contains spaces: | |
484 |
|
484 | |||
485 | $ mkdir -p "$TESTTMP/my path" |
|
485 | $ mkdir -p "$TESTTMP/my path" | |
486 | $ cat > "$TESTTMP/my path/my working merge with spaces in filename.py" <<EOF |
|
486 | $ cat > "$TESTTMP/my path/my working merge with spaces in filename.py" <<EOF | |
487 | > def myworkingmergefn(ui, repo, args, **kwargs): |
|
487 | > def myworkingmergefn(ui, repo, args, **kwargs): | |
488 | > return False |
|
488 | > return False | |
489 | > EOF |
|
489 | > EOF | |
490 | $ beforemerge |
|
490 | $ beforemerge | |
491 | [merge-tools] |
|
491 | [merge-tools] | |
492 | false.whatever= |
|
492 | false.whatever= | |
493 | true.priority=1 |
|
493 | true.priority=1 | |
494 | true.executable=cat |
|
494 | true.executable=cat | |
495 | # hg update -C 1 |
|
495 | # hg update -C 1 | |
496 | $ hg merge -r 2 --config "merge-tools.true.executable=python:$TESTTMP/my path/my working merge with spaces in filename.py:myworkingmergefn" |
|
496 | $ hg merge -r 2 --config "merge-tools.true.executable=python:$TESTTMP/my path/my working merge with spaces in filename.py:myworkingmergefn" | |
497 | merging f |
|
497 | merging f | |
498 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
498 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
499 | (branch merge, don't forget to commit) |
|
499 | (branch merge, don't forget to commit) | |
500 | $ aftermerge |
|
500 | $ aftermerge | |
501 | # cat f |
|
501 | # cat f | |
502 | revision 1 |
|
502 | revision 1 | |
503 | space |
|
503 | space | |
504 | # hg stat |
|
504 | # hg stat | |
505 | M f |
|
505 | M f | |
506 | # hg resolve --list |
|
506 | # hg resolve --list | |
507 | R f |
|
507 | R f | |
508 |
|
508 | |||
509 | #if unix-permissions |
|
509 | #if unix-permissions | |
510 |
|
510 | |||
511 | environment variables in true.executable are handled: |
|
511 | environment variables in true.executable are handled: | |
512 |
|
512 | |||
513 | $ echo 'echo "custom merge tool"' > .hg/merge.sh |
|
513 | $ echo 'echo "custom merge tool"' > .hg/merge.sh | |
514 | $ beforemerge |
|
514 | $ beforemerge | |
515 | [merge-tools] |
|
515 | [merge-tools] | |
516 | false.whatever= |
|
516 | false.whatever= | |
517 | true.priority=1 |
|
517 | true.priority=1 | |
518 | true.executable=cat |
|
518 | true.executable=cat | |
519 | # hg update -C 1 |
|
519 | # hg update -C 1 | |
520 | $ hg --config merge-tools.true.executable='sh' \ |
|
520 | $ hg --config merge-tools.true.executable='sh' \ | |
521 | > --config merge-tools.true.args=.hg/merge.sh \ |
|
521 | > --config merge-tools.true.args=.hg/merge.sh \ | |
522 | > merge -r 2 |
|
522 | > merge -r 2 | |
523 | merging f |
|
523 | merging f | |
524 | custom merge tool |
|
524 | custom merge tool | |
525 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
525 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
526 | (branch merge, don't forget to commit) |
|
526 | (branch merge, don't forget to commit) | |
527 | $ aftermerge |
|
527 | $ aftermerge | |
528 | # cat f |
|
528 | # cat f | |
529 | revision 1 |
|
529 | revision 1 | |
530 | space |
|
530 | space | |
531 | # hg stat |
|
531 | # hg stat | |
532 | M f |
|
532 | M f | |
533 | # hg resolve --list |
|
533 | # hg resolve --list | |
534 | R f |
|
534 | R f | |
535 |
|
535 | |||
536 | #endif |
|
536 | #endif | |
537 |
|
537 | |||
538 | Tool selection and merge-patterns |
|
538 | Tool selection and merge-patterns | |
539 |
|
539 | |||
540 | merge-patterns specifies new tool false: |
|
540 | merge-patterns specifies new tool false: | |
541 |
|
541 | |||
542 | $ beforemerge |
|
542 | $ beforemerge | |
543 | [merge-tools] |
|
543 | [merge-tools] | |
544 | false.whatever= |
|
544 | false.whatever= | |
545 | true.priority=1 |
|
545 | true.priority=1 | |
546 | true.executable=cat |
|
546 | true.executable=cat | |
547 | # hg update -C 1 |
|
547 | # hg update -C 1 | |
548 | $ hg merge -r 2 --config merge-patterns.f=false |
|
548 | $ hg merge -r 2 --config merge-patterns.f=false | |
549 | merging f |
|
549 | merging f | |
550 | merging f failed! |
|
550 | merging f failed! | |
551 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
551 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
552 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
552 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
553 | [1] |
|
553 | [1] | |
554 | $ aftermerge |
|
554 | $ aftermerge | |
555 | # cat f |
|
555 | # cat f | |
556 | revision 1 |
|
556 | revision 1 | |
557 | space |
|
557 | space | |
558 | # hg stat |
|
558 | # hg stat | |
559 | M f |
|
559 | M f | |
560 | ? f.orig |
|
560 | ? f.orig | |
561 | # hg resolve --list |
|
561 | # hg resolve --list | |
562 | U f |
|
562 | U f | |
563 |
|
563 | |||
564 | merge-patterns specifies executable not found in PATH and gets warning: |
|
564 | merge-patterns specifies executable not found in PATH and gets warning: | |
565 |
|
565 | |||
566 | $ beforemerge |
|
566 | $ beforemerge | |
567 | [merge-tools] |
|
567 | [merge-tools] | |
568 | false.whatever= |
|
568 | false.whatever= | |
569 | true.priority=1 |
|
569 | true.priority=1 | |
570 | true.executable=cat |
|
570 | true.executable=cat | |
571 | # hg update -C 1 |
|
571 | # hg update -C 1 | |
572 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool |
|
572 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool | |
573 | couldn't find merge tool true (for pattern f) |
|
573 | couldn't find merge tool true (for pattern f) | |
574 | merging f |
|
574 | merging f | |
575 | couldn't find merge tool true (for pattern f) |
|
575 | couldn't find merge tool true (for pattern f) | |
576 | merging f failed! |
|
576 | merging f failed! | |
577 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
577 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
578 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
578 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
579 | [1] |
|
579 | [1] | |
580 | $ aftermerge |
|
580 | $ aftermerge | |
581 | # cat f |
|
581 | # cat f | |
582 | revision 1 |
|
582 | revision 1 | |
583 | space |
|
583 | space | |
584 | # hg stat |
|
584 | # hg stat | |
585 | M f |
|
585 | M f | |
586 | ? f.orig |
|
586 | ? f.orig | |
587 | # hg resolve --list |
|
587 | # hg resolve --list | |
588 | U f |
|
588 | U f | |
589 |
|
589 | |||
590 | merge-patterns specifies executable with bogus path and gets warning: |
|
590 | merge-patterns specifies executable with bogus path and gets warning: | |
591 |
|
591 | |||
592 | $ beforemerge |
|
592 | $ beforemerge | |
593 | [merge-tools] |
|
593 | [merge-tools] | |
594 | false.whatever= |
|
594 | false.whatever= | |
595 | true.priority=1 |
|
595 | true.priority=1 | |
596 | true.executable=cat |
|
596 | true.executable=cat | |
597 | # hg update -C 1 |
|
597 | # hg update -C 1 | |
598 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool |
|
598 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool | |
599 | couldn't find merge tool true (for pattern f) |
|
599 | couldn't find merge tool true (for pattern f) | |
600 | merging f |
|
600 | merging f | |
601 | couldn't find merge tool true (for pattern f) |
|
601 | couldn't find merge tool true (for pattern f) | |
602 | merging f failed! |
|
602 | merging f failed! | |
603 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
603 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
604 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
604 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
605 | [1] |
|
605 | [1] | |
606 | $ aftermerge |
|
606 | $ aftermerge | |
607 | # cat f |
|
607 | # cat f | |
608 | revision 1 |
|
608 | revision 1 | |
609 | space |
|
609 | space | |
610 | # hg stat |
|
610 | # hg stat | |
611 | M f |
|
611 | M f | |
612 | ? f.orig |
|
612 | ? f.orig | |
613 | # hg resolve --list |
|
613 | # hg resolve --list | |
614 | U f |
|
614 | U f | |
615 |
|
615 | |||
616 | ui.merge overrules priority |
|
616 | ui.merge overrules priority | |
617 |
|
617 | |||
618 | ui.merge specifies false: |
|
618 | ui.merge specifies false: | |
619 |
|
619 | |||
620 | $ beforemerge |
|
620 | $ beforemerge | |
621 | [merge-tools] |
|
621 | [merge-tools] | |
622 | false.whatever= |
|
622 | false.whatever= | |
623 | true.priority=1 |
|
623 | true.priority=1 | |
624 | true.executable=cat |
|
624 | true.executable=cat | |
625 | # hg update -C 1 |
|
625 | # hg update -C 1 | |
626 | $ hg merge -r 2 --config ui.merge=false |
|
626 | $ hg merge -r 2 --config ui.merge=false | |
627 | merging f |
|
627 | merging f | |
628 | merging f failed! |
|
628 | merging f failed! | |
629 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
629 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
630 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
630 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
631 | [1] |
|
631 | [1] | |
632 | $ aftermerge |
|
632 | $ aftermerge | |
633 | # cat f |
|
633 | # cat f | |
634 | revision 1 |
|
634 | revision 1 | |
635 | space |
|
635 | space | |
636 | # hg stat |
|
636 | # hg stat | |
637 | M f |
|
637 | M f | |
638 | ? f.orig |
|
638 | ? f.orig | |
639 | # hg resolve --list |
|
639 | # hg resolve --list | |
640 | U f |
|
640 | U f | |
641 |
|
641 | |||
642 | ui.merge specifies internal:fail: |
|
642 | ui.merge specifies internal:fail: | |
643 |
|
643 | |||
644 | $ beforemerge |
|
644 | $ beforemerge | |
645 | [merge-tools] |
|
645 | [merge-tools] | |
646 | false.whatever= |
|
646 | false.whatever= | |
647 | true.priority=1 |
|
647 | true.priority=1 | |
648 | true.executable=cat |
|
648 | true.executable=cat | |
649 | # hg update -C 1 |
|
649 | # hg update -C 1 | |
650 | $ hg merge -r 2 --config ui.merge=internal:fail |
|
650 | $ hg merge -r 2 --config ui.merge=internal:fail | |
651 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
651 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
652 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
652 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
653 | [1] |
|
653 | [1] | |
654 | $ aftermerge |
|
654 | $ aftermerge | |
655 | # cat f |
|
655 | # cat f | |
656 | revision 1 |
|
656 | revision 1 | |
657 | space |
|
657 | space | |
658 | # hg stat |
|
658 | # hg stat | |
659 | M f |
|
659 | M f | |
660 | # hg resolve --list |
|
660 | # hg resolve --list | |
661 | U f |
|
661 | U f | |
662 |
|
662 | |||
663 | ui.merge specifies :local (without internal prefix): |
|
663 | ui.merge specifies :local (without internal prefix): | |
664 |
|
664 | |||
665 | $ beforemerge |
|
665 | $ beforemerge | |
666 | [merge-tools] |
|
666 | [merge-tools] | |
667 | false.whatever= |
|
667 | false.whatever= | |
668 | true.priority=1 |
|
668 | true.priority=1 | |
669 | true.executable=cat |
|
669 | true.executable=cat | |
670 | # hg update -C 1 |
|
670 | # hg update -C 1 | |
671 | $ hg merge -r 2 --config ui.merge=:local |
|
671 | $ hg merge -r 2 --config ui.merge=:local | |
672 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
672 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
673 | (branch merge, don't forget to commit) |
|
673 | (branch merge, don't forget to commit) | |
674 | $ aftermerge |
|
674 | $ aftermerge | |
675 | # cat f |
|
675 | # cat f | |
676 | revision 1 |
|
676 | revision 1 | |
677 | space |
|
677 | space | |
678 | # hg stat |
|
678 | # hg stat | |
679 | M f |
|
679 | M f | |
680 | # hg resolve --list |
|
680 | # hg resolve --list | |
681 | R f |
|
681 | R f | |
682 |
|
682 | |||
683 | ui.merge specifies internal:other: |
|
683 | ui.merge specifies internal:other: | |
684 |
|
684 | |||
685 | $ beforemerge |
|
685 | $ beforemerge | |
686 | [merge-tools] |
|
686 | [merge-tools] | |
687 | false.whatever= |
|
687 | false.whatever= | |
688 | true.priority=1 |
|
688 | true.priority=1 | |
689 | true.executable=cat |
|
689 | true.executable=cat | |
690 | # hg update -C 1 |
|
690 | # hg update -C 1 | |
691 | $ hg merge -r 2 --config ui.merge=internal:other |
|
691 | $ hg merge -r 2 --config ui.merge=internal:other | |
692 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
692 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
693 | (branch merge, don't forget to commit) |
|
693 | (branch merge, don't forget to commit) | |
694 | $ aftermerge |
|
694 | $ aftermerge | |
695 | # cat f |
|
695 | # cat f | |
696 | revision 2 |
|
696 | revision 2 | |
697 | space |
|
697 | space | |
698 | # hg stat |
|
698 | # hg stat | |
699 | M f |
|
699 | M f | |
700 | # hg resolve --list |
|
700 | # hg resolve --list | |
701 | R f |
|
701 | R f | |
702 |
|
702 | |||
703 | ui.merge specifies internal:prompt: |
|
703 | ui.merge specifies internal:prompt: | |
704 |
|
704 | |||
705 | $ beforemerge |
|
705 | $ beforemerge | |
706 | [merge-tools] |
|
706 | [merge-tools] | |
707 | false.whatever= |
|
707 | false.whatever= | |
708 | true.priority=1 |
|
708 | true.priority=1 | |
709 | true.executable=cat |
|
709 | true.executable=cat | |
710 | # hg update -C 1 |
|
710 | # hg update -C 1 | |
711 | $ hg merge -r 2 --config ui.merge=internal:prompt |
|
711 | $ hg merge -r 2 --config ui.merge=internal:prompt | |
712 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u |
|
712 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u | |
713 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
713 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
714 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
714 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
715 | [1] |
|
715 | [1] | |
716 | $ aftermerge |
|
716 | $ aftermerge | |
717 | # cat f |
|
717 | # cat f | |
718 | revision 1 |
|
718 | revision 1 | |
719 | space |
|
719 | space | |
720 | # hg stat |
|
720 | # hg stat | |
721 | M f |
|
721 | M f | |
722 | # hg resolve --list |
|
722 | # hg resolve --list | |
723 | U f |
|
723 | U f | |
724 |
|
724 | |||
725 | ui.merge specifies :prompt, with 'leave unresolved' chosen |
|
725 | ui.merge specifies :prompt, with 'leave unresolved' chosen | |
726 |
|
726 | |||
727 | $ beforemerge |
|
727 | $ beforemerge | |
728 | [merge-tools] |
|
728 | [merge-tools] | |
729 | false.whatever= |
|
729 | false.whatever= | |
730 | true.priority=1 |
|
730 | true.priority=1 | |
731 | true.executable=cat |
|
731 | true.executable=cat | |
732 | # hg update -C 1 |
|
732 | # hg update -C 1 | |
733 | $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF |
|
733 | $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF | |
734 | > u |
|
734 | > u | |
735 | > EOF |
|
735 | > EOF | |
736 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u |
|
736 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u | |
737 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
737 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
738 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
738 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
739 | [1] |
|
739 | [1] | |
740 | $ aftermerge |
|
740 | $ aftermerge | |
741 | # cat f |
|
741 | # cat f | |
742 | revision 1 |
|
742 | revision 1 | |
743 | space |
|
743 | space | |
744 | # hg stat |
|
744 | # hg stat | |
745 | M f |
|
745 | M f | |
746 | # hg resolve --list |
|
746 | # hg resolve --list | |
747 | U f |
|
747 | U f | |
748 |
|
748 | |||
749 | prompt with EOF |
|
749 | prompt with EOF | |
750 |
|
750 | |||
751 | $ beforemerge |
|
751 | $ beforemerge | |
752 | [merge-tools] |
|
752 | [merge-tools] | |
753 | false.whatever= |
|
753 | false.whatever= | |
754 | true.priority=1 |
|
754 | true.priority=1 | |
755 | true.executable=cat |
|
755 | true.executable=cat | |
756 | # hg update -C 1 |
|
756 | # hg update -C 1 | |
757 | $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true |
|
757 | $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true | |
758 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? |
|
758 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? | |
759 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
759 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
760 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
760 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
761 | [1] |
|
761 | [1] | |
762 | $ aftermerge |
|
762 | $ aftermerge | |
763 | # cat f |
|
763 | # cat f | |
764 | revision 1 |
|
764 | revision 1 | |
765 | space |
|
765 | space | |
766 | # hg stat |
|
766 | # hg stat | |
767 | M f |
|
767 | M f | |
768 | # hg resolve --list |
|
768 | # hg resolve --list | |
769 | U f |
|
769 | U f | |
770 | $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true |
|
770 | $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true | |
771 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? |
|
771 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? | |
772 | [1] |
|
772 | [1] | |
773 | $ aftermerge |
|
773 | $ aftermerge | |
774 | # cat f |
|
774 | # cat f | |
775 | revision 1 |
|
775 | revision 1 | |
776 | space |
|
776 | space | |
777 | # hg stat |
|
777 | # hg stat | |
778 | M f |
|
778 | M f | |
779 | ? f.orig |
|
779 | ? f.orig | |
780 | # hg resolve --list |
|
780 | # hg resolve --list | |
781 | U f |
|
781 | U f | |
782 | $ rm f |
|
782 | $ rm f | |
783 | $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true |
|
783 | $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true | |
784 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? |
|
784 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? | |
785 | [1] |
|
785 | [1] | |
786 | $ aftermerge |
|
786 | $ aftermerge | |
787 | # cat f |
|
787 | # cat f | |
788 | revision 1 |
|
788 | revision 1 | |
789 | space |
|
789 | space | |
790 | # hg stat |
|
790 | # hg stat | |
791 | M f |
|
791 | M f | |
792 | # hg resolve --list |
|
792 | # hg resolve --list | |
793 | U f |
|
793 | U f | |
794 | $ hg resolve --all --config ui.merge=internal:prompt |
|
794 | $ hg resolve --all --config ui.merge=internal:prompt | |
795 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u |
|
795 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u | |
796 | [1] |
|
796 | [1] | |
797 | $ aftermerge |
|
797 | $ aftermerge | |
798 | # cat f |
|
798 | # cat f | |
799 | revision 1 |
|
799 | revision 1 | |
800 | space |
|
800 | space | |
801 | # hg stat |
|
801 | # hg stat | |
802 | M f |
|
802 | M f | |
803 | ? f.orig |
|
803 | ? f.orig | |
804 | # hg resolve --list |
|
804 | # hg resolve --list | |
805 | U f |
|
805 | U f | |
806 |
|
806 | |||
807 | ui.merge specifies internal:dump: |
|
807 | ui.merge specifies internal:dump: | |
808 |
|
808 | |||
809 | $ beforemerge |
|
809 | $ beforemerge | |
810 | [merge-tools] |
|
810 | [merge-tools] | |
811 | false.whatever= |
|
811 | false.whatever= | |
812 | true.priority=1 |
|
812 | true.priority=1 | |
813 | true.executable=cat |
|
813 | true.executable=cat | |
814 | # hg update -C 1 |
|
814 | # hg update -C 1 | |
815 | $ hg merge -r 2 --config ui.merge=internal:dump |
|
815 | $ hg merge -r 2 --config ui.merge=internal:dump | |
816 | merging f |
|
816 | merging f | |
817 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
817 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
818 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
818 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
819 | [1] |
|
819 | [1] | |
820 | $ aftermerge |
|
820 | $ aftermerge | |
821 | # cat f |
|
821 | # cat f | |
822 | revision 1 |
|
822 | revision 1 | |
823 | space |
|
823 | space | |
824 | # hg stat |
|
824 | # hg stat | |
825 | M f |
|
825 | M f | |
826 | ? f.base |
|
826 | ? f.base | |
827 | ? f.local |
|
827 | ? f.local | |
828 | ? f.orig |
|
828 | ? f.orig | |
829 | ? f.other |
|
829 | ? f.other | |
830 | # hg resolve --list |
|
830 | # hg resolve --list | |
831 | U f |
|
831 | U f | |
832 |
|
832 | |||
833 | f.base: |
|
833 | f.base: | |
834 |
|
834 | |||
835 | $ cat f.base |
|
835 | $ cat f.base | |
836 | revision 0 |
|
836 | revision 0 | |
837 | space |
|
837 | space | |
838 |
|
838 | |||
839 | f.local: |
|
839 | f.local: | |
840 |
|
840 | |||
841 | $ cat f.local |
|
841 | $ cat f.local | |
842 | revision 1 |
|
842 | revision 1 | |
843 | space |
|
843 | space | |
844 |
|
844 | |||
845 | f.other: |
|
845 | f.other: | |
846 |
|
846 | |||
847 | $ cat f.other |
|
847 | $ cat f.other | |
848 | revision 2 |
|
848 | revision 2 | |
849 | space |
|
849 | space | |
850 | $ rm f.base f.local f.other |
|
850 | $ rm f.base f.local f.other | |
851 |
|
851 | |||
852 | check that internal:dump doesn't dump files if premerge runs |
|
852 | check that internal:dump doesn't dump files if premerge runs | |
853 | successfully |
|
853 | successfully | |
854 |
|
854 | |||
855 | $ beforemerge |
|
855 | $ beforemerge | |
856 | [merge-tools] |
|
856 | [merge-tools] | |
857 | false.whatever= |
|
857 | false.whatever= | |
858 | true.priority=1 |
|
858 | true.priority=1 | |
859 | true.executable=cat |
|
859 | true.executable=cat | |
860 | # hg update -C 1 |
|
860 | # hg update -C 1 | |
861 | $ hg merge -r 3 --config ui.merge=internal:dump |
|
861 | $ hg merge -r 3 --config ui.merge=internal:dump | |
862 | merging f |
|
862 | merging f | |
863 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
863 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
864 | (branch merge, don't forget to commit) |
|
864 | (branch merge, don't forget to commit) | |
865 |
|
865 | |||
866 | $ aftermerge |
|
866 | $ aftermerge | |
867 | # cat f |
|
867 | # cat f | |
868 | revision 1 |
|
868 | revision 1 | |
869 | space |
|
869 | space | |
870 | revision 3 |
|
870 | revision 3 | |
871 | # hg stat |
|
871 | # hg stat | |
872 | M f |
|
872 | M f | |
873 | # hg resolve --list |
|
873 | # hg resolve --list | |
874 | R f |
|
874 | R f | |
875 |
|
875 | |||
876 | check that internal:forcedump dumps files, even if local and other can |
|
876 | check that internal:forcedump dumps files, even if local and other can | |
877 | be merged easily |
|
877 | be merged easily | |
878 |
|
878 | |||
879 | $ beforemerge |
|
879 | $ beforemerge | |
880 | [merge-tools] |
|
880 | [merge-tools] | |
881 | false.whatever= |
|
881 | false.whatever= | |
882 | true.priority=1 |
|
882 | true.priority=1 | |
883 | true.executable=cat |
|
883 | true.executable=cat | |
884 | # hg update -C 1 |
|
884 | # hg update -C 1 | |
885 | $ hg merge -r 3 --config ui.merge=internal:forcedump |
|
885 | $ hg merge -r 3 --config ui.merge=internal:forcedump | |
886 | merging f |
|
886 | merging f | |
887 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
887 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
888 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
888 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
889 | [1] |
|
889 | [1] | |
890 | $ aftermerge |
|
890 | $ aftermerge | |
891 | # cat f |
|
891 | # cat f | |
892 | revision 1 |
|
892 | revision 1 | |
893 | space |
|
893 | space | |
894 | # hg stat |
|
894 | # hg stat | |
895 | M f |
|
895 | M f | |
896 | ? f.base |
|
896 | ? f.base | |
897 | ? f.local |
|
897 | ? f.local | |
898 | ? f.orig |
|
898 | ? f.orig | |
899 | ? f.other |
|
899 | ? f.other | |
900 | # hg resolve --list |
|
900 | # hg resolve --list | |
901 | U f |
|
901 | U f | |
902 |
|
902 | |||
903 | $ cat f.base |
|
903 | $ cat f.base | |
904 | revision 0 |
|
904 | revision 0 | |
905 | space |
|
905 | space | |
906 |
|
906 | |||
907 | $ cat f.local |
|
907 | $ cat f.local | |
908 | revision 1 |
|
908 | revision 1 | |
909 | space |
|
909 | space | |
910 |
|
910 | |||
911 | $ cat f.other |
|
911 | $ cat f.other | |
912 | revision 0 |
|
912 | revision 0 | |
913 | space |
|
913 | space | |
914 | revision 3 |
|
914 | revision 3 | |
915 |
|
915 | |||
916 | $ rm -f f.base f.local f.other |
|
916 | $ rm -f f.base f.local f.other | |
917 |
|
917 | |||
918 | ui.merge specifies internal:other but is overruled by pattern for false: |
|
918 | ui.merge specifies internal:other but is overruled by pattern for false: | |
919 |
|
919 | |||
920 | $ beforemerge |
|
920 | $ beforemerge | |
921 | [merge-tools] |
|
921 | [merge-tools] | |
922 | false.whatever= |
|
922 | false.whatever= | |
923 | true.priority=1 |
|
923 | true.priority=1 | |
924 | true.executable=cat |
|
924 | true.executable=cat | |
925 | # hg update -C 1 |
|
925 | # hg update -C 1 | |
926 | $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
|
926 | $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false | |
927 | merging f |
|
927 | merging f | |
928 | merging f failed! |
|
928 | merging f failed! | |
929 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
929 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
930 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
930 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
931 | [1] |
|
931 | [1] | |
932 | $ aftermerge |
|
932 | $ aftermerge | |
933 | # cat f |
|
933 | # cat f | |
934 | revision 1 |
|
934 | revision 1 | |
935 | space |
|
935 | space | |
936 | # hg stat |
|
936 | # hg stat | |
937 | M f |
|
937 | M f | |
938 | ? f.orig |
|
938 | ? f.orig | |
939 | # hg resolve --list |
|
939 | # hg resolve --list | |
940 | U f |
|
940 | U f | |
941 |
|
941 | |||
942 | Premerge |
|
942 | Premerge | |
943 |
|
943 | |||
944 | ui.merge specifies internal:other but is overruled by --tool=false |
|
944 | ui.merge specifies internal:other but is overruled by --tool=false | |
945 |
|
945 | |||
946 | $ beforemerge |
|
946 | $ beforemerge | |
947 | [merge-tools] |
|
947 | [merge-tools] | |
948 | false.whatever= |
|
948 | false.whatever= | |
949 | true.priority=1 |
|
949 | true.priority=1 | |
950 | true.executable=cat |
|
950 | true.executable=cat | |
951 | # hg update -C 1 |
|
951 | # hg update -C 1 | |
952 | $ hg merge -r 2 --config ui.merge=internal:other --tool=false |
|
952 | $ hg merge -r 2 --config ui.merge=internal:other --tool=false | |
953 | merging f |
|
953 | merging f | |
954 | merging f failed! |
|
954 | merging f failed! | |
955 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
955 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
956 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
956 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
957 | [1] |
|
957 | [1] | |
958 | $ aftermerge |
|
958 | $ aftermerge | |
959 | # cat f |
|
959 | # cat f | |
960 | revision 1 |
|
960 | revision 1 | |
961 | space |
|
961 | space | |
962 | # hg stat |
|
962 | # hg stat | |
963 | M f |
|
963 | M f | |
964 | ? f.orig |
|
964 | ? f.orig | |
965 | # hg resolve --list |
|
965 | # hg resolve --list | |
966 | U f |
|
966 | U f | |
967 |
|
967 | |||
968 | HGMERGE specifies internal:other but is overruled by --tool=false |
|
968 | HGMERGE specifies internal:other but is overruled by --tool=false | |
969 |
|
969 | |||
970 | $ HGMERGE=internal:other ; export HGMERGE |
|
970 | $ HGMERGE=internal:other ; export HGMERGE | |
971 | $ beforemerge |
|
971 | $ beforemerge | |
972 | [merge-tools] |
|
972 | [merge-tools] | |
973 | false.whatever= |
|
973 | false.whatever= | |
974 | true.priority=1 |
|
974 | true.priority=1 | |
975 | true.executable=cat |
|
975 | true.executable=cat | |
976 | # hg update -C 1 |
|
976 | # hg update -C 1 | |
977 | $ hg merge -r 2 --tool=false |
|
977 | $ hg merge -r 2 --tool=false | |
978 | merging f |
|
978 | merging f | |
979 | merging f failed! |
|
979 | merging f failed! | |
980 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
980 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
981 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
981 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
982 | [1] |
|
982 | [1] | |
983 | $ aftermerge |
|
983 | $ aftermerge | |
984 | # cat f |
|
984 | # cat f | |
985 | revision 1 |
|
985 | revision 1 | |
986 | space |
|
986 | space | |
987 | # hg stat |
|
987 | # hg stat | |
988 | M f |
|
988 | M f | |
989 | ? f.orig |
|
989 | ? f.orig | |
990 | # hg resolve --list |
|
990 | # hg resolve --list | |
991 | U f |
|
991 | U f | |
992 |
|
992 | |||
993 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests |
|
993 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests | |
994 |
|
994 | |||
995 | update is a merge ... |
|
995 | update is a merge ... | |
996 |
|
996 | |||
997 | (this also tests that files reverted with '--rev REV' are treated as |
|
997 | (this also tests that files reverted with '--rev REV' are treated as | |
998 | "modified", even if none of mode, size and timestamp of them isn't |
|
998 | "modified", even if none of mode, size and timestamp of them isn't | |
999 | changed on the filesystem (see also issue4583)) |
|
999 | changed on the filesystem (see also issue4583)) | |
1000 |
|
1000 | |||
1001 | $ cat >> $HGRCPATH <<EOF |
|
1001 | $ cat >> $HGRCPATH <<EOF | |
1002 | > [fakedirstatewritetime] |
|
1002 | > [fakedirstatewritetime] | |
1003 | > # emulate invoking dirstate.write() via repo.status() |
|
1003 | > # emulate invoking dirstate.write() via repo.status() | |
1004 | > # at 2000-01-01 00:00 |
|
1004 | > # at 2000-01-01 00:00 | |
1005 | > fakenow = 200001010000 |
|
1005 | > fakenow = 200001010000 | |
1006 | > EOF |
|
1006 | > EOF | |
1007 |
|
1007 | |||
1008 | $ beforemerge |
|
1008 | $ beforemerge | |
1009 | [merge-tools] |
|
1009 | [merge-tools] | |
1010 | false.whatever= |
|
1010 | false.whatever= | |
1011 | true.priority=1 |
|
1011 | true.priority=1 | |
1012 | true.executable=cat |
|
1012 | true.executable=cat | |
1013 | # hg update -C 1 |
|
1013 | # hg update -C 1 | |
1014 | $ hg update -q 0 |
|
1014 | $ hg update -q 0 | |
1015 | $ f -s f |
|
1015 | $ f -s f | |
1016 | f: size=17 |
|
1016 | f: size=17 | |
1017 | $ touch -t 200001010000 f |
|
1017 | $ touch -t 200001010000 f | |
1018 | $ hg debugrebuildstate |
|
1018 | $ hg debugrebuildstate | |
1019 | $ cat >> $HGRCPATH <<EOF |
|
1019 | $ cat >> $HGRCPATH <<EOF | |
1020 | > [extensions] |
|
1020 | > [extensions] | |
1021 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
1021 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
1022 | > EOF |
|
1022 | > EOF | |
1023 | $ hg revert -q -r 1 . |
|
1023 | $ hg revert -q -r 1 . | |
1024 | $ cat >> $HGRCPATH <<EOF |
|
1024 | $ cat >> $HGRCPATH <<EOF | |
1025 | > [extensions] |
|
1025 | > [extensions] | |
1026 | > fakedirstatewritetime = ! |
|
1026 | > fakedirstatewritetime = ! | |
1027 | > EOF |
|
1027 | > EOF | |
1028 | $ f -s f |
|
1028 | $ f -s f | |
1029 | f: size=17 |
|
1029 | f: size=17 | |
1030 | $ touch -t 200001010000 f |
|
1030 | $ touch -t 200001010000 f | |
1031 | $ hg status f |
|
1031 | $ hg status f | |
1032 | M f |
|
1032 | M f | |
1033 | $ hg update -r 2 |
|
1033 | $ hg update -r 2 | |
1034 | merging f |
|
1034 | merging f | |
1035 | revision 1 |
|
1035 | revision 1 | |
1036 | space |
|
1036 | space | |
1037 | revision 0 |
|
1037 | revision 0 | |
1038 | space |
|
1038 | space | |
1039 | revision 2 |
|
1039 | revision 2 | |
1040 | space |
|
1040 | space | |
1041 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1041 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1042 | $ aftermerge |
|
1042 | $ aftermerge | |
1043 | # cat f |
|
1043 | # cat f | |
1044 | revision 1 |
|
1044 | revision 1 | |
1045 | space |
|
1045 | space | |
1046 | # hg stat |
|
1046 | # hg stat | |
1047 | M f |
|
1047 | M f | |
1048 | # hg resolve --list |
|
1048 | # hg resolve --list | |
1049 | R f |
|
1049 | R f | |
1050 |
|
1050 | |||
1051 | update should also have --tool |
|
1051 | update should also have --tool | |
1052 |
|
1052 | |||
1053 | $ beforemerge |
|
1053 | $ beforemerge | |
1054 | [merge-tools] |
|
1054 | [merge-tools] | |
1055 | false.whatever= |
|
1055 | false.whatever= | |
1056 | true.priority=1 |
|
1056 | true.priority=1 | |
1057 | true.executable=cat |
|
1057 | true.executable=cat | |
1058 | # hg update -C 1 |
|
1058 | # hg update -C 1 | |
1059 | $ hg update -q 0 |
|
1059 | $ hg update -q 0 | |
1060 | $ f -s f |
|
1060 | $ f -s f | |
1061 | f: size=17 |
|
1061 | f: size=17 | |
1062 | $ touch -t 200001010000 f |
|
1062 | $ touch -t 200001010000 f | |
1063 | $ hg debugrebuildstate |
|
1063 | $ hg debugrebuildstate | |
1064 | $ cat >> $HGRCPATH <<EOF |
|
1064 | $ cat >> $HGRCPATH <<EOF | |
1065 | > [extensions] |
|
1065 | > [extensions] | |
1066 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
1066 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
1067 | > EOF |
|
1067 | > EOF | |
1068 | $ hg revert -q -r 1 . |
|
1068 | $ hg revert -q -r 1 . | |
1069 | $ cat >> $HGRCPATH <<EOF |
|
1069 | $ cat >> $HGRCPATH <<EOF | |
1070 | > [extensions] |
|
1070 | > [extensions] | |
1071 | > fakedirstatewritetime = ! |
|
1071 | > fakedirstatewritetime = ! | |
1072 | > EOF |
|
1072 | > EOF | |
1073 | $ f -s f |
|
1073 | $ f -s f | |
1074 | f: size=17 |
|
1074 | f: size=17 | |
1075 | $ touch -t 200001010000 f |
|
1075 | $ touch -t 200001010000 f | |
1076 | $ hg status f |
|
1076 | $ hg status f | |
1077 | M f |
|
1077 | M f | |
1078 | $ hg update -r 2 --tool false |
|
1078 | $ hg update -r 2 --tool false | |
1079 | merging f |
|
1079 | merging f | |
1080 | merging f failed! |
|
1080 | merging f failed! | |
1081 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1081 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1082 | use 'hg resolve' to retry unresolved file merges |
|
1082 | use 'hg resolve' to retry unresolved file merges | |
1083 | [1] |
|
1083 | [1] | |
1084 | $ aftermerge |
|
1084 | $ aftermerge | |
1085 | # cat f |
|
1085 | # cat f | |
1086 | revision 1 |
|
1086 | revision 1 | |
1087 | space |
|
1087 | space | |
1088 | # hg stat |
|
1088 | # hg stat | |
1089 | M f |
|
1089 | M f | |
1090 | ? f.orig |
|
1090 | ? f.orig | |
1091 | # hg resolve --list |
|
1091 | # hg resolve --list | |
1092 | U f |
|
1092 | U f | |
1093 |
|
1093 | |||
1094 | Default is silent simplemerge: |
|
1094 | Default is silent simplemerge: | |
1095 |
|
1095 | |||
1096 | $ beforemerge |
|
1096 | $ beforemerge | |
1097 | [merge-tools] |
|
1097 | [merge-tools] | |
1098 | false.whatever= |
|
1098 | false.whatever= | |
1099 | true.priority=1 |
|
1099 | true.priority=1 | |
1100 | true.executable=cat |
|
1100 | true.executable=cat | |
1101 | # hg update -C 1 |
|
1101 | # hg update -C 1 | |
1102 | $ hg merge -r 3 |
|
1102 | $ hg merge -r 3 | |
1103 | merging f |
|
1103 | merging f | |
1104 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1104 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1105 | (branch merge, don't forget to commit) |
|
1105 | (branch merge, don't forget to commit) | |
1106 | $ aftermerge |
|
1106 | $ aftermerge | |
1107 | # cat f |
|
1107 | # cat f | |
1108 | revision 1 |
|
1108 | revision 1 | |
1109 | space |
|
1109 | space | |
1110 | revision 3 |
|
1110 | revision 3 | |
1111 | # hg stat |
|
1111 | # hg stat | |
1112 | M f |
|
1112 | M f | |
1113 | # hg resolve --list |
|
1113 | # hg resolve --list | |
1114 | R f |
|
1114 | R f | |
1115 |
|
1115 | |||
1116 | .premerge=True is same: |
|
1116 | .premerge=True is same: | |
1117 |
|
1117 | |||
1118 | $ beforemerge |
|
1118 | $ beforemerge | |
1119 | [merge-tools] |
|
1119 | [merge-tools] | |
1120 | false.whatever= |
|
1120 | false.whatever= | |
1121 | true.priority=1 |
|
1121 | true.priority=1 | |
1122 | true.executable=cat |
|
1122 | true.executable=cat | |
1123 | # hg update -C 1 |
|
1123 | # hg update -C 1 | |
1124 | $ hg merge -r 3 --config merge-tools.true.premerge=True |
|
1124 | $ hg merge -r 3 --config merge-tools.true.premerge=True | |
1125 | merging f |
|
1125 | merging f | |
1126 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1126 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1127 | (branch merge, don't forget to commit) |
|
1127 | (branch merge, don't forget to commit) | |
1128 | $ aftermerge |
|
1128 | $ aftermerge | |
1129 | # cat f |
|
1129 | # cat f | |
1130 | revision 1 |
|
1130 | revision 1 | |
1131 | space |
|
1131 | space | |
1132 | revision 3 |
|
1132 | revision 3 | |
1133 | # hg stat |
|
1133 | # hg stat | |
1134 | M f |
|
1134 | M f | |
1135 | # hg resolve --list |
|
1135 | # hg resolve --list | |
1136 | R f |
|
1136 | R f | |
1137 |
|
1137 | |||
1138 | .premerge=False executes merge-tool: |
|
1138 | .premerge=False executes merge-tool: | |
1139 |
|
1139 | |||
1140 | $ beforemerge |
|
1140 | $ beforemerge | |
1141 | [merge-tools] |
|
1141 | [merge-tools] | |
1142 | false.whatever= |
|
1142 | false.whatever= | |
1143 | true.priority=1 |
|
1143 | true.priority=1 | |
1144 | true.executable=cat |
|
1144 | true.executable=cat | |
1145 | # hg update -C 1 |
|
1145 | # hg update -C 1 | |
1146 | $ hg merge -r 3 --config merge-tools.true.premerge=False |
|
1146 | $ hg merge -r 3 --config merge-tools.true.premerge=False | |
1147 | merging f |
|
1147 | merging f | |
1148 | revision 1 |
|
1148 | revision 1 | |
1149 | space |
|
1149 | space | |
1150 | revision 0 |
|
1150 | revision 0 | |
1151 | space |
|
1151 | space | |
1152 | revision 0 |
|
1152 | revision 0 | |
1153 | space |
|
1153 | space | |
1154 | revision 3 |
|
1154 | revision 3 | |
1155 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1155 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1156 | (branch merge, don't forget to commit) |
|
1156 | (branch merge, don't forget to commit) | |
1157 | $ aftermerge |
|
1157 | $ aftermerge | |
1158 | # cat f |
|
1158 | # cat f | |
1159 | revision 1 |
|
1159 | revision 1 | |
1160 | space |
|
1160 | space | |
1161 | # hg stat |
|
1161 | # hg stat | |
1162 | M f |
|
1162 | M f | |
1163 | # hg resolve --list |
|
1163 | # hg resolve --list | |
1164 | R f |
|
1164 | R f | |
1165 |
|
1165 | |||
1166 | premerge=keep keeps conflict markers in: |
|
1166 | premerge=keep keeps conflict markers in: | |
1167 |
|
1167 | |||
1168 | $ beforemerge |
|
1168 | $ beforemerge | |
1169 | [merge-tools] |
|
1169 | [merge-tools] | |
1170 | false.whatever= |
|
1170 | false.whatever= | |
1171 | true.priority=1 |
|
1171 | true.priority=1 | |
1172 | true.executable=cat |
|
1172 | true.executable=cat | |
1173 | # hg update -C 1 |
|
1173 | # hg update -C 1 | |
1174 | $ hg merge -r 4 --config merge-tools.true.premerge=keep |
|
1174 | $ hg merge -r 4 --config merge-tools.true.premerge=keep | |
1175 | merging f |
|
1175 | merging f | |
1176 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1176 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1177 | revision 1 |
|
1177 | revision 1 | |
1178 | space |
|
1178 | space | |
1179 | ======= |
|
1179 | ======= | |
1180 | revision 4 |
|
1180 | revision 4 | |
1181 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1181 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1182 | revision 0 |
|
1182 | revision 0 | |
1183 | space |
|
1183 | space | |
1184 | revision 4 |
|
1184 | revision 4 | |
1185 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1185 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1186 | (branch merge, don't forget to commit) |
|
1186 | (branch merge, don't forget to commit) | |
1187 | $ aftermerge |
|
1187 | $ aftermerge | |
1188 | # cat f |
|
1188 | # cat f | |
1189 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1189 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1190 | revision 1 |
|
1190 | revision 1 | |
1191 | space |
|
1191 | space | |
1192 | ======= |
|
1192 | ======= | |
1193 | revision 4 |
|
1193 | revision 4 | |
1194 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1194 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1195 | # hg stat |
|
1195 | # hg stat | |
1196 | M f |
|
1196 | M f | |
1197 | # hg resolve --list |
|
1197 | # hg resolve --list | |
1198 | R f |
|
1198 | R f | |
1199 |
|
1199 | |||
1200 | premerge=keep-merge3 keeps conflict markers with base content: |
|
1200 | premerge=keep-merge3 keeps conflict markers with base content: | |
1201 |
|
1201 | |||
1202 | $ beforemerge |
|
1202 | $ beforemerge | |
1203 | [merge-tools] |
|
1203 | [merge-tools] | |
1204 | false.whatever= |
|
1204 | false.whatever= | |
1205 | true.priority=1 |
|
1205 | true.priority=1 | |
1206 | true.executable=cat |
|
1206 | true.executable=cat | |
1207 | # hg update -C 1 |
|
1207 | # hg update -C 1 | |
1208 | $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3 |
|
1208 | $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3 | |
1209 | merging f |
|
1209 | merging f | |
1210 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1210 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1211 | revision 1 |
|
1211 | revision 1 | |
1212 | space |
|
1212 | space | |
1213 | ||||||| base |
|
1213 | ||||||| base | |
1214 | revision 0 |
|
1214 | revision 0 | |
1215 | space |
|
1215 | space | |
1216 | ======= |
|
1216 | ======= | |
1217 | revision 4 |
|
1217 | revision 4 | |
1218 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1218 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1219 | revision 0 |
|
1219 | revision 0 | |
1220 | space |
|
1220 | space | |
1221 | revision 4 |
|
1221 | revision 4 | |
1222 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1222 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1223 | (branch merge, don't forget to commit) |
|
1223 | (branch merge, don't forget to commit) | |
1224 | $ aftermerge |
|
1224 | $ aftermerge | |
1225 | # cat f |
|
1225 | # cat f | |
1226 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1226 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1227 | revision 1 |
|
1227 | revision 1 | |
1228 | space |
|
1228 | space | |
1229 | ||||||| base |
|
1229 | ||||||| base | |
1230 | revision 0 |
|
1230 | revision 0 | |
1231 | space |
|
1231 | space | |
1232 | ======= |
|
1232 | ======= | |
1233 | revision 4 |
|
1233 | revision 4 | |
1234 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1234 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1235 | # hg stat |
|
1235 | # hg stat | |
1236 | M f |
|
1236 | M f | |
1237 | # hg resolve --list |
|
1237 | # hg resolve --list | |
1238 | R f |
|
1238 | R f | |
1239 |
|
1239 | |||
1240 | premerge=keep respects ui.mergemarkers=basic: |
|
1240 | premerge=keep respects ui.mergemarkers=basic: | |
1241 |
|
1241 | |||
1242 | $ beforemerge |
|
1242 | $ beforemerge | |
1243 | [merge-tools] |
|
1243 | [merge-tools] | |
1244 | false.whatever= |
|
1244 | false.whatever= | |
1245 | true.priority=1 |
|
1245 | true.priority=1 | |
1246 | true.executable=cat |
|
1246 | true.executable=cat | |
1247 | # hg update -C 1 |
|
1247 | # hg update -C 1 | |
1248 | $ hg merge -r 4 --config merge-tools.true.premerge=keep --config ui.mergemarkers=basic |
|
1248 | $ hg merge -r 4 --config merge-tools.true.premerge=keep --config ui.mergemarkers=basic | |
1249 | merging f |
|
1249 | merging f | |
1250 | <<<<<<< working copy |
|
1250 | <<<<<<< working copy | |
1251 | revision 1 |
|
1251 | revision 1 | |
1252 | space |
|
1252 | space | |
1253 | ======= |
|
1253 | ======= | |
1254 | revision 4 |
|
1254 | revision 4 | |
1255 | >>>>>>> merge rev |
|
1255 | >>>>>>> merge rev | |
1256 | revision 0 |
|
1256 | revision 0 | |
1257 | space |
|
1257 | space | |
1258 | revision 4 |
|
1258 | revision 4 | |
1259 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1259 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1260 | (branch merge, don't forget to commit) |
|
1260 | (branch merge, don't forget to commit) | |
1261 | $ aftermerge |
|
1261 | $ aftermerge | |
1262 | # cat f |
|
1262 | # cat f | |
1263 | <<<<<<< working copy |
|
1263 | <<<<<<< working copy | |
1264 | revision 1 |
|
1264 | revision 1 | |
1265 | space |
|
1265 | space | |
1266 | ======= |
|
1266 | ======= | |
1267 | revision 4 |
|
1267 | revision 4 | |
1268 | >>>>>>> merge rev |
|
1268 | >>>>>>> merge rev | |
1269 | # hg stat |
|
1269 | # hg stat | |
1270 | M f |
|
1270 | M f | |
1271 | # hg resolve --list |
|
1271 | # hg resolve --list | |
1272 | R f |
|
1272 | R f | |
1273 |
|
1273 | |||
1274 | premerge=keep ignores ui.mergemarkers=basic if true.mergemarkers=detailed: |
|
1274 | premerge=keep ignores ui.mergemarkers=basic if true.mergemarkers=detailed: | |
1275 |
|
1275 | |||
1276 | $ beforemerge |
|
1276 | $ beforemerge | |
1277 | [merge-tools] |
|
1277 | [merge-tools] | |
1278 | false.whatever= |
|
1278 | false.whatever= | |
1279 | true.priority=1 |
|
1279 | true.priority=1 | |
1280 | true.executable=cat |
|
1280 | true.executable=cat | |
1281 | # hg update -C 1 |
|
1281 | # hg update -C 1 | |
1282 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ |
|
1282 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ | |
1283 | > --config ui.mergemarkers=basic \ |
|
1283 | > --config ui.mergemarkers=basic \ | |
1284 | > --config merge-tools.true.mergemarkers=detailed |
|
1284 | > --config merge-tools.true.mergemarkers=detailed | |
1285 | merging f |
|
1285 | merging f | |
1286 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1286 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1287 | revision 1 |
|
1287 | revision 1 | |
1288 | space |
|
1288 | space | |
1289 | ======= |
|
1289 | ======= | |
1290 | revision 4 |
|
1290 | revision 4 | |
1291 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1291 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1292 | revision 0 |
|
1292 | revision 0 | |
1293 | space |
|
1293 | space | |
1294 | revision 4 |
|
1294 | revision 4 | |
1295 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1295 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1296 | (branch merge, don't forget to commit) |
|
1296 | (branch merge, don't forget to commit) | |
1297 | $ aftermerge |
|
1297 | $ aftermerge | |
1298 | # cat f |
|
1298 | # cat f | |
1299 | <<<<<<< working copy: ef83787e2614 - test: revision 1 |
|
1299 | <<<<<<< working copy: ef83787e2614 - test: revision 1 | |
1300 | revision 1 |
|
1300 | revision 1 | |
1301 | space |
|
1301 | space | |
1302 | ======= |
|
1302 | ======= | |
1303 | revision 4 |
|
1303 | revision 4 | |
1304 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 |
|
1304 | >>>>>>> merge rev: 81448d39c9a0 - test: revision 4 | |
1305 | # hg stat |
|
1305 | # hg stat | |
1306 | M f |
|
1306 | M f | |
1307 | # hg resolve --list |
|
1307 | # hg resolve --list | |
1308 | R f |
|
1308 | R f | |
1309 |
|
1309 | |||
1310 | premerge=keep respects ui.mergemarkertemplate instead of |
|
1310 | premerge=keep respects ui.mergemarkertemplate instead of | |
1311 | true.mergemarkertemplate if true.mergemarkers=basic: |
|
1311 | true.mergemarkertemplate if true.mergemarkers=basic: | |
1312 |
|
1312 | |||
1313 | $ beforemerge |
|
1313 | $ beforemerge | |
1314 | [merge-tools] |
|
1314 | [merge-tools] | |
1315 | false.whatever= |
|
1315 | false.whatever= | |
1316 | true.priority=1 |
|
1316 | true.priority=1 | |
1317 | true.executable=cat |
|
1317 | true.executable=cat | |
1318 | # hg update -C 1 |
|
1318 | # hg update -C 1 | |
1319 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ |
|
1319 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ | |
1320 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1320 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1321 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' |
|
1321 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' | |
1322 | merging f |
|
1322 | merging f | |
1323 | <<<<<<< working copy: uitmpl 1 |
|
1323 | <<<<<<< working copy: uitmpl 1 | |
1324 | revision 1 |
|
1324 | revision 1 | |
1325 | space |
|
1325 | space | |
1326 | ======= |
|
1326 | ======= | |
1327 | revision 4 |
|
1327 | revision 4 | |
1328 | >>>>>>> merge rev: uitmpl 4 |
|
1328 | >>>>>>> merge rev: uitmpl 4 | |
1329 | revision 0 |
|
1329 | revision 0 | |
1330 | space |
|
1330 | space | |
1331 | revision 4 |
|
1331 | revision 4 | |
1332 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1332 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1333 | (branch merge, don't forget to commit) |
|
1333 | (branch merge, don't forget to commit) | |
1334 | $ aftermerge |
|
1334 | $ aftermerge | |
1335 | # cat f |
|
1335 | # cat f | |
1336 | <<<<<<< working copy: uitmpl 1 |
|
1336 | <<<<<<< working copy: uitmpl 1 | |
1337 | revision 1 |
|
1337 | revision 1 | |
1338 | space |
|
1338 | space | |
1339 | ======= |
|
1339 | ======= | |
1340 | revision 4 |
|
1340 | revision 4 | |
1341 | >>>>>>> merge rev: uitmpl 4 |
|
1341 | >>>>>>> merge rev: uitmpl 4 | |
1342 | # hg stat |
|
1342 | # hg stat | |
1343 | M f |
|
1343 | M f | |
1344 | # hg resolve --list |
|
1344 | # hg resolve --list | |
1345 | R f |
|
1345 | R f | |
1346 |
|
1346 | |||
1347 | premerge=keep respects true.mergemarkertemplate instead of |
|
1347 | premerge=keep respects true.mergemarkertemplate instead of | |
1348 | true.mergemarkertemplate if true.mergemarkers=detailed: |
|
1348 | true.mergemarkertemplate if true.mergemarkers=detailed: | |
1349 |
|
1349 | |||
1350 | $ beforemerge |
|
1350 | $ beforemerge | |
1351 | [merge-tools] |
|
1351 | [merge-tools] | |
1352 | false.whatever= |
|
1352 | false.whatever= | |
1353 | true.priority=1 |
|
1353 | true.priority=1 | |
1354 | true.executable=cat |
|
1354 | true.executable=cat | |
1355 | # hg update -C 1 |
|
1355 | # hg update -C 1 | |
1356 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ |
|
1356 | $ hg merge -r 4 --config merge-tools.true.premerge=keep \ | |
1357 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1357 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1358 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1358 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1359 | > --config merge-tools.true.mergemarkers=detailed |
|
1359 | > --config merge-tools.true.mergemarkers=detailed | |
1360 | merging f |
|
1360 | merging f | |
1361 | <<<<<<< working copy: tooltmpl ef83787e2614 |
|
1361 | <<<<<<< working copy: tooltmpl ef83787e2614 | |
1362 | revision 1 |
|
1362 | revision 1 | |
1363 | space |
|
1363 | space | |
1364 | ======= |
|
1364 | ======= | |
1365 | revision 4 |
|
1365 | revision 4 | |
1366 | >>>>>>> merge rev: tooltmpl 81448d39c9a0 |
|
1366 | >>>>>>> merge rev: tooltmpl 81448d39c9a0 | |
1367 | revision 0 |
|
1367 | revision 0 | |
1368 | space |
|
1368 | space | |
1369 | revision 4 |
|
1369 | revision 4 | |
1370 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1370 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1371 | (branch merge, don't forget to commit) |
|
1371 | (branch merge, don't forget to commit) | |
1372 | $ aftermerge |
|
1372 | $ aftermerge | |
1373 | # cat f |
|
1373 | # cat f | |
1374 | <<<<<<< working copy: tooltmpl ef83787e2614 |
|
1374 | <<<<<<< working copy: tooltmpl ef83787e2614 | |
1375 | revision 1 |
|
1375 | revision 1 | |
1376 | space |
|
1376 | space | |
1377 | ======= |
|
1377 | ======= | |
1378 | revision 4 |
|
1378 | revision 4 | |
1379 | >>>>>>> merge rev: tooltmpl 81448d39c9a0 |
|
1379 | >>>>>>> merge rev: tooltmpl 81448d39c9a0 | |
1380 | # hg stat |
|
1380 | # hg stat | |
1381 | M f |
|
1381 | M f | |
1382 | # hg resolve --list |
|
1382 | # hg resolve --list | |
1383 | R f |
|
1383 | R f | |
1384 |
|
1384 | |||
1385 | Tool execution |
|
1385 | Tool execution | |
1386 |
|
1386 | |||
1387 | set tools.args explicit to include $base $local $other $output: |
|
1387 | set tools.args explicit to include $base $local $other $output: | |
1388 |
|
1388 | |||
1389 | $ beforemerge |
|
1389 | $ beforemerge | |
1390 | [merge-tools] |
|
1390 | [merge-tools] | |
1391 | false.whatever= |
|
1391 | false.whatever= | |
1392 | true.priority=1 |
|
1392 | true.priority=1 | |
1393 | true.executable=cat |
|
1393 | true.executable=cat | |
1394 | # hg update -C 1 |
|
1394 | # hg update -C 1 | |
1395 | $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \ |
|
1395 | $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \ | |
1396 | > | sed 's,==> .* <==,==> ... <==,g' |
|
1396 | > | sed 's,==> .* <==,==> ... <==,g' | |
1397 | merging f |
|
1397 | merging f | |
1398 | ==> ... <== |
|
1398 | ==> ... <== | |
1399 | revision 0 |
|
1399 | revision 0 | |
1400 | space |
|
1400 | space | |
1401 |
|
1401 | |||
1402 | ==> ... <== |
|
1402 | ==> ... <== | |
1403 | revision 1 |
|
1403 | revision 1 | |
1404 | space |
|
1404 | space | |
1405 |
|
1405 | |||
1406 | ==> ... <== |
|
1406 | ==> ... <== | |
1407 | revision 2 |
|
1407 | revision 2 | |
1408 | space |
|
1408 | space | |
1409 |
|
1409 | |||
1410 | ==> ... <== |
|
1410 | ==> ... <== | |
1411 | revision 1 |
|
1411 | revision 1 | |
1412 | space |
|
1412 | space | |
1413 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1413 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1414 | (branch merge, don't forget to commit) |
|
1414 | (branch merge, don't forget to commit) | |
1415 | $ aftermerge |
|
1415 | $ aftermerge | |
1416 | # cat f |
|
1416 | # cat f | |
1417 | revision 1 |
|
1417 | revision 1 | |
1418 | space |
|
1418 | space | |
1419 | # hg stat |
|
1419 | # hg stat | |
1420 | M f |
|
1420 | M f | |
1421 | # hg resolve --list |
|
1421 | # hg resolve --list | |
1422 | R f |
|
1422 | R f | |
1423 |
|
1423 | |||
1424 | Merge with "echo mergeresult > $local": |
|
1424 | Merge with "echo mergeresult > $local": | |
1425 |
|
1425 | |||
1426 | $ beforemerge |
|
1426 | $ beforemerge | |
1427 | [merge-tools] |
|
1427 | [merge-tools] | |
1428 | false.whatever= |
|
1428 | false.whatever= | |
1429 | true.priority=1 |
|
1429 | true.priority=1 | |
1430 | true.executable=cat |
|
1430 | true.executable=cat | |
1431 | # hg update -C 1 |
|
1431 | # hg update -C 1 | |
1432 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local' |
|
1432 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local' | |
1433 | merging f |
|
1433 | merging f | |
1434 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1434 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1435 | (branch merge, don't forget to commit) |
|
1435 | (branch merge, don't forget to commit) | |
1436 | $ aftermerge |
|
1436 | $ aftermerge | |
1437 | # cat f |
|
1437 | # cat f | |
1438 | mergeresult |
|
1438 | mergeresult | |
1439 | # hg stat |
|
1439 | # hg stat | |
1440 | M f |
|
1440 | M f | |
1441 | # hg resolve --list |
|
1441 | # hg resolve --list | |
1442 | R f |
|
1442 | R f | |
1443 |
|
1443 | |||
1444 | - and $local is the file f: |
|
1444 | - and $local is the file f: | |
1445 |
|
1445 | |||
1446 | $ beforemerge |
|
1446 | $ beforemerge | |
1447 | [merge-tools] |
|
1447 | [merge-tools] | |
1448 | false.whatever= |
|
1448 | false.whatever= | |
1449 | true.priority=1 |
|
1449 | true.priority=1 | |
1450 | true.executable=cat |
|
1450 | true.executable=cat | |
1451 | # hg update -C 1 |
|
1451 | # hg update -C 1 | |
1452 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f' |
|
1452 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f' | |
1453 | merging f |
|
1453 | merging f | |
1454 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1454 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1455 | (branch merge, don't forget to commit) |
|
1455 | (branch merge, don't forget to commit) | |
1456 | $ aftermerge |
|
1456 | $ aftermerge | |
1457 | # cat f |
|
1457 | # cat f | |
1458 | mergeresult |
|
1458 | mergeresult | |
1459 | # hg stat |
|
1459 | # hg stat | |
1460 | M f |
|
1460 | M f | |
1461 | # hg resolve --list |
|
1461 | # hg resolve --list | |
1462 | R f |
|
1462 | R f | |
1463 |
|
1463 | |||
1464 | Merge with "echo mergeresult > $output" - the variable is a bit magic: |
|
1464 | Merge with "echo mergeresult > $output" - the variable is a bit magic: | |
1465 |
|
1465 | |||
1466 | $ beforemerge |
|
1466 | $ beforemerge | |
1467 | [merge-tools] |
|
1467 | [merge-tools] | |
1468 | false.whatever= |
|
1468 | false.whatever= | |
1469 | true.priority=1 |
|
1469 | true.priority=1 | |
1470 | true.executable=cat |
|
1470 | true.executable=cat | |
1471 | # hg update -C 1 |
|
1471 | # hg update -C 1 | |
1472 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output' |
|
1472 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output' | |
1473 | merging f |
|
1473 | merging f | |
1474 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1474 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1475 | (branch merge, don't forget to commit) |
|
1475 | (branch merge, don't forget to commit) | |
1476 | $ aftermerge |
|
1476 | $ aftermerge | |
1477 | # cat f |
|
1477 | # cat f | |
1478 | mergeresult |
|
1478 | mergeresult | |
1479 | # hg stat |
|
1479 | # hg stat | |
1480 | M f |
|
1480 | M f | |
1481 | # hg resolve --list |
|
1481 | # hg resolve --list | |
1482 | R f |
|
1482 | R f | |
1483 |
|
1483 | |||
1484 | Merge using tool with a path that must be quoted: |
|
1484 | Merge using tool with a path that must be quoted: | |
1485 |
|
1485 | |||
1486 | $ beforemerge |
|
1486 | $ beforemerge | |
1487 | [merge-tools] |
|
1487 | [merge-tools] | |
1488 | false.whatever= |
|
1488 | false.whatever= | |
1489 | true.priority=1 |
|
1489 | true.priority=1 | |
1490 | true.executable=cat |
|
1490 | true.executable=cat | |
1491 | # hg update -C 1 |
|
1491 | # hg update -C 1 | |
1492 | $ cat <<EOF > 'my merge tool' |
|
1492 | $ cat <<EOF > 'my merge tool' | |
1493 | > cat "\$1" "\$2" "\$3" > "\$4" |
|
1493 | > cat "\$1" "\$2" "\$3" > "\$4" | |
1494 | > EOF |
|
1494 | > EOF | |
1495 | $ hg --config merge-tools.true.executable='sh' \ |
|
1495 | $ hg --config merge-tools.true.executable='sh' \ | |
1496 | > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \ |
|
1496 | > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \ | |
1497 | > merge -r 2 |
|
1497 | > merge -r 2 | |
1498 | merging f |
|
1498 | merging f | |
1499 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1499 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1500 | (branch merge, don't forget to commit) |
|
1500 | (branch merge, don't forget to commit) | |
1501 | $ rm -f 'my merge tool' |
|
1501 | $ rm -f 'my merge tool' | |
1502 | $ aftermerge |
|
1502 | $ aftermerge | |
1503 | # cat f |
|
1503 | # cat f | |
1504 | revision 0 |
|
1504 | revision 0 | |
1505 | space |
|
1505 | space | |
1506 | revision 1 |
|
1506 | revision 1 | |
1507 | space |
|
1507 | space | |
1508 | revision 2 |
|
1508 | revision 2 | |
1509 | space |
|
1509 | space | |
1510 | # hg stat |
|
1510 | # hg stat | |
1511 | M f |
|
1511 | M f | |
1512 | # hg resolve --list |
|
1512 | # hg resolve --list | |
1513 | R f |
|
1513 | R f | |
1514 |
|
1514 | |||
1515 | Merge using a tool that supports labellocal, labelother, and labelbase, checking |
|
1515 | Merge using a tool that supports labellocal, labelother, and labelbase, checking | |
1516 | that they're quoted properly as well. This is using the default 'basic' |
|
1516 | that they're quoted properly as well. This is using the default 'basic' | |
1517 | mergemarkers even though ui.mergemarkers is 'detailed', so it's ignoring both |
|
1517 | mergemarkers even though ui.mergemarkers is 'detailed', so it's ignoring both | |
1518 | mergemarkertemplate settings: |
|
1518 | mergemarkertemplate settings: | |
1519 |
|
1519 | |||
1520 | $ beforemerge |
|
1520 | $ beforemerge | |
1521 | [merge-tools] |
|
1521 | [merge-tools] | |
1522 | false.whatever= |
|
1522 | false.whatever= | |
1523 | true.priority=1 |
|
1523 | true.priority=1 | |
1524 | true.executable=cat |
|
1524 | true.executable=cat | |
1525 | # hg update -C 1 |
|
1525 | # hg update -C 1 | |
1526 | $ cat <<EOF > printargs_merge_tool |
|
1526 | $ cat <<EOF > printargs_merge_tool | |
1527 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done |
|
1527 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done | |
1528 | > EOF |
|
1528 | > EOF | |
1529 | $ hg --config merge-tools.true.executable='sh' \ |
|
1529 | $ hg --config merge-tools.true.executable='sh' \ | |
1530 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ |
|
1530 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ | |
1531 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1531 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1532 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1532 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1533 | > --config ui.mergemarkers=detailed \ |
|
1533 | > --config ui.mergemarkers=detailed \ | |
1534 | > merge -r 2 |
|
1534 | > merge -r 2 | |
1535 | merging f |
|
1535 | merging f | |
1536 | arg: "ll:working copy" |
|
1536 | arg: "ll:working copy" | |
1537 | arg: "lo:" |
|
1537 | arg: "lo:" | |
1538 | arg: "merge rev" |
|
1538 | arg: "merge rev" | |
1539 | arg: "lb:base: */f~base.*" (glob) |
|
1539 | arg: "lb:base: */f~base.*" (glob) | |
1540 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1540 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1541 | (branch merge, don't forget to commit) |
|
1541 | (branch merge, don't forget to commit) | |
1542 | $ rm -f 'printargs_merge_tool' |
|
1542 | $ rm -f 'printargs_merge_tool' | |
1543 |
|
1543 | |||
1544 | Same test with experimental.mergetempdirprefix set: |
|
1544 | Same test with experimental.mergetempdirprefix set: | |
1545 |
|
1545 | |||
1546 | $ beforemerge |
|
1546 | $ beforemerge | |
1547 | [merge-tools] |
|
1547 | [merge-tools] | |
1548 | false.whatever= |
|
1548 | false.whatever= | |
1549 | true.priority=1 |
|
1549 | true.priority=1 | |
1550 | true.executable=cat |
|
1550 | true.executable=cat | |
1551 | # hg update -C 1 |
|
1551 | # hg update -C 1 | |
1552 | $ cat <<EOF > printargs_merge_tool |
|
1552 | $ cat <<EOF > printargs_merge_tool | |
1553 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done |
|
1553 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done | |
1554 | > EOF |
|
1554 | > EOF | |
1555 | $ hg --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. \ |
|
1555 | $ hg --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. \ | |
1556 | > --config merge-tools.true.executable='sh' \ |
|
1556 | > --config merge-tools.true.executable='sh' \ | |
1557 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ |
|
1557 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ | |
1558 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1558 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1559 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1559 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1560 | > --config ui.mergemarkers=detailed \ |
|
1560 | > --config ui.mergemarkers=detailed \ | |
1561 | > merge -r 2 |
|
1561 | > merge -r 2 | |
1562 | merging f |
|
1562 | merging f | |
1563 | arg: "ll:working copy" |
|
1563 | arg: "ll:working copy" | |
1564 | arg: "lo:" |
|
1564 | arg: "lo:" | |
1565 | arg: "merge rev" |
|
1565 | arg: "merge rev" | |
1566 | arg: "lb:base: */hgmerge.*/f~base" (glob) |
|
1566 | arg: "lb:base: */hgmerge.*/f~base" (glob) | |
1567 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1567 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1568 | (branch merge, don't forget to commit) |
|
1568 | (branch merge, don't forget to commit) | |
1569 | $ rm -f 'printargs_merge_tool' |
|
1569 | $ rm -f 'printargs_merge_tool' | |
1570 |
|
1570 | |||
1571 | Merge using a tool that supports labellocal, labelother, and labelbase, checking |
|
1571 | Merge using a tool that supports labellocal, labelother, and labelbase, checking | |
1572 | that they're quoted properly as well. This is using 'detailed' mergemarkers, |
|
1572 | that they're quoted properly as well. This is using 'detailed' mergemarkers, | |
1573 | even though ui.mergemarkers is 'basic', and using the tool's |
|
1573 | even though ui.mergemarkers is 'basic', and using the tool's | |
1574 | mergemarkertemplate: |
|
1574 | mergemarkertemplate: | |
1575 |
|
1575 | |||
1576 | $ beforemerge |
|
1576 | $ beforemerge | |
1577 | [merge-tools] |
|
1577 | [merge-tools] | |
1578 | false.whatever= |
|
1578 | false.whatever= | |
1579 | true.priority=1 |
|
1579 | true.priority=1 | |
1580 | true.executable=cat |
|
1580 | true.executable=cat | |
1581 | # hg update -C 1 |
|
1581 | # hg update -C 1 | |
1582 | $ cat <<EOF > printargs_merge_tool |
|
1582 | $ cat <<EOF > printargs_merge_tool | |
1583 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done |
|
1583 | > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done | |
1584 | > EOF |
|
1584 | > EOF | |
1585 | $ hg --config merge-tools.true.executable='sh' \ |
|
1585 | $ hg --config merge-tools.true.executable='sh' \ | |
1586 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ |
|
1586 | > --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \ | |
1587 | > --config merge-tools.true.mergemarkers=detailed \ |
|
1587 | > --config merge-tools.true.mergemarkers=detailed \ | |
1588 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1588 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1589 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1589 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1590 | > --config ui.mergemarkers=basic \ |
|
1590 | > --config ui.mergemarkers=basic \ | |
1591 | > merge -r 2 |
|
1591 | > merge -r 2 | |
1592 | merging f |
|
1592 | merging f | |
1593 | arg: "ll:working copy: tooltmpl ef83787e2614" |
|
1593 | arg: "ll:working copy: tooltmpl ef83787e2614" | |
1594 | arg: "lo:" |
|
1594 | arg: "lo:" | |
1595 | arg: "merge rev: tooltmpl 0185f4e0cf02" |
|
1595 | arg: "merge rev: tooltmpl 0185f4e0cf02" | |
1596 | arg: "lb:base: */f~base.*" (glob) |
|
1596 | arg: "lb:base: */f~base.*" (glob) | |
1597 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1597 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1598 | (branch merge, don't forget to commit) |
|
1598 | (branch merge, don't forget to commit) | |
1599 | $ rm -f 'printargs_merge_tool' |
|
1599 | $ rm -f 'printargs_merge_tool' | |
1600 |
|
1600 | |||
1601 | The merge tool still gets labellocal and labelother as 'basic' even when |
|
1601 | The merge tool still gets labellocal and labelother as 'basic' even when | |
1602 | premerge=keep is used and has 'detailed' markers: |
|
1602 | premerge=keep is used and has 'detailed' markers: | |
1603 |
|
1603 | |||
1604 | $ beforemerge |
|
1604 | $ beforemerge | |
1605 | [merge-tools] |
|
1605 | [merge-tools] | |
1606 | false.whatever= |
|
1606 | false.whatever= | |
1607 | true.priority=1 |
|
1607 | true.priority=1 | |
1608 | true.executable=cat |
|
1608 | true.executable=cat | |
1609 | # hg update -C 1 |
|
1609 | # hg update -C 1 | |
1610 | $ cat <<EOF > mytool |
|
1610 | $ cat <<EOF > mytool | |
1611 | > echo labellocal: \"\$1\" |
|
1611 | > echo labellocal: \"\$1\" | |
1612 | > echo labelother: \"\$2\" |
|
1612 | > echo labelother: \"\$2\" | |
1613 | > echo "output (arg)": \"\$3\" |
|
1613 | > echo "output (arg)": \"\$3\" | |
1614 | > echo "output (contents)": |
|
1614 | > echo "output (contents)": | |
1615 | > cat "\$3" |
|
1615 | > cat "\$3" | |
1616 | > EOF |
|
1616 | > EOF | |
1617 | $ hg --config merge-tools.true.executable='sh' \ |
|
1617 | $ hg --config merge-tools.true.executable='sh' \ | |
1618 | > --config merge-tools.true.args='mytool $labellocal $labelother $output' \ |
|
1618 | > --config merge-tools.true.args='mytool $labellocal $labelother $output' \ | |
1619 | > --config merge-tools.true.premerge=keep \ |
|
1619 | > --config merge-tools.true.premerge=keep \ | |
1620 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1620 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1621 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1621 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1622 | > --config ui.mergemarkers=detailed \ |
|
1622 | > --config ui.mergemarkers=detailed \ | |
1623 | > merge -r 2 |
|
1623 | > merge -r 2 | |
1624 | merging f |
|
1624 | merging f | |
1625 | labellocal: "working copy" |
|
1625 | labellocal: "working copy" | |
1626 | labelother: "merge rev" |
|
1626 | labelother: "merge rev" | |
1627 | output (arg): "$TESTTMP/repo/f" |
|
1627 | output (arg): "$TESTTMP/repo/f" | |
1628 | output (contents): |
|
1628 | output (contents): | |
1629 | <<<<<<< working copy: uitmpl 1 |
|
1629 | <<<<<<< working copy: uitmpl 1 | |
1630 | revision 1 |
|
1630 | revision 1 | |
1631 | ======= |
|
1631 | ======= | |
1632 | revision 2 |
|
1632 | revision 2 | |
1633 | >>>>>>> merge rev: uitmpl 2 |
|
1633 | >>>>>>> merge rev: uitmpl 2 | |
1634 | space |
|
1634 | space | |
1635 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1635 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1636 | (branch merge, don't forget to commit) |
|
1636 | (branch merge, don't forget to commit) | |
1637 | $ rm -f 'mytool' |
|
1637 | $ rm -f 'mytool' | |
1638 |
|
1638 | |||
1639 | premerge=keep uses the *tool's* mergemarkertemplate if tool's |
|
1639 | premerge=keep uses the *tool's* mergemarkertemplate if tool's | |
1640 | mergemarkers=detailed; labellocal and labelother also use the tool's template |
|
1640 | mergemarkers=detailed; labellocal and labelother also use the tool's template | |
1641 |
|
1641 | |||
1642 | $ beforemerge |
|
1642 | $ beforemerge | |
1643 | [merge-tools] |
|
1643 | [merge-tools] | |
1644 | false.whatever= |
|
1644 | false.whatever= | |
1645 | true.priority=1 |
|
1645 | true.priority=1 | |
1646 | true.executable=cat |
|
1646 | true.executable=cat | |
1647 | # hg update -C 1 |
|
1647 | # hg update -C 1 | |
1648 | $ cat <<EOF > mytool |
|
1648 | $ cat <<EOF > mytool | |
1649 | > echo labellocal: \"\$1\" |
|
1649 | > echo labellocal: \"\$1\" | |
1650 | > echo labelother: \"\$2\" |
|
1650 | > echo labelother: \"\$2\" | |
1651 | > echo "output (arg)": \"\$3\" |
|
1651 | > echo "output (arg)": \"\$3\" | |
1652 | > echo "output (contents)": |
|
1652 | > echo "output (contents)": | |
1653 | > cat "\$3" |
|
1653 | > cat "\$3" | |
1654 | > EOF |
|
1654 | > EOF | |
1655 | $ hg --config merge-tools.true.executable='sh' \ |
|
1655 | $ hg --config merge-tools.true.executable='sh' \ | |
1656 | > --config merge-tools.true.args='mytool $labellocal $labelother $output' \ |
|
1656 | > --config merge-tools.true.args='mytool $labellocal $labelother $output' \ | |
1657 | > --config merge-tools.true.premerge=keep \ |
|
1657 | > --config merge-tools.true.premerge=keep \ | |
1658 | > --config merge-tools.true.mergemarkers=detailed \ |
|
1658 | > --config merge-tools.true.mergemarkers=detailed \ | |
1659 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ |
|
1659 | > --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \ | |
1660 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ |
|
1660 | > --config ui.mergemarkertemplate='uitmpl {rev}' \ | |
1661 | > --config ui.mergemarkers=detailed \ |
|
1661 | > --config ui.mergemarkers=detailed \ | |
1662 | > merge -r 2 |
|
1662 | > merge -r 2 | |
1663 | merging f |
|
1663 | merging f | |
1664 | labellocal: "working copy: tooltmpl ef83787e2614" |
|
1664 | labellocal: "working copy: tooltmpl ef83787e2614" | |
1665 | labelother: "merge rev: tooltmpl 0185f4e0cf02" |
|
1665 | labelother: "merge rev: tooltmpl 0185f4e0cf02" | |
1666 | output (arg): "$TESTTMP/repo/f" |
|
1666 | output (arg): "$TESTTMP/repo/f" | |
1667 | output (contents): |
|
1667 | output (contents): | |
1668 | <<<<<<< working copy: tooltmpl ef83787e2614 |
|
1668 | <<<<<<< working copy: tooltmpl ef83787e2614 | |
1669 | revision 1 |
|
1669 | revision 1 | |
1670 | ======= |
|
1670 | ======= | |
1671 | revision 2 |
|
1671 | revision 2 | |
1672 | >>>>>>> merge rev: tooltmpl 0185f4e0cf02 |
|
1672 | >>>>>>> merge rev: tooltmpl 0185f4e0cf02 | |
1673 | space |
|
1673 | space | |
1674 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1674 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1675 | (branch merge, don't forget to commit) |
|
1675 | (branch merge, don't forget to commit) | |
1676 | $ rm -f 'mytool' |
|
1676 | $ rm -f 'mytool' | |
1677 |
|
1677 | |||
1678 | Issue3581: Merging a filename that needs to be quoted |
|
1678 | Issue3581: Merging a filename that needs to be quoted | |
1679 | (This test doesn't work on Windows filesystems even on Linux, so check |
|
1679 | (This test doesn't work on Windows filesystems even on Linux, so check | |
1680 | for Unix-like permission) |
|
1680 | for Unix-like permission) | |
1681 |
|
1681 | |||
1682 | #if unix-permissions |
|
1682 | #if unix-permissions | |
1683 | $ beforemerge |
|
1683 | $ beforemerge | |
1684 | [merge-tools] |
|
1684 | [merge-tools] | |
1685 | false.whatever= |
|
1685 | false.whatever= | |
1686 | true.priority=1 |
|
1686 | true.priority=1 | |
1687 | true.executable=cat |
|
1687 | true.executable=cat | |
1688 | # hg update -C 1 |
|
1688 | # hg update -C 1 | |
1689 | $ echo "revision 5" > '"; exit 1; echo "' |
|
1689 | $ echo "revision 5" > '"; exit 1; echo "' | |
1690 | $ hg commit -Am "revision 5" |
|
1690 | $ hg commit -Am "revision 5" | |
1691 | adding "; exit 1; echo " |
|
1691 | adding "; exit 1; echo " | |
1692 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' |
|
1692 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' | |
1693 | $ hg update -C 1 > /dev/null |
|
1693 | $ hg update -C 1 > /dev/null | |
1694 | $ echo "revision 6" > '"; exit 1; echo "' |
|
1694 | $ echo "revision 6" > '"; exit 1; echo "' | |
1695 | $ hg commit -Am "revision 6" |
|
1695 | $ hg commit -Am "revision 6" | |
1696 | adding "; exit 1; echo " |
|
1696 | adding "; exit 1; echo " | |
1697 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' |
|
1697 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' | |
1698 | created new head |
|
1698 | created new head | |
1699 | $ hg merge --config merge-tools.true.executable="true" -r 5 |
|
1699 | $ hg merge --config merge-tools.true.executable="true" -r 5 | |
1700 | merging "; exit 1; echo " |
|
1700 | merging "; exit 1; echo " | |
1701 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1701 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1702 | (branch merge, don't forget to commit) |
|
1702 | (branch merge, don't forget to commit) | |
1703 | $ hg update -C 1 > /dev/null |
|
1703 | $ hg update -C 1 > /dev/null | |
1704 |
|
1704 | |||
1705 | #else |
|
1705 | #else | |
1706 |
|
1706 | |||
1707 | Match the non-portable filename commits above for test stability |
|
1707 | Match the non-portable filename commits above for test stability | |
1708 |
|
1708 | |||
1709 | $ hg import --bypass -q - << EOF |
|
1709 | $ hg import --bypass -q - << EOF | |
1710 | > # HG changeset patch |
|
1710 | > # HG changeset patch | |
1711 | > revision 5 |
|
1711 | > revision 5 | |
1712 | > |
|
1712 | > | |
1713 | > diff --git a/"; exit 1; echo " b/"; exit 1; echo " |
|
1713 | > diff --git a/"; exit 1; echo " b/"; exit 1; echo " | |
1714 | > new file mode 100644 |
|
1714 | > new file mode 100644 | |
1715 | > --- /dev/null |
|
1715 | > --- /dev/null | |
1716 | > +++ b/"; exit 1; echo " |
|
1716 | > +++ b/"; exit 1; echo " | |
1717 | > @@ -0,0 +1,1 @@ |
|
1717 | > @@ -0,0 +1,1 @@ | |
1718 | > +revision 5 |
|
1718 | > +revision 5 | |
1719 | > EOF |
|
1719 | > EOF | |
1720 |
|
1720 | |||
1721 | $ hg import --bypass -q - << EOF |
|
1721 | $ hg import --bypass -q - << EOF | |
1722 | > # HG changeset patch |
|
1722 | > # HG changeset patch | |
1723 | > revision 6 |
|
1723 | > revision 6 | |
1724 | > |
|
1724 | > | |
1725 | > diff --git a/"; exit 1; echo " b/"; exit 1; echo " |
|
1725 | > diff --git a/"; exit 1; echo " b/"; exit 1; echo " | |
1726 | > new file mode 100644 |
|
1726 | > new file mode 100644 | |
1727 | > --- /dev/null |
|
1727 | > --- /dev/null | |
1728 | > +++ b/"; exit 1; echo " |
|
1728 | > +++ b/"; exit 1; echo " | |
1729 | > @@ -0,0 +1,1 @@ |
|
1729 | > @@ -0,0 +1,1 @@ | |
1730 | > +revision 6 |
|
1730 | > +revision 6 | |
1731 | > EOF |
|
1731 | > EOF | |
1732 |
|
1732 | |||
1733 | #endif |
|
1733 | #endif | |
1734 |
|
1734 | |||
1735 | Merge post-processing |
|
1735 | Merge post-processing | |
1736 |
|
1736 | |||
1737 | cat is a bad merge-tool and doesn't change: |
|
1737 | cat is a bad merge-tool and doesn't change: | |
1738 |
|
1738 | |||
1739 | $ beforemerge |
|
1739 | $ beforemerge | |
1740 | [merge-tools] |
|
1740 | [merge-tools] | |
1741 | false.whatever= |
|
1741 | false.whatever= | |
1742 | true.priority=1 |
|
1742 | true.priority=1 | |
1743 | true.executable=cat |
|
1743 | true.executable=cat | |
1744 | # hg update -C 1 |
|
1744 | # hg update -C 1 | |
1745 | $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1 |
|
1745 | $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1 | |
1746 | merging f |
|
1746 | merging f | |
1747 | revision 1 |
|
1747 | revision 1 | |
1748 | space |
|
1748 | space | |
1749 | revision 0 |
|
1749 | revision 0 | |
1750 | space |
|
1750 | space | |
1751 | revision 2 |
|
1751 | revision 2 | |
1752 | space |
|
1752 | space | |
1753 | output file f appears unchanged |
|
1753 | output file f appears unchanged | |
1754 | was merge successful (yn)? n |
|
1754 | was merge successful (yn)? n | |
1755 | merging f failed! |
|
1755 | merging f failed! | |
1756 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1756 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1757 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
1757 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
1758 | [1] |
|
1758 | [1] | |
1759 | $ aftermerge |
|
1759 | $ aftermerge | |
1760 | # cat f |
|
1760 | # cat f | |
1761 | revision 1 |
|
1761 | revision 1 | |
1762 | space |
|
1762 | space | |
1763 | # hg stat |
|
1763 | # hg stat | |
1764 | M f |
|
1764 | M f | |
1765 | ? f.orig |
|
1765 | ? f.orig | |
1766 | # hg resolve --list |
|
1766 | # hg resolve --list | |
1767 | U f |
|
1767 | U f | |
1768 |
|
1768 | |||
1769 | missingbinary is a merge-tool that doesn't exist: |
|
1769 | missingbinary is a merge-tool that doesn't exist: | |
1770 |
|
1770 | |||
1771 | $ echo "missingbinary.executable=doesnotexist" >> .hg/hgrc |
|
1771 | $ echo "missingbinary.executable=doesnotexist" >> .hg/hgrc | |
1772 | $ beforemerge |
|
1772 | $ beforemerge | |
1773 | [merge-tools] |
|
1773 | [merge-tools] | |
1774 | false.whatever= |
|
1774 | false.whatever= | |
1775 | true.priority=1 |
|
1775 | true.priority=1 | |
1776 | true.executable=cat |
|
1776 | true.executable=cat | |
1777 | missingbinary.executable=doesnotexist |
|
1777 | missingbinary.executable=doesnotexist | |
1778 | # hg update -C 1 |
|
1778 | # hg update -C 1 | |
1779 | $ hg merge -y -r 2 --config ui.merge=missingbinary |
|
1779 | $ hg merge -y -r 2 --config ui.merge=missingbinary | |
1780 | couldn't find merge tool missingbinary (for pattern f) |
|
1780 | couldn't find merge tool missingbinary (for pattern f) | |
1781 | merging f |
|
1781 | merging f | |
1782 | couldn't find merge tool missingbinary (for pattern f) |
|
1782 | couldn't find merge tool missingbinary (for pattern f) | |
1783 | revision 1 |
|
1783 | revision 1 | |
1784 | space |
|
1784 | space | |
1785 | revision 0 |
|
1785 | revision 0 | |
1786 | space |
|
1786 | space | |
1787 | revision 2 |
|
1787 | revision 2 | |
1788 | space |
|
1788 | space | |
1789 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1789 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1790 | (branch merge, don't forget to commit) |
|
1790 | (branch merge, don't forget to commit) | |
1791 |
|
1791 | |||
1792 | $ hg update -q -C 1 |
|
1792 | $ hg update -q -C 1 | |
1793 | $ rm f |
|
1793 | $ rm f | |
1794 |
|
1794 | |||
1795 | internal merge cannot handle symlinks and shouldn't try: |
|
1795 | internal merge cannot handle symlinks and shouldn't try: | |
1796 |
|
1796 | |||
1797 | #if symlink |
|
1797 | #if symlink | |
1798 |
|
1798 | |||
1799 | $ ln -s symlink f |
|
1799 | $ ln -s symlink f | |
1800 | $ hg commit -qm 'f is symlink' |
|
1800 | $ hg commit -qm 'f is symlink' | |
1801 |
|
1801 | |||
1802 | #else |
|
1802 | #else | |
1803 |
|
1803 | |||
1804 | $ hg import --bypass -q - << EOF |
|
1804 | $ hg import --bypass -q - << EOF | |
1805 | > # HG changeset patch |
|
1805 | > # HG changeset patch | |
1806 | > f is symlink |
|
1806 | > f is symlink | |
1807 | > |
|
1807 | > | |
1808 | > diff --git a/f b/f |
|
1808 | > diff --git a/f b/f | |
1809 | > old mode 100644 |
|
1809 | > old mode 100644 | |
1810 | > new mode 120000 |
|
1810 | > new mode 120000 | |
1811 | > --- a/f |
|
1811 | > --- a/f | |
1812 | > +++ b/f |
|
1812 | > +++ b/f | |
1813 | > @@ -1,2 +1,1 @@ |
|
1813 | > @@ -1,2 +1,1 @@ | |
1814 | > -revision 1 |
|
1814 | > -revision 1 | |
1815 | > -space |
|
1815 | > -space | |
1816 | > +symlink |
|
1816 | > +symlink | |
1817 | > \ No newline at end of file |
|
1817 | > \ No newline at end of file | |
1818 | > EOF |
|
1818 | > EOF | |
1819 |
|
1819 | |||
1820 | Resolve 'other [destination] changed f which local [working copy] deleted' prompt |
|
1820 | Resolve 'other [destination] changed f which local [working copy] deleted' prompt | |
1821 | $ hg up -q -C --config ui.interactive=True << EOF |
|
1821 | $ hg up -q -C --config ui.interactive=True << EOF | |
1822 | > c |
|
1822 | > c | |
1823 | > EOF |
|
1823 | > EOF | |
1824 |
|
1824 | |||
1825 | #endif |
|
1825 | #endif | |
1826 |
|
1826 | |||
1827 | $ hg merge -r 2 --tool internal:merge |
|
1827 | $ hg merge -r 2 --tool internal:merge | |
1828 | merging f |
|
1828 | merging f | |
1829 | warning: internal :merge cannot merge symlinks for f |
|
1829 | warning: internal :merge cannot merge symlinks for f | |
1830 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
1830 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
1831 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1831 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1832 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
1832 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
1833 | [1] |
|
1833 | [1] | |
1834 |
|
1834 | |||
1835 | Verify naming of temporary files and that extension is preserved: |
|
1835 | Verify naming of temporary files and that extension is preserved: | |
1836 |
|
1836 | |||
1837 | $ hg update -q -C 1 |
|
1837 | $ hg update -q -C 1 | |
1838 | $ hg mv f f.txt |
|
1838 | $ hg mv f f.txt | |
1839 | $ hg ci -qm "f.txt" |
|
1839 | $ hg ci -qm "f.txt" | |
1840 | $ hg update -q -C 2 |
|
1840 | $ hg update -q -C 2 | |
1841 | $ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base $local $other $output' |
|
1841 | $ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base $local $other $output' | |
1842 | merging f and f.txt to f.txt |
|
1842 | merging f and f.txt to f.txt | |
1843 | */f~base.* */f~local.*.txt */f~other.*.txt $TESTTMP/repo/f.txt (glob) |
|
1843 | */f~base.* */f~local.*.txt */f~other.*.txt $TESTTMP/repo/f.txt (glob) | |
1844 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1844 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1845 | (branch merge, don't forget to commit) |
|
1845 | (branch merge, don't forget to commit) | |
1846 |
|
1846 | |||
1847 | Verify naming of temporary files and that extension is preserved |
|
1847 | Verify naming of temporary files and that extension is preserved | |
1848 | (experimental.mergetempdirprefix version): |
|
1848 | (experimental.mergetempdirprefix version): | |
1849 |
|
1849 | |||
1850 | $ hg update -q -C 1 |
|
1850 | $ hg update -q -C 1 | |
1851 | $ hg mv f f.txt |
|
1851 | $ hg mv f f.txt | |
1852 | $ hg ci -qm "f.txt" |
|
1852 | $ hg ci -qm "f.txt" | |
1853 | $ hg update -q -C 2 |
|
1853 | $ hg update -q -C 2 | |
1854 | $ hg merge -y -r tip --tool echo \ |
|
1854 | $ hg merge -y -r tip --tool echo \ | |
1855 | > --config merge-tools.echo.args='$base $local $other $output' \ |
|
1855 | > --config merge-tools.echo.args='$base $local $other $output' \ | |
1856 | > --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. |
|
1856 | > --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. | |
1857 | merging f and f.txt to f.txt |
|
1857 | merging f and f.txt to f.txt | |
1858 | $TESTTMP/hgmerge.*/f~base $TESTTMP/hgmerge.*/f~local.txt $TESTTMP/hgmerge.*/f~other.txt $TESTTMP/repo/f.txt (glob) |
|
1858 | $TESTTMP/hgmerge.*/f~base $TESTTMP/hgmerge.*/f~local.txt $TESTTMP/hgmerge.*/f~other.txt $TESTTMP/repo/f.txt (glob) | |
1859 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1859 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1860 | (branch merge, don't forget to commit) |
|
1860 | (branch merge, don't forget to commit) | |
1861 |
|
1861 | |||
1862 | Binary files capability checking |
|
1862 | Binary files capability checking | |
1863 |
|
1863 | |||
1864 | $ hg update -q -C 0 |
|
1864 | $ hg update -q -C 0 | |
1865 | $ python <<EOF |
|
1865 | $ python <<EOF | |
1866 | > with open('b', 'wb') as fp: |
|
1866 | > with open('b', 'wb') as fp: | |
1867 | > fp.write(b'\x00\x01\x02\x03') |
|
1867 | > fp.write(b'\x00\x01\x02\x03') | |
1868 | > EOF |
|
1868 | > EOF | |
1869 | $ hg add b |
|
1869 | $ hg add b | |
1870 | $ hg commit -qm "add binary file (#1)" |
|
1870 | $ hg commit -qm "add binary file (#1)" | |
1871 |
|
1871 | |||
1872 | $ hg update -q -C 0 |
|
1872 | $ hg update -q -C 0 | |
1873 | $ python <<EOF |
|
1873 | $ python <<EOF | |
1874 | > with open('b', 'wb') as fp: |
|
1874 | > with open('b', 'wb') as fp: | |
1875 | > fp.write(b'\x03\x02\x01\x00') |
|
1875 | > fp.write(b'\x03\x02\x01\x00') | |
1876 | > EOF |
|
1876 | > EOF | |
1877 | $ hg add b |
|
1877 | $ hg add b | |
1878 | $ hg commit -qm "add binary file (#2)" |
|
1878 | $ hg commit -qm "add binary file (#2)" | |
1879 |
|
1879 | |||
1880 | By default, binary files capability of internal merge tools is not |
|
1880 | By default, binary files capability of internal merge tools is not | |
1881 | checked strictly. |
|
1881 | checked strictly. | |
1882 |
|
1882 | |||
1883 | (for merge-patterns, chosen unintentionally) |
|
1883 | (for merge-patterns, chosen unintentionally) | |
1884 |
|
1884 | |||
1885 | $ hg merge 9 \ |
|
1885 | $ hg merge 9 \ | |
1886 | > --config merge-patterns.b=:merge-other \ |
|
1886 | > --config merge-patterns.b=:merge-other \ | |
1887 | > --config merge-patterns.re:[a-z]=:other |
|
1887 | > --config merge-patterns.re:[a-z]=:other | |
1888 | warning: check merge-patterns configurations, if ':merge-other' for binary file 'b' is unintentional |
|
1888 | warning: check merge-patterns configurations, if ':merge-other' for binary file 'b' is unintentional | |
1889 | (see 'hg help merge-tools' for binary files capability) |
|
1889 | (see 'hg help merge-tools' for binary files capability) | |
1890 | merging b |
|
1890 | merging b | |
1891 | warning: b looks like a binary file. |
|
1891 | warning: b looks like a binary file. | |
1892 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1892 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1893 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
1893 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
1894 | [1] |
|
1894 | [1] | |
1895 | $ hg merge --abort -q |
|
1895 | $ hg merge --abort -q | |
1896 |
|
1896 | |||
1897 | (for ui.merge, ignored unintentionally) |
|
1897 | (for ui.merge, ignored unintentionally) | |
1898 |
|
1898 | |||
1899 | $ hg merge 9 \ |
|
1899 | $ hg merge 9 \ | |
|
1900 | > --config merge-tools.:other.binary=true \ | |||
1900 | > --config ui.merge=:other |
|
1901 | > --config ui.merge=:other | |
1901 | tool :other (for pattern b) can't handle binary |
|
1902 | tool :other (for pattern b) can't handle binary | |
1902 | tool true can't handle binary |
|
1903 | tool true can't handle binary | |
|
1904 | tool :other can't handle binary | |||
1903 |
|
|
1905 | tool false can't handle binary | |
1904 | no tool found to merge b |
|
1906 | no tool found to merge b | |
1905 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for b? u |
|
1907 | keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for b? u | |
1906 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1908 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1907 |
|
|
1909 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
1908 | [1] |
|
1910 | [1] | |
1909 | $ hg merge --abort -q |
|
1911 | $ hg merge --abort -q | |
1910 |
|
1912 | |||
1911 | With merge.strict-capability-check=true, binary files capability of |
|
1913 | With merge.strict-capability-check=true, binary files capability of | |
1912 | internal merge tools is checked strictly. |
|
1914 | internal merge tools is checked strictly. | |
1913 |
|
1915 | |||
1914 | $ f --hexdump b |
|
1916 | $ f --hexdump b | |
1915 | b: |
|
1917 | b: | |
1916 | 0000: 03 02 01 00 |....| |
|
1918 | 0000: 03 02 01 00 |....| | |
1917 |
|
1919 | |||
1918 | (for merge-patterns) |
|
1920 | (for merge-patterns) | |
1919 |
|
1921 | |||
1920 | $ hg merge 9 --config merge.strict-capability-check=true \ |
|
1922 | $ hg merge 9 --config merge.strict-capability-check=true \ | |
|
1923 | > --config merge-tools.:merge-other.binary=true \ | |||
1921 | > --config merge-patterns.b=:merge-other \ |
|
1924 | > --config merge-patterns.b=:merge-other \ | |
1922 | > --config merge-patterns.re:[a-z]=:other |
|
1925 | > --config merge-patterns.re:[a-z]=:other | |
1923 |
|
|
1926 | tool :merge-other (for pattern b) can't handle binary | |
1924 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1927 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1925 |
|
|
1928 | (branch merge, don't forget to commit) | |
1926 | $ f --hexdump b |
|
1929 | $ f --hexdump b | |
1927 | b: |
|
1930 | b: | |
1928 | 0000: 00 01 02 03 |....| |
|
1931 | 0000: 00 01 02 03 |....| | |
1929 | $ hg merge --abort -q |
|
1932 | $ hg merge --abort -q | |
1930 |
|
1933 | |||
1931 | (for ui.merge) |
|
1934 | (for ui.merge) | |
1932 |
|
1935 | |||
1933 | $ hg merge 9 --config merge.strict-capability-check=true \ |
|
1936 | $ hg merge 9 --config merge.strict-capability-check=true \ | |
1934 | > --config ui.merge=:other |
|
1937 | > --config ui.merge=:other | |
1935 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1938 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
1936 |
|
|
1939 | (branch merge, don't forget to commit) | |
1937 | $ f --hexdump b |
|
1940 | $ f --hexdump b | |
1938 | b: |
|
1941 | b: | |
1939 | 0000: 00 01 02 03 |....| |
|
1942 | 0000: 00 01 02 03 |....| | |
1940 | $ hg merge --abort -q |
|
1943 | $ hg merge --abort -q | |
1941 |
|
1944 | |||
1942 | Check that debugpicktool examines which merge tool is chosen for |
|
1945 | Check that debugpicktool examines which merge tool is chosen for | |
1943 | specified file as expected |
|
1946 | specified file as expected | |
1944 |
|
1947 | |||
1945 | $ beforemerge |
|
1948 | $ beforemerge | |
1946 | [merge-tools] |
|
1949 | [merge-tools] | |
1947 | false.whatever= |
|
1950 | false.whatever= | |
1948 | true.priority=1 |
|
1951 | true.priority=1 | |
1949 | true.executable=cat |
|
1952 | true.executable=cat | |
1950 | missingbinary.executable=doesnotexist |
|
1953 | missingbinary.executable=doesnotexist | |
1951 |
|
|
1954 | # hg update -C 1 | |
1952 |
|
|
1955 | ||
1953 | (default behavior: checking files in the working parent context) |
|
1956 | (default behavior: checking files in the working parent context) | |
1954 |
|
1957 | |||
1955 | $ hg manifest |
|
1958 | $ hg manifest | |
1956 | f |
|
1959 | f | |
1957 | $ hg debugpickmergetool |
|
1960 | $ hg debugpickmergetool | |
1958 | f = true |
|
1961 | f = true | |
1959 |
|
1962 | |||
1960 | (-X/-I and file patterns limmit examination targets) |
|
1963 | (-X/-I and file patterns limmit examination targets) | |
1961 |
|
1964 | |||
1962 | $ hg debugpickmergetool -X f |
|
1965 | $ hg debugpickmergetool -X f | |
1963 | $ hg debugpickmergetool unknown |
|
1966 | $ hg debugpickmergetool unknown | |
1964 | unknown: no such file in rev ef83787e2614 |
|
1967 | unknown: no such file in rev ef83787e2614 | |
1965 |
|
1968 | |||
1966 | (--changedelete emulates merging change and delete) |
|
1969 | (--changedelete emulates merging change and delete) | |
1967 |
|
1970 | |||
1968 | $ hg debugpickmergetool --changedelete |
|
1971 | $ hg debugpickmergetool --changedelete | |
1969 | f = :prompt |
|
1972 | f = :prompt | |
1970 |
|
1973 | |||
1971 | (-r REV causes checking files in specified revision) |
|
1974 | (-r REV causes checking files in specified revision) | |
1972 |
|
1975 | |||
1973 | $ hg manifest -r 8 |
|
1976 | $ hg manifest -r 8 | |
1974 | f.txt |
|
1977 | f.txt | |
1975 | $ hg debugpickmergetool -r 8 |
|
1978 | $ hg debugpickmergetool -r 8 | |
1976 | f.txt = true |
|
1979 | f.txt = true | |
1977 |
|
1980 | |||
1978 |
|
|
1981 | #if symlink | |
1979 |
|
|
1982 | ||
1980 | (symlink causes chosing :prompt) |
|
1983 | (symlink causes chosing :prompt) | |
1981 |
|
1984 | |||
1982 | $ hg debugpickmergetool -r 6d00b3726f6e |
|
1985 | $ hg debugpickmergetool -r 6d00b3726f6e | |
1983 | f = :prompt |
|
1986 | f = :prompt | |
1984 |
|
1987 | |||
1985 | (by default, it is assumed that no internal merge tools has symlinks |
|
1988 | (by default, it is assumed that no internal merge tools has symlinks | |
1986 | capability) |
|
1989 | capability) | |
1987 |
|
1990 | |||
1988 | $ hg debugpickmergetool \ |
|
1991 | $ hg debugpickmergetool \ | |
1989 | > -r 6d00b3726f6e \ |
|
1992 | > -r 6d00b3726f6e \ | |
|
1993 | > --config merge-tools.:merge-other.symlink=true \ | |||
1990 | > --config merge-patterns.f=:merge-other \ |
|
1994 | > --config merge-patterns.f=:merge-other \ | |
1991 | > --config merge-patterns.re:[f]=:merge-local \ |
|
1995 | > --config merge-patterns.re:[f]=:merge-local \ | |
1992 | > --config merge-patterns.re:[a-z]=:other |
|
1996 | > --config merge-patterns.re:[a-z]=:other | |
1993 | f = :prompt |
|
1997 | f = :prompt | |
1994 |
|
1998 | |||
1995 | $ hg debugpickmergetool \ |
|
1999 | $ hg debugpickmergetool \ | |
1996 | > -r 6d00b3726f6e \ |
|
2000 | > -r 6d00b3726f6e \ | |
|
2001 | > --config merge-tools.:other.symlink=true \ | |||
1997 | > --config ui.merge=:other |
|
2002 | > --config ui.merge=:other | |
1998 | f = :prompt |
|
2003 | f = :prompt | |
1999 |
|
2004 | |||
2000 | (with strict-capability-check=true, actual symlink capabilities are |
|
2005 | (with strict-capability-check=true, actual symlink capabilities are | |
2001 | checked striclty) |
|
2006 | checked striclty) | |
2002 |
|
2007 | |||
2003 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ |
|
2008 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ | |
2004 | > -r 6d00b3726f6e \ |
|
2009 | > -r 6d00b3726f6e \ | |
|
2010 | > --config merge-tools.:merge-other.symlink=true \ | |||
2005 | > --config merge-patterns.f=:merge-other \ |
|
2011 | > --config merge-patterns.f=:merge-other \ | |
2006 | > --config merge-patterns.re:[f]=:merge-local \ |
|
2012 | > --config merge-patterns.re:[f]=:merge-local \ | |
2007 | > --config merge-patterns.re:[a-z]=:other |
|
2013 | > --config merge-patterns.re:[a-z]=:other | |
2008 | f = :other |
|
2014 | f = :other | |
2009 |
|
2015 | |||
2010 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ |
|
2016 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ | |
2011 | > -r 6d00b3726f6e \ |
|
2017 | > -r 6d00b3726f6e \ | |
2012 | > --config ui.merge=:other |
|
2018 | > --config ui.merge=:other | |
2013 | f = :other |
|
2019 | f = :other | |
2014 |
|
2020 | |||
|
2021 | $ hg debugpickmergetool --config merge.strict-capability-check=true \ | |||
|
2022 | > -r 6d00b3726f6e \ | |||
|
2023 | > --config merge-tools.:merge-other.symlink=true \ | |||
|
2024 | > --config ui.merge=:merge-other | |||
|
2025 | f = :prompt | |||
|
2026 | ||||
2015 |
|
|
2027 | #endif | |
2016 |
|
|
2028 | ||
2017 | (--verbose shows some configurations) |
|
2029 | (--verbose shows some configurations) | |
2018 |
|
2030 | |||
2019 | $ hg debugpickmergetool --tool foobar -v |
|
2031 | $ hg debugpickmergetool --tool foobar -v | |
2020 |
|
|
2032 | with --tool 'foobar' | |
2021 | f = foobar |
|
2033 | f = foobar | |
2022 |
|
2034 | |||
2023 | $ HGMERGE=false hg debugpickmergetool -v |
|
2035 | $ HGMERGE=false hg debugpickmergetool -v | |
2024 |
with HGMERGE= |
|
2036 | with HGMERGE='false' | |
2025 | f = false |
|
2037 | f = false | |
2026 |
|
2038 | |||
2027 | $ hg debugpickmergetool --config ui.merge=false -v |
|
2039 | $ hg debugpickmergetool --config ui.merge=false -v | |
2028 |
with ui.merge= |
|
2040 | with ui.merge='false' | |
2029 | f = false |
|
2041 | f = false | |
2030 |
|
2042 | |||
2031 | (--debug shows errors detected intermediately) |
|
2043 | (--debug shows errors detected intermediately) | |
2032 |
|
2044 | |||
2033 | $ hg debugpickmergetool --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool --debug f |
|
2045 | $ hg debugpickmergetool --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool --debug f | |
2034 |
|
|
2046 | couldn't find merge tool true (for pattern f) | |
2035 | couldn't find merge tool true |
|
2047 | couldn't find merge tool true | |
2036 | f = false |
|
2048 | f = false | |
2037 |
|
2049 | |||
2038 | $ cd .. |
|
2050 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now