~jelmer/brz-git/extras-badfileenc

« back to all changes in this revision

Viewing changes to fetch.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-03-08 03:11:49 UTC
  • mfrom: (1833.1.1 remote-helper-fixes)
  • Revision ID: breezy.the.bot@gmail.com-20180308031149-ay9yll13atddxcqo
Various git remote helper fixes.

Merged from https://code.launchpad.net/~jelmer/brz-git/remote-helper-fixes/+merge/341082

Show diffs side-by-side

added added

removed removed

Lines of Context:
624
624
            wants.add(git_sha)
625
625
        return self.get_determine_wants_heads(wants, include_tags=include_tags)
626
626
 
627
 
    def fetch_objects(self, determine_wants, mapping, limit=None):
 
627
    def fetch_objects(self, determine_wants, mapping, limit=None, lossy=False):
628
628
        """Fetch objects from a remote server.
629
629
 
630
630
        :param determine_wants: determine_wants callback
699
699
        map(all_parents.update, parent_map.itervalues())
700
700
        return set(all_revs) - all_parents
701
701
 
702
 
    def fetch_objects(self, determine_wants, mapping, limit=None):
 
702
    def fetch_objects(self, determine_wants, mapping, limit=None, lossy=False):
703
703
        """See `InterGitNonGitRepository`."""
704
704
        store = BazaarObjectStore(self.target, mapping)
705
705
        store.lock_write()
714
714
            try:
715
715
                objects_iter = self.source.fetch_objects(
716
716
                    wants_recorder, graph_walker, store.get_raw,
717
 
                    progress=lambda text: report_git_progress(pb, text))
 
717
                    progress=lambda text: report_git_progress(pb, text),)
718
718
                trace.mutter("Importing %d new revisions",
719
719
                             len(wants_recorder.wants))
720
720
                (pack_hint, last_rev) = import_git_objects(self.target,
744
744
    """InterRepository that copies revisions from a local Git into a non-Git
745
745
    repository."""
746
746
 
747
 
    def fetch_objects(self, determine_wants, mapping, limit=None):
 
747
    def fetch_objects(self, determine_wants, mapping, limit=None, lossy=False):
748
748
        """See `InterGitNonGitRepository`."""
749
749
        remote_refs = self.source.controldir.get_refs_container()
750
750
        wants = determine_wants(remote_refs)
790
790
            new_refs = update_refs(old_refs)
791
791
            ref_changes.update(new_refs)
792
792
            return [sha1 for (sha1, bzr_revid) in new_refs.itervalues()]
793
 
        self.fetch_objects(determine_wants)
 
793
        self.fetch_objects(determine_wants, lossy=lossy)
794
794
        for k, (git_sha, bzr_revid) in ref_changes.iteritems():
795
795
            self.target._git.refs[k] = git_sha
796
796
        new_refs = self.target.controldir.get_refs_container()
797
797
        return None, old_refs, new_refs
798
798
 
799
 
    def fetch_objects(self, determine_wants, mapping=None, limit=None):
 
799
    def fetch_objects(self, determine_wants, mapping=None, limit=None, lossy=False):
 
800
        if lossy:
 
801
            raise errors.LossyPushToSameVCS(self.source, self.target)
800
802
        if limit is not None:
801
803
            raise errors.FetchLimitUnsupported(self)
802
804
        graphwalker = self.target._git.get_graph_walker()