/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-07 15:22:42 UTC
  • mfrom: (1843 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1846.
  • Revision ID: john@arbash-meinel.com-20060707152242-a7b5e0afd64d9d5a
[merge] bzr.dev 1843

Show diffs side-by-side

added added

removed removed

Lines of Context:
390
390
            results = self.tt.apply()
391
391
            self.write_modified(results)
392
392
            try:
393
 
                working_tree.set_conflicts(ConflictList(self.cooked_conflicts))
 
393
                working_tree.add_conflicts(self.cooked_conflicts)
394
394
            except UnsupportedOperation:
395
395
                pass
396
396
        finally:
397
 
            try:
398
 
                self.tt.finalize()
399
 
            except:
400
 
                pass
 
397
            self.tt.finalize()
401
398
            working_tree.unlock()
402
399
            self.pb.clear()
403
400
 
693
690
        if winner == "conflict":
694
691
        # There must be a None in here, if we have a conflict, but we
695
692
        # need executability since file status was not deleted.
696
 
            if self.other_tree.is_executable(file_id) is None:
 
693
            if self.executable(self.other_tree, file_id) is None:
697
694
                winner = "this"
698
695
            else:
699
696
                winner = "other"
845
842
 
846
843
class Diff3Merger(Merge3Merger):
847
844
    """Three-way merger using external diff3 for text merging"""
 
845
 
848
846
    def dump_file(self, temp_dir, name, tree, file_id):
849
847
        out_path = pathjoin(temp_dir, name)
850
 
        out_file = file(out_path, "wb")
851
 
        in_file = tree.get_file(file_id)
852
 
        for line in in_file:
853
 
            out_file.write(line)
 
848
        out_file = open(out_path, "wb")
 
849
        try:
 
850
            in_file = tree.get_file(file_id)
 
851
            for line in in_file:
 
852
                out_file.write(line)
 
853
        finally:
 
854
            out_file.close()
854
855
        return out_path
855
856
 
856
857
    def text_merge(self, file_id, trans_id):
868
869
            status = bzrlib.patch.diff3(new_file, this, base, other)
869
870
            if status not in (0, 1):
870
871
                raise BzrError("Unhandled diff3 exit code")
871
 
            self.tt.create_file(file(new_file, "rb"), trans_id)
 
872
            f = open(new_file, 'rb')
 
873
            try:
 
874
                self.tt.create_file(f, trans_id)
 
875
            finally:
 
876
                f.close()
872
877
            if status == 1:
873
878
                name = self.tt.final_name(trans_id)
874
879
                parent_id = self.tt.final_parent(trans_id)