Comment 15 for bug 1025886

Revision history for this message
dom (dominikruf) wrote :

It's been a while but I still have this problem.
I looked into bzr-git/fetch.py and experimented a bit
I tried to following which is based on the fetch_objects method of fetch.py

from dulwich.repo import Repo
from dulwich.client import HttpGitClient
from dulwich.repo import Repo

ref_changes = {}
def determine_wants(heads):
    old_refs = dict([(k, (v, None)) for (k, v) in heads.iteritems()])
    new_refs = old_refs
    ref_changes.update(new_refs)
    return [sha1 for (sha1, bzr_revid) in new_refs.itervalues()]

def process(text):
    print text

repo = Repo('django-csp')
url = 'https://github.com/fmarier/django-csp.git'
client = HttpGitClient(url)

localrepo = Repo('django-csp\\.git')
graphwalker = localrepo.get_graph_walker()
f, commit = localrepo.object_store.add_pack()
refs = client.fetch_pack(url,
                        determine_wants, graphwalker, f.write,
                        process)
commit()

But I still get the same error(s).

Can somebody tell my what's the right/a working way to fetch remote packs and commit them to the local repository?