726 edittext = self.ui.edit(edittext) |
726 edittext = self.ui.edit(edittext) |
727 n = self.changelog.add(node, new, edittext, tr, co, cn) |
727 n = self.changelog.add(node, new, edittext, tr, co, cn) |
728 |
728 |
729 tr.close() |
729 tr.close() |
730 |
730 |
|
731 def merge3(self, fl, fn, my, other, transaction, link): |
|
732 """perform a 3-way merge and append the result""" |
|
733 |
|
734 def temp(prefix, node): |
|
735 pre = "%s~%s." % (os.path.basename(fn), prefix) |
|
736 (fd, name) = tempfile.mkstemp("", pre) |
|
737 f = os.fdopen(fd, "w") |
|
738 f.write(fl.revision(node)) |
|
739 f.close() |
|
740 return name |
|
741 |
|
742 base = fl.ancestor(my, other) |
|
743 self.ui.note("resolving %s\n" % fn) |
|
744 self.ui.debug("local %s remote %s ancestor %s\n" % |
|
745 (short(my), short(other), short(base))) |
|
746 |
|
747 if my == base: |
|
748 text = fl.revision(other) |
|
749 else: |
|
750 a = temp("local", my) |
|
751 b = temp("remote", other) |
|
752 c = temp("parent", base) |
|
753 |
|
754 cmd = os.environ["HGMERGE"] |
|
755 self.ui.debug("invoking merge with %s\n" % cmd) |
|
756 r = os.system("%s %s %s %s" % (cmd, a, b, c)) |
|
757 if r: |
|
758 raise "Merge failed!" |
|
759 |
|
760 text = open(a).read() |
|
761 os.unlink(a) |
|
762 os.unlink(b) |
|
763 os.unlink(c) |
|
764 |
|
765 return fl.addrevision(text, transaction, link, my, other) |
|
766 |
731 class remoterepository: |
767 class remoterepository: |
732 def __init__(self, ui, path): |
768 def __init__(self, ui, path): |
733 self.url = path.replace("hg://", "http://", 1) |
769 self.url = path.replace("hg://", "http://", 1) |
734 self.ui = ui |
770 self.ui = ui |
735 |
771 |