~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: John Arbash Meinel
  • Date: 2008-09-24 12:53:22 UTC
  • mfrom: (3697.7.3 1.7)
  • mto: (3697.7.4 1.7)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: john@arbash-meinel.com-20080924125322-p1i7pnr0m49v1hze
Bring in the 1.7 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
900
900
            hashfile = self._transport.get('merge-hashes')
901
901
        except errors.NoSuchFile:
902
902
            return {}
903
 
        merge_hashes = {}
904
903
        try:
905
 
            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:
906
909
                raise errors.MergeModifiedFormatError()
907
 
        except StopIteration:
908
 
            raise errors.MergeModifiedFormatError()
909
 
        for s in RioReader(hashfile):
910
 
            # RioReader reads in Unicode, so convert file_ids back to utf8
911
 
            file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
912
 
            if file_id not in self.inventory:
913
 
                continue
914
 
            text_hash = s.get("hash")
915
 
            if text_hash == self.get_file_sha1(file_id):
916
 
                merge_hashes[file_id] = text_hash
917
 
        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()
918
921
 
919
922
    @needs_write_lock
920
923
    def mkdir(self, path, file_id=None):
2596
2599
        except errors.NoSuchFile:
2597
2600
            return _mod_conflicts.ConflictList()
2598
2601
        try:
2599
 
            if confile.next() != CONFLICT_HEADER_1 + '\n':
 
2602
            try:
 
2603
                if confile.next() != CONFLICT_HEADER_1 + '\n':
 
2604
                    raise errors.ConflictFormatError()
 
2605
            except StopIteration:
2600
2606
                raise errors.ConflictFormatError()
2601
 
        except StopIteration:
2602
 
            raise errors.ConflictFormatError()
2603
 
        return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
 
2607
            return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
 
2608
        finally:
 
2609
            confile.close()
2604
2610
 
2605
2611
    def unlock(self):
2606
2612
        # do non-implementation specific cleanup