/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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-26 08:52:24 UTC
  • mfrom: (2298.1.1 trivial)
  • Revision ID: pqm@pqm.ubuntu.com-20070226085224-84d4ff0445f116f8
(mbp,r=aaron) tests for merge_modified

Show diffs side-by-side

added added

removed removed

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