/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 breezy/bzr/bundle/bundle_data.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-10-13 17:31:55 UTC
  • mfrom: (7397.4.9 remove-unused)
  • Revision ID: breezy.the.bot@gmail.com-20191013173155-yoiokny4mknxb3um
Remove Tree.has_id.

Merged from https://code.launchpad.net/~jelmer/brz/remove-unused/+merge/373320

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
from ...errors import (
33
33
    TestamentMismatch,
34
34
    BzrError,
 
35
    NoSuchId,
35
36
    )
36
37
from ..inventory import (
37
38
    Inventory,
486
487
        self.patches = {}
487
488
        self._targets = {}  # new path => new symlink target
488
489
        self.deleted = []
489
 
        self.contents_by_id = True
490
490
        self.revision_id = revision_id
491
491
        self._inventory = None
492
492
 
602
602
            return path
603
603
        old_path = self.base_tree.id2path(file_id)
604
604
        if old_path is None:
605
 
            return None
 
605
            raise NoSuchId(file_id, self)
606
606
        if old_path in self.deleted:
607
 
            return None
608
 
        return self.new_path(old_path)
609
 
 
610
 
    def old_contents_id(self, file_id):
611
 
        """Return the id in the base_tree for the given file_id.
612
 
        Return None if the file did not exist in base.
613
 
        """
614
 
        if self.contents_by_id:
615
 
            if self.base_tree.has_id(file_id):
616
 
                return file_id
617
 
            else:
618
 
                return None
619
 
        new_path = self.id2path(file_id)
620
 
        return self.base_tree.path2id(new_path)
 
607
            raise NoSuchId(file_id, self)
 
608
        new_path = self.new_path(old_path)
 
609
        if new_path is None:
 
610
            raise NoSuchId(file_id, self)
 
611
        return new_path
621
612
 
622
613
    def get_file(self, path):
623
614
        """Return a file-like object containing the new contents of the
628
619
                then be cached.
629
620
        """
630
621
        file_id = self.path2id(path)
631
 
        base_id = self.old_contents_id(file_id)
632
 
        if (base_id is not None and
633
 
                base_id != self.base_tree.path2id('')):
634
 
            old_path = self.base_tree.id2path(base_id)
 
622
        try:
 
623
            old_path = self.base_tree.id2path(file_id)
 
624
        except NoSuchId:
 
625
            patch_original = None
 
626
        else:
 
627
            if old_path is None:
 
628
                import pdb; pdb.set_trace()
635
629
            patch_original = self.base_tree.get_file(old_path)
636
 
        else:
637
 
            patch_original = None
638
630
        file_patch = self.patches.get(path)
639
631
        if file_patch is None:
640
632
            if (patch_original is None and
780
772
        for result in viewitems(self._new_id):
781
773
            paths.append(result)
782
774
        for id in self.base_tree.all_file_ids():
783
 
            path = self.id2path(id)
784
 
            if path is None:
 
775
            try:
 
776
                path = self.id2path(id)
 
777
            except NoSuchId:
785
778
                continue
786
779
            paths.append((path, id))
787
780
        paths.sort()