~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/bundle_data.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 19:58:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713195822-965e2c4422506a75
cleanup pass, allow pycurl connections to be shared between transports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
            if repository.has_revision(revision_id):
224
224
                testament = StrictTestament.from_revision(repository, 
225
225
                                                          revision_id)
226
 
                local_sha1 = self._testament_sha1_from_revision(repository,
227
 
                                                                revision_id)
 
226
                local_sha1 = testament.as_sha1()
228
227
                if sha1 != local_sha1:
229
228
                    raise BzrError('sha1 mismatch. For revision id {%s}' 
230
229
                            'local: %s, bundle: %s' % (revision_id, local_sha1, sha1))
282
281
        rev_info = self.get_revision_info(revision_id)
283
282
        assert rev.revision_id == rev_info.revision_id
284
283
        assert rev.revision_id == revision_id
285
 
        sha1 = self._testament_sha1(rev, inventory)
 
284
        sha1 = StrictTestament(rev, inventory).as_sha1()
286
285
        if sha1 != rev_info.sha1:
287
286
            raise TestamentMismatch(rev.revision_id, rev_info.sha1, sha1)
288
 
        if rev.revision_id in rev_to_sha1:
 
287
        if rev_to_sha1.has_key(rev.revision_id):
289
288
            raise BzrError('Revision {%s} given twice in the list'
290
289
                    % (rev.revision_id))
291
290
        rev_to_sha1[rev.revision_id] = sha1
446
445
 
447
446
    def note_rename(self, old_path, new_path):
448
447
        """A file/directory has been renamed from old_path => new_path"""
449
 
        assert new_path not in self._renamed
450
 
        assert old_path not in self._renamed_r
 
448
        assert not self._renamed.has_key(new_path)
 
449
        assert not self._renamed_r.has_key(old_path)
451
450
        self._renamed[new_path] = old_path
452
451
        self._renamed_r[old_path] = new_path
453
452
 
458
457
        self._kinds[new_id] = kind
459
458
 
460
459
    def note_last_changed(self, file_id, revision_id):
461
 
        if (file_id in self._last_changed
 
460
        if (self._last_changed.has_key(file_id)
462
461
                and self._last_changed[file_id] != revision_id):
463
462
            raise BzrError('Mismatched last-changed revision for file_id {%s}'
464
463
                    ': %s != %s' % (file_id,
501
500
            old_path = new_path
502
501
        #If the new path wasn't in renamed, the old one shouldn't be in
503
502
        #renamed_r
504
 
        if old_path in self._renamed_r:
 
503
        if self._renamed_r.has_key(old_path):
505
504
            return None
506
505
        return old_path 
507
506
 
513
512
        new_path = self._renamed_r.get(old_path)
514
513
        if new_path is not None:
515
514
            return new_path
516
 
        if new_path in self._renamed:
 
515
        if self._renamed.has_key(new_path):
517
516
            return None
518
517
        dirname,basename = os.path.split(old_path)
519
518
        if dirname != '':
526
525
            new_path = old_path
527
526
        #If the old path wasn't in renamed, the new one shouldn't be in
528
527
        #renamed_r
529
 
        if new_path in self._renamed:
 
528
        if self._renamed.has_key(new_path):
530
529
            return None
531
530
        return new_path 
532
531
 
540
539
            return None
541
540
        if old_path in self.deleted:
542
541
            return None
543
 
        if getattr(self.base_tree, 'path2id', None) is not None:
 
542
        if hasattr(self.base_tree, 'path2id'):
544
543
            return self.base_tree.path2id(old_path)
545
544
        else:
546
545
            return self.base_tree.inventory.path2id(old_path)
578
577
                then be cached.
579
578
        """
580
579
        base_id = self.old_contents_id(file_id)
581
 
        if (base_id is not None and
582
 
            base_id != self.base_tree.inventory.root.file_id):
 
580
        if base_id is not None:
583
581
            patch_original = self.base_tree.get_file(base_id)
584
582
        else:
585
583
            patch_original = None
654
652
            inv = Inventory(root_id, self.revision_id)
655
653
        except TypeError:
656
654
            inv = Inventory(revision_id=self.revision_id)
657
 
        inv.root.revision = self.get_last_changed(root_id)
658
655
 
659
656
        def add_entry(file_id):
660
657
            path = self.id2path(file_id)