'Fetch into a target repository.
:param path: Path to fetch from (as bytestring)
:param target: Target repository to fetch into
:param determine_wants: Optional function to determine what refs
to fetch. Receives dictionary of name->sha, should return
list of shas to fetch. Defaults to all shas.
:param progress: Optional progress function
:return: Dictionary with all remote refs (not just those fetched)'

def fetch(self, path, target, determine_wants=None, progress=None):

    if (determine_wants is None):
        determine_wants = target.object_store.determine_wants_all
    if (CAPABILITY_THIN_PACK in self._fetch_capabilities):
        f = BytesIO()
        def commit():
            if f.tell():
                f.seek(0)
                target.object_store.add_thin_pack(f.read, None)
        def abort():
            pass
    else:
        (f, commit, abort) = target.object_store.add_pack()
    try:
        result = self.fetch_pack(path, determine_wants, target.get_graph_walker(), f.write, progress)
    except:
        abort()
        raise
    else:
        commit()
    return result
