comparison mercurial/filemerge.py @ 8831:91e26fb24fb1

filemerge: add internal:dump This create foo.{local,other,base} files for people to manually merge files while littering their working directory.
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 16:56:03 -0500
parents a9850eda2973
children 90f74b31ed4f
comparison
equal deleted inserted replaced
8830:a9850eda2973 8831:91e26fb24fb1
14 return ui.config("merge-tools", tool + "." + part, default) 14 return ui.config("merge-tools", tool + "." + part, default)
15 15
16 def _toolbool(ui, tool, part, default=False): 16 def _toolbool(ui, tool, part, default=False):
17 return ui.configbool("merge-tools", tool + "." + part, default) 17 return ui.configbool("merge-tools", tool + "." + part, default)
18 18
19 _internal = ['internal:' + s for s in 'fail local other merge prompt'.split()] 19 _internal = ['internal:' + s
20 for s in 'fail local other merge prompt dump'.split()]
20 21
21 def _findtool(ui, tool): 22 def _findtool(ui, tool):
22 if tool in _internal: 23 if tool in _internal:
23 return tool 24 return tool
24 k = _toolstr(ui, tool, "regkey") 25 k = _toolstr(ui, tool, "regkey")
189 HG_OTHER_ISLINK='l' in fco.flags(), 190 HG_OTHER_ISLINK='l' in fco.flags(),
190 HG_BASE_ISLINK='l' in fca.flags()) 191 HG_BASE_ISLINK='l' in fca.flags())
191 192
192 if tool == "internal:merge": 193 if tool == "internal:merge":
193 r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other']) 194 r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other'])
195 elif tool == 'internal:dump':
196 a = repo.wjoin(fd)
197 util.copyfile(a, a + ".local")
198 repo.wwrite(a + ".other", fco.data(), fco.flags())
199 repo.wwrite(a + ".base", fca.data(), fca.flags())
200 return 1 # unresolved
194 else: 201 else:
195 args = _toolstr(ui, tool, "args", '$local $base $other') 202 args = _toolstr(ui, tool, "args", '$local $base $other')
196 if "$output" in args: 203 if "$output" in args:
197 out, a = a, back # read input from backup, write to original 204 out, a = a, back # read input from backup, write to original
198 replace = dict(local=a, base=b, other=c, output=out) 205 replace = dict(local=a, base=b, other=c, output=out)