comparison mercurial/filemerge.py @ 27047:e1458049dca5

filemerge: don't try to copy files known to be absent We set 'back' to None in this case, so we need to handle that as well.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 14 Nov 2015 00:00:46 -0800
parents 30b919bc49bf
children 4dc5951df1e4
comparison
equal deleted inserted replaced
27046:37fcfe52c68c 27047:e1458049dca5
598 return True, 1, False 598 return True, 1, False
599 599
600 a = repo.wjoin(fd) 600 a = repo.wjoin(fd)
601 b = temp("base", fca) 601 b = temp("base", fca)
602 c = temp("other", fco) 602 c = temp("other", fco)
603 back = cmdutil.origpath(ui, repo, a) 603 if not fcd.isabsent():
604 if premerge: 604 back = cmdutil.origpath(ui, repo, a)
605 util.copyfile(a, back) 605 if premerge:
606 util.copyfile(a, back)
607 else:
608 back = None
606 files = (a, b, c, back) 609 files = (a, b, c, back)
607 610
608 r = 1 611 r = 1
609 try: 612 try:
610 markerstyle = ui.config('ui', 'mergemarkers', 'basic') 613 markerstyle = ui.config('ui', 'mergemarkers', 'basic')
628 if onfailure: 631 if onfailure:
629 ui.warn(onfailure % fd) 632 ui.warn(onfailure % fd)
630 633
631 return True, r, deleted 634 return True, r, deleted
632 finally: 635 finally:
633 if not r: 636 if not r and back is not None:
634 util.unlink(back) 637 util.unlink(back)
635 util.unlink(b) 638 util.unlink(b)
636 util.unlink(c) 639 util.unlink(c)
637 640
638 def _check(r, ui, tool, fcd, files): 641 def _check(r, ui, tool, fcd, files):
653 r = 1 656 r = 1
654 657
655 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or 658 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
656 'changed' in 659 'changed' in
657 _toollist(ui, tool, "check")): 660 _toollist(ui, tool, "check")):
658 if filecmp.cmp(a, back): 661 if back is not None and filecmp.cmp(a, back):
659 if ui.promptchoice(_(" output file %s appears unchanged\n" 662 if ui.promptchoice(_(" output file %s appears unchanged\n"
660 "was merge successful (yn)?" 663 "was merge successful (yn)?"
661 "$$ &Yes $$ &No") % fd, 1): 664 "$$ &Yes $$ &No") % fd, 1):
662 r = 1 665 r = 1
663 666
664 if _toolbool(ui, tool, "fixeol"): 667 if back is not None and _toolbool(ui, tool, "fixeol"):
665 _matcheol(a, back) 668 _matcheol(a, back)
666 669
667 return r 670 return r
668 671
669 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None): 672 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):