comparison mercurial/merge.py @ 3317:966632304dde

merge: shortcircuit filemerge for identical files - use filectx.cmp to compare files - move merge messages into filemerge - kill the redundant resolving message - update tests
author Matt Mackall <mpm@selenic.com>
date Tue, 10 Oct 2006 01:16:06 -0500
parents e8be5942335d
children c5075ad5e3e9
comparison
equal deleted inserted replaced
3316:0e370798eebf 3317:966632304dde
30 f.close() 30 f.close()
31 return name 31 return name
32 32
33 fcm = wctx.filectx(fw) 33 fcm = wctx.filectx(fw)
34 fco = mctx.filectx(fo) 34 fco = mctx.filectx(fo)
35
36 if not fco.cmp(fcm.data()): # files identical?
37 return 0
38
35 fca = fcm.ancestor(fco) 39 fca = fcm.ancestor(fco)
36 if not fca: 40 if not fca:
37 fca = repo.filectx(fw, fileid=-1) 41 fca = repo.filectx(fw, fileid=-1)
38 a = repo.wjoin(fw) 42 a = repo.wjoin(fw)
39 b = temp("base", fca) 43 b = temp("base", fca)
40 c = temp("other", fco) 44 c = temp("other", fco)
41 45
42 repo.ui.note(_("resolving %s\n") % fw) 46 if fw != fo:
47 repo.ui.status(_("merging %s and %s\n") % (fw, fo))
48 else:
49 repo.ui.status(_("merging %s\n") % fw)
50
43 repo.ui.debug(_("my %s other %s ancestor %s\n") % (fcm, fco, fca)) 51 repo.ui.debug(_("my %s other %s ancestor %s\n") % (fcm, fco, fca))
44 52
45 cmd = (os.environ.get("HGMERGE") or repo.ui.config("ui", "merge") 53 cmd = (os.environ.get("HGMERGE") or repo.ui.config("ui", "merge")
46 or "hgmerge") 54 or "hgmerge")
47 r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root, 55 r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root,
279 repo.ui.warn(_("update failed to remove %s: %s!\n") % 287 repo.ui.warn(_("update failed to remove %s: %s!\n") %
280 (f, inst.strerror)) 288 (f, inst.strerror))
281 removed +=1 289 removed +=1
282 elif m == "m": # merge 290 elif m == "m": # merge
283 f2, fd, flag, move = a[2:] 291 f2, fd, flag, move = a[2:]
284 if f != f2:
285 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
286 else:
287 repo.ui.status(_("merging %s\n") % f)
288 if filemerge(repo, f, f2, wctx, mctx): 292 if filemerge(repo, f, f2, wctx, mctx):
289 unresolved += 1 293 unresolved += 1
290 else: 294 else:
291 if f != fd: 295 if f != fd:
292 repo.ui.debug(_("copying %s to %s\n") % (f, fd)) 296 repo.ui.debug(_("copying %s to %s\n") % (f, fd))