~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/bundle_data.py

  • Committer: Robey Pointer
  • Date: 2006-08-29 20:47:02 UTC
  • mto: (1711.9.9 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1975.
  • Revision ID: robey@lag.net-20060829204702-6d40ae7a33ec62c7
remove usage of has_key()

Show diffs side-by-side

added added

removed removed

Lines of Context:
284
284
        sha1 = StrictTestament(rev, inventory).as_sha1()
285
285
        if sha1 != rev_info.sha1:
286
286
            raise TestamentMismatch(rev.revision_id, rev_info.sha1, sha1)
287
 
        if rev_to_sha1.has_key(rev.revision_id):
 
287
        if rev.revision_id in rev_to_sha1:
288
288
            raise BzrError('Revision {%s} given twice in the list'
289
289
                    % (rev.revision_id))
290
290
        rev_to_sha1[rev.revision_id] = sha1
445
445
 
446
446
    def note_rename(self, old_path, new_path):
447
447
        """A file/directory has been renamed from old_path => new_path"""
448
 
        assert not self._renamed.has_key(new_path)
449
 
        assert not self._renamed_r.has_key(old_path)
 
448
        assert new_path not in self._renamed
 
449
        assert old_path not in self._renamed_r
450
450
        self._renamed[new_path] = old_path
451
451
        self._renamed_r[old_path] = new_path
452
452
 
457
457
        self._kinds[new_id] = kind
458
458
 
459
459
    def note_last_changed(self, file_id, revision_id):
460
 
        if (self._last_changed.has_key(file_id)
 
460
        if (file_id in self._last_changed
461
461
                and self._last_changed[file_id] != revision_id):
462
462
            raise BzrError('Mismatched last-changed revision for file_id {%s}'
463
463
                    ': %s != %s' % (file_id,
500
500
            old_path = new_path
501
501
        #If the new path wasn't in renamed, the old one shouldn't be in
502
502
        #renamed_r
503
 
        if self._renamed_r.has_key(old_path):
 
503
        if old_path in self._renamed_r:
504
504
            return None
505
505
        return old_path 
506
506
 
512
512
        new_path = self._renamed_r.get(old_path)
513
513
        if new_path is not None:
514
514
            return new_path
515
 
        if self._renamed.has_key(new_path):
 
515
        if new_path in self._renamed:
516
516
            return None
517
517
        dirname,basename = os.path.split(old_path)
518
518
        if dirname != '':
525
525
            new_path = old_path
526
526
        #If the old path wasn't in renamed, the new one shouldn't be in
527
527
        #renamed_r
528
 
        if self._renamed.has_key(new_path):
 
528
        if new_path in self._renamed:
529
529
            return None
530
530
        return new_path 
531
531