/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/workingtree.py

merge merge_modified test and cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
794
794
                yield Stanza(file_id=file_id.decode('utf8'), hash=hash)
795
795
        self._put_rio('merge-hashes', iter_stanzas(), MERGE_MODIFIED_HEADER_1)
796
796
 
797
 
    @needs_tree_write_lock
798
797
    def _put_rio(self, filename, stanzas, header):
 
798
        self._must_be_locked()
799
799
        my_file = rio_file(stanzas, header)
800
800
        self._control_files.put(filename, my_file)
801
801
 
847
847
 
848
848
    @needs_read_lock
849
849
    def merge_modified(self):
 
850
        """Return a dictionary of files modified by a merge.
 
851
 
 
852
        The list is initialized by WorkingTree.set_merge_modified, which is 
 
853
        typically called after we make some automatic updates to the tree
 
854
        because of a merge.
 
855
 
 
856
        This returns a map of file_id->sha1, containing only files which are
 
857
        still in the working inventory and have that text hash.
 
858
        """
850
859
        try:
851
860
            hashfile = self._control_files.get('merge-hashes')
852
861
        except errors.NoSuchFile:
861
870
            file_id = s.get("file_id")
862
871
            if file_id not in self.inventory:
863
872
                continue
864
 
            hash = s.get("hash")
865
 
            if hash == self.get_file_sha1(file_id):
866
 
                merge_hashes[file_id] = hash
 
873
            text_hash = s.get("hash")
 
874
            if text_hash == self.get_file_sha1(file_id):
 
875
                merge_hashes[file_id] = text_hash
867
876
        return merge_hashes
868
877
 
869
878
    @needs_write_lock
1629
1638
    def is_locked(self):
1630
1639
        return self._control_files.is_locked()
1631
1640
 
 
1641
    def _must_be_locked(self):
 
1642
        if not self.is_locked():
 
1643
            raise errors.ObjectNotLocked(self)
 
1644
 
1632
1645
    def lock_read(self):
1633
1646
        """See Branch.lock_read, and WorkingTree.unlock."""
1634
1647
        self.branch.lock_read()