138 ui = repo.ui |
138 ui = repo.ui |
139 fd = fcd.path() |
139 fd = fcd.path() |
140 binary = isbin(fcd) or isbin(fco) or isbin(fca) |
140 binary = isbin(fcd) or isbin(fco) or isbin(fca) |
141 symlink = 'l' in fcd.flags() + fco.flags() |
141 symlink = 'l' in fcd.flags() + fco.flags() |
142 tool, toolpath = _picktool(repo, ui, fd, binary, symlink) |
142 tool, toolpath = _picktool(repo, ui, fd, binary, symlink) |
143 ui.debug(_("picked tool '%s' for %s (binary %s symlink %s)\n") % |
143 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" % |
144 (tool, fd, binary, symlink)) |
144 (tool, fd, binary, symlink)) |
145 |
145 |
146 if not tool or tool == 'internal:prompt': |
146 if not tool or tool == 'internal:prompt': |
147 tool = "internal:local" |
147 tool = "internal:local" |
148 if ui.promptchoice(_(" no tool found to merge %s\n" |
148 if ui.promptchoice(_(" no tool found to merge %s\n" |
168 if orig != fco.path(): |
168 if orig != fco.path(): |
169 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
169 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
170 else: |
170 else: |
171 ui.status(_("merging %s\n") % fd) |
171 ui.status(_("merging %s\n") % fd) |
172 |
172 |
173 ui.debug(_("my %s other %s ancestor %s\n") % (fcd, fco, fca)) |
173 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) |
174 |
174 |
175 # do we attempt to simplemerge first? |
175 # do we attempt to simplemerge first? |
176 if _toolbool(ui, tool, "premerge", not (binary or symlink)): |
176 if _toolbool(ui, tool, "premerge", not (binary or symlink)): |
177 r = simplemerge.simplemerge(ui, a, b, c, quiet=True) |
177 r = simplemerge.simplemerge(ui, a, b, c, quiet=True) |
178 if not r: |
178 if not r: |
179 ui.debug(_(" premerge successful\n")) |
179 ui.debug(" premerge successful\n") |
180 os.unlink(back) |
180 os.unlink(back) |
181 os.unlink(b) |
181 os.unlink(b) |
182 os.unlink(c) |
182 os.unlink(c) |
183 return 0 |
183 return 0 |
184 util.copyfile(back, a) # restore from backup and try again |
184 util.copyfile(back, a) # restore from backup and try again |