~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2007-07-05 15:39:34 UTC
  • mto: (2590.2.12 changes-merge)
  • mto: This revision was merged to the branch mainline in revision 2603.
  • Revision ID: abentley@panoramicfeedback.com-20070705153934-ap3nxs9fa9u8yvfr
Merge the execute bit based on iter_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
464
464
                        entry = this_tree.inventory[file_id]
465
465
                        this_name = entry.name
466
466
                        this_parent = entry.parent_id
 
467
                        this_executable = entry.executable
467
468
                    else:
468
469
                        this_name = None
469
470
                        this_parent = None
470
 
 
471
 
                    self._merge_names(file_id, parents + (this_parent,),
472
 
                                      names + (this_name,))
473
 
                    file_status = self.merge_contents(file_id)
474
 
                    self.merge_executable(file_id, file_status)
 
471
                        this_executable = None
 
472
                    parents3 = parents + (this_parent,)
 
473
                    names3 = names + (this_name,)
 
474
                    executable3 = executable + (this_executable,)
 
475
                    self._merge_names(file_id, parents3, names3)
 
476
                    if changed:
 
477
                        file_status = self.merge_contents(file_id)
 
478
                    else:
 
479
                        file_status = 'unmodified'
 
480
                    self._merge_executable(file_id,
 
481
                        executable3, file_status)
475
482
            finally:
476
483
                child_pb.finished()
477
484
            self.fix_root()
830
837
 
831
838
    def merge_executable(self, file_id, file_status):
832
839
        """Perform a merge on the execute bit."""
 
840
        executable = [self.executable(t, file_id) for t in (self.base_tree,
 
841
                      self.other_tree, self.this_tree)]
 
842
        self._merge_executable(file_id, executable, file_status)
 
843
 
 
844
    def _merge_executable(self, file_id, executable, file_status):
 
845
        """Perform a merge on the execute bit."""
 
846
        base_executable, other_executable, this_executable = executable
833
847
        if file_status == "deleted":
834
848
            return
835
849
        trans_id = self.tt.trans_id_file_id(file_id)
838
852
                return
839
853
        except NoSuchFile:
840
854
            return
841
 
        winner = self.scalar_three_way(self.this_tree, self.base_tree, 
842
 
                                       self.other_tree, file_id, 
843
 
                                       self.executable)
 
855
        winner = self._three_way(*executable)
844
856
        if winner == "conflict":
845
857
        # There must be a None in here, if we have a conflict, but we
846
858
        # need executability since file status was not deleted.
850
862
                winner = "other"
851
863
        if winner == "this":
852
864
            if file_status == "modified":
853
 
                executability = self.this_tree.is_executable(file_id)
 
865
                executability = this_executable
854
866
                if executability is not None:
855
867
                    trans_id = self.tt.trans_id_file_id(file_id)
856
868
                    self.tt.set_executability(executability, trans_id)
857
869
        else:
858
870
            assert winner == "other"
859
871
            if file_id in self.other_tree:
860
 
                executability = self.other_tree.is_executable(file_id)
 
872
                executability = other_executable
861
873
            elif file_id in self.this_tree:
862
 
                executability = self.this_tree.is_executable(file_id)
 
874
                executability = this_executable
863
875
            elif file_id in self.base_tree:
864
 
                executability = self.base_tree.is_executable(file_id)
 
876
                executability = base_executable
865
877
            if executability is not None:
866
878
                trans_id = self.tt.trans_id_file_id(file_id)
867
879
                self.tt.set_executability(executability, trans_id)