##// END OF EJS Templates
filemerge: deindent the parts of filemerge outside the try block...
Siddharth Agarwal -
r26608:ae5b60d3 default
parent child Browse files
Show More
@@ -448,65 +448,64 b' def _filemerge(premerge, repo, mynode, o'
448 448 Returns whether the merge is complete, and the return value of the merge.
449 449 """
450 450
451 if True:
452 def temp(prefix, ctx):
453 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
454 (fd, name) = tempfile.mkstemp(prefix=pre)
455 data = repo.wwritedata(ctx.path(), ctx.data())
456 f = os.fdopen(fd, "wb")
457 f.write(data)
458 f.close()
459 return name
451 def temp(prefix, ctx):
452 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
453 (fd, name) = tempfile.mkstemp(prefix=pre)
454 data = repo.wwritedata(ctx.path(), ctx.data())
455 f = os.fdopen(fd, "wb")
456 f.write(data)
457 f.close()
458 return name
460 459
461 if not fco.cmp(fcd): # files identical?
462 return True, None
460 if not fco.cmp(fcd): # files identical?
461 return True, None
463 462
464 ui = repo.ui
465 fd = fcd.path()
466 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
467 symlink = 'l' in fcd.flags() + fco.flags()
468 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
469 if tool in internals and tool.startswith('internal:'):
470 # normalize to new-style names (':merge' etc)
471 tool = tool[len('internal'):]
472 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
473 (tool, fd, binary, symlink))
463 ui = repo.ui
464 fd = fcd.path()
465 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
466 symlink = 'l' in fcd.flags() + fco.flags()
467 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
468 if tool in internals and tool.startswith('internal:'):
469 # normalize to new-style names (':merge' etc)
470 tool = tool[len('internal'):]
471 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
472 (tool, fd, binary, symlink))
474 473
475 if tool in internals:
476 func = internals[tool]
477 mergetype = func.mergetype
478 onfailure = func.onfailure
479 precheck = func.precheck
480 else:
481 func = _xmerge
482 mergetype = fullmerge
483 onfailure = _("merging %s failed!\n")
484 precheck = None
474 if tool in internals:
475 func = internals[tool]
476 mergetype = func.mergetype
477 onfailure = func.onfailure
478 precheck = func.precheck
479 else:
480 func = _xmerge
481 mergetype = fullmerge
482 onfailure = _("merging %s failed!\n")
483 precheck = None
485 484
486 toolconf = tool, toolpath, binary, symlink
485 toolconf = tool, toolpath, binary, symlink
487 486
488 if mergetype == nomerge:
489 return True, func(repo, mynode, orig, fcd, fco, fca, toolconf)
487 if mergetype == nomerge:
488 return True, func(repo, mynode, orig, fcd, fco, fca, toolconf)
490 489
491 if orig != fco.path():
492 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
493 else:
494 ui.status(_("merging %s\n") % fd)
490 if orig != fco.path():
491 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
492 else:
493 ui.status(_("merging %s\n") % fd)
495 494
496 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
495 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
497 496
498 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
499 toolconf):
500 if onfailure:
501 ui.warn(onfailure % fd)
502 return True, 1
497 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
498 toolconf):
499 if onfailure:
500 ui.warn(onfailure % fd)
501 return True, 1
503 502
504 a = repo.wjoin(fd)
505 b = temp("base", fca)
506 c = temp("other", fco)
507 back = a + ".orig"
508 util.copyfile(a, back)
509 files = (a, b, c, back)
503 a = repo.wjoin(fd)
504 b = temp("base", fca)
505 c = temp("other", fco)
506 back = a + ".orig"
507 util.copyfile(a, back)
508 files = (a, b, c, back)
510 509
511 510 r = 1
512 511 try:
General Comments 0
You need to be logged in to leave comments. Login now