/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 fetch.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-02 01:59:40 UTC
  • mfrom: (0.200.1791 work)
  • mto: (0.200.1795 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180302015940-41gwnoymxc2go3bq
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
635
635
        raise NotImplementedError(self.fetch_objects)
636
636
 
637
637
    def fetch(self, revision_id=None, find_ghosts=False,
638
 
              mapping=None, fetch_spec=None):
 
638
              mapping=None, fetch_spec=None, include_tags=False):
639
639
        if mapping is None:
640
640
            mapping = self.source.get_mapping()
641
641
        if revision_id is not None:
652
652
 
653
653
        if interesting_heads is not None:
654
654
            determine_wants = self.get_determine_wants_revids(
655
 
                interesting_heads, include_tags=False)
 
655
                interesting_heads, include_tags=include_tags)
656
656
        else:
657
657
            determine_wants = self.determine_wants_all
658
658
 
838
838
        return set([sha for sha in shas if sha in self.target._git.object_store])
839
839
 
840
840
    def fetch(self, revision_id=None, find_ghosts=False,
841
 
              mapping=None, fetch_spec=None, branches=None, limit=None):
 
841
              mapping=None, fetch_spec=None, branches=None, limit=None, include_tags=False):
842
842
        if mapping is None:
843
843
            mapping = self.source.get_mapping()
844
844
        r = self.target._git
845
845
        if revision_id is not None:
846
 
            args = [self.source.lookup_bzr_revision_id(revision_id)[0]]
 
846
            args = [revision_id]
847
847
        elif fetch_spec is not None:
848
848
            recipe = fetch_spec.get_recipe()
849
849
            if recipe[0] in ("search", "proxy-search"):
851
851
            else:
852
852
                raise AssertionError(
853
853
                    "Unsupported search result type %s" % recipe[0])
854
 
            args = [self.source.lookup_bzr_revision_id(revid)[0] for revid in heads]
 
854
            args = heads
855
855
        if branches is not None:
856
 
            determine_wants = lambda x: [x[y] for y in branches if not x[y] in r.object_store and x[y] != ZERO_SHA]
 
856
            def determine_wants(refs):
 
857
                ret = []
 
858
                for name, value in refs.as_dict().iteritems():
 
859
                    if value == ZERO_SHA:
 
860
                        continue
 
861
 
 
862
                    if name in branches or (include_tags and is_tag(name)):
 
863
                        ret.append(value)
 
864
                return ret
857
865
        elif fetch_spec is None and revision_id is None:
858
866
            determine_wants = self.determine_wants_all
859
867
        else:
860
 
            determine_wants = lambda x: [y for y in args if not y in r.object_store and y != ZERO_SHA]
 
868
            determine_wants = self.get_determine_wants_revids(args, include_tags=include_tags)
861
869
        wants_recorder = DetermineWantsRecorder(determine_wants)
862
870
        self.fetch_objects(wants_recorder, mapping, limit=limit)
863
871
        return wants_recorder.remote_refs