429
431
def __ne__(self, other):
430
432
return not (self == other)
434
def dump_file(self, temp_dir, name, tree):
435
out_path = os.path.join(temp_dir, name)
436
out_file = file(out_path, "wb")
437
in_file = tree.get_file(self.file_id)
432
442
def apply(self, filename, conflict_handler, reverse=False):
433
new_file = filename+".new"
434
base_file = self.base.readonly_path(self.file_id)
435
other_file = self.other.readonly_path(self.file_id)
442
status = patch.diff3(new_file, filename, base, other)
444
os.chmod(new_file, os.stat(filename).st_mode)
445
rename(new_file, filename)
449
def get_lines(filename):
450
my_file = file(filename, "rb")
451
lines = my_file.readlines()
454
base_lines = get_lines(base)
455
other_lines = get_lines(other)
456
conflict_handler.merge_conflict(new_file, filename, base_lines,
443
temp_dir = mkdtemp(prefix="bzr-")
445
new_file = filename+".new"
446
base_file = self.dump_file(temp_dir, "base", self.base)
447
other_file = self.dump_file(temp_dir, "other", self.other)
454
status = patch.diff3(new_file, filename, base, other)
456
os.chmod(new_file, os.stat(filename).st_mode)
457
rename(new_file, filename)
461
def get_lines(filename):
462
my_file = file(filename, "rb")
463
lines = my_file.readlines()
466
base_lines = get_lines(base)
467
other_lines = get_lines(other)
468
conflict_handler.merge_conflict(new_file, filename, base_lines,