~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2007-03-05 03:43:56 UTC
  • mfrom: (2312 +trunk)
  • mto: (2255.11.6 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070305034356-og43j35eg62m952f
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
785
785
                yield Stanza(file_id=file_id.decode('utf8'), hash=hash)
786
786
        self._put_rio('merge-hashes', iter_stanzas(), MERGE_MODIFIED_HEADER_1)
787
787
 
788
 
    @needs_tree_write_lock
789
788
    def _put_rio(self, filename, stanzas, header):
 
789
        self._must_be_locked()
790
790
        my_file = rio_file(stanzas, header)
791
791
        self._control_files.put(filename, my_file)
792
792
 
837
837
 
838
838
    @needs_read_lock
839
839
    def merge_modified(self):
 
840
        """Return a dictionary of files modified by a merge.
 
841
 
 
842
        The list is initialized by WorkingTree.set_merge_modified, which is 
 
843
        typically called after we make some automatic updates to the tree
 
844
        because of a merge.
 
845
 
 
846
        This returns a map of file_id->sha1, containing only files which are
 
847
        still in the working inventory and have that text hash.
 
848
        """
840
849
        try:
841
850
            hashfile = self._control_files.get('merge-hashes')
842
851
        except errors.NoSuchFile:
851
860
            file_id = s.get("file_id")
852
861
            if file_id not in self.inventory:
853
862
                continue
854
 
            hash = s.get("hash")
855
 
            if hash == self.get_file_sha1(file_id):
856
 
                merge_hashes[file_id] = hash
 
863
            text_hash = s.get("hash")
 
864
            if text_hash == self.get_file_sha1(file_id):
 
865
                merge_hashes[file_id] = text_hash
857
866
        return merge_hashes
858
867
 
859
868
    @needs_write_lock
1526
1535
    def is_locked(self):
1527
1536
        return self._control_files.is_locked()
1528
1537
 
 
1538
    def _must_be_locked(self):
 
1539
        if not self.is_locked():
 
1540
            raise errors.ObjectNotLocked(self)
 
1541
 
1529
1542
    def lock_read(self):
1530
1543
        """See Branch.lock_read, and WorkingTree.unlock."""
1531
1544
        self.branch.lock_read()