/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: John Arbash Meinel
  • Date: 2008-09-10 17:33:01 UTC
  • mfrom: (3698 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3701.
  • Revision ID: john@arbash-meinel.com-20080910173301-niz0pw3mcat430o1
Merge in bzr.dev 3698

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
        """Return RevisionTree for the current last revision.
380
380
        
381
381
        If the left most parent is a ghost then the returned tree will be an
382
 
        empty tree - one obtained by calling repository.revision_tree(None).
 
382
        empty tree - one obtained by calling 
 
383
        repository.revision_tree(NULL_REVISION).
383
384
        """
384
385
        try:
385
386
            revision_id = self.get_parent_ids()[0]
387
388
            # no parents, return an empty revision tree.
388
389
            # in the future this should return the tree for
389
390
            # 'empty:' - the implicit root empty tree.
390
 
            return self.branch.repository.revision_tree(None)
 
391
            return self.branch.repository.revision_tree(
 
392
                       _mod_revision.NULL_REVISION)
391
393
        try:
392
394
            return self.revision_tree(revision_id)
393
395
        except errors.NoSuchRevision:
404
406
            if self.branch.repository.has_revision(revision_id):
405
407
                raise
406
408
            # the basis tree is a ghost so return an empty tree.
407
 
            return self.branch.repository.revision_tree(None)
 
409
            return self.branch.repository.revision_tree(
 
410
                       _mod_revision.NULL_REVISION)
408
411
 
409
412
    def _cleanup(self):
410
413
        self._flush_ignore_list_cache()
897
900
            hashfile = self._transport.get('merge-hashes')
898
901
        except errors.NoSuchFile:
899
902
            return {}
900
 
        merge_hashes = {}
901
903
        try:
902
 
            if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
 
904
            merge_hashes = {}
 
905
            try:
 
906
                if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
 
907
                    raise errors.MergeModifiedFormatError()
 
908
            except StopIteration:
903
909
                raise errors.MergeModifiedFormatError()
904
 
        except StopIteration:
905
 
            raise errors.MergeModifiedFormatError()
906
 
        for s in RioReader(hashfile):
907
 
            # RioReader reads in Unicode, so convert file_ids back to utf8
908
 
            file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
909
 
            if file_id not in self.inventory:
910
 
                continue
911
 
            text_hash = s.get("hash")
912
 
            if text_hash == self.get_file_sha1(file_id):
913
 
                merge_hashes[file_id] = text_hash
914
 
        return merge_hashes
 
910
            for s in RioReader(hashfile):
 
911
                # RioReader reads in Unicode, so convert file_ids back to utf8
 
912
                file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
 
913
                if file_id not in self.inventory:
 
914
                    continue
 
915
                text_hash = s.get("hash")
 
916
                if text_hash == self.get_file_sha1(file_id):
 
917
                    merge_hashes[file_id] = text_hash
 
918
            return merge_hashes
 
919
        finally:
 
920
            hashfile.close()
915
921
 
916
922
    @needs_write_lock
917
923
    def mkdir(self, path, file_id=None):
2593
2599
        except errors.NoSuchFile:
2594
2600
            return _mod_conflicts.ConflictList()
2595
2601
        try:
2596
 
            if confile.next() != CONFLICT_HEADER_1 + '\n':
 
2602
            try:
 
2603
                if confile.next() != CONFLICT_HEADER_1 + '\n':
 
2604
                    raise errors.ConflictFormatError()
 
2605
            except StopIteration:
2597
2606
                raise errors.ConflictFormatError()
2598
 
        except StopIteration:
2599
 
            raise errors.ConflictFormatError()
2600
 
        return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
 
2607
            return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
 
2608
        finally:
 
2609
            confile.close()
2601
2610
 
2602
2611
    def unlock(self):
2603
2612
        # do non-implementation specific cleanup