On Thu, Dec 06, 2012 at 02:34:39PM -0000, dom 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?
This code still assumes full packs. You'll want to use
localrepo.object_store.add_thin_pack rather than
localrepo.object_store.add_pack.
A trivial way to do it would be to create a temporary file/StringIO,
have fetch_pack write into that and then pass the read method on that
object to add_thin_pack.
On Thu, Dec 06, 2012 at 02:34:39PM -0000, dom wrote: wants(heads) : update( new_refs) itervalues( )] /github. com/fmarier/ django- csp.git' csp\\.git' ) get_graph_ walker( ) object_ store.add_ pack() fetch_pack( url, object_ store.add_ thin_pack rather than object_ store.add_ pack.
> 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_
> old_refs = dict([(k, (v, None)) for (k, v) in heads.iteritems()])
> new_refs = old_refs
> ref_changes.
> return [sha1 for (sha1, bzr_revid) in new_refs.
>
> def process(text):
> print text
>
> repo = Repo('django-csp')
> url = 'https:/
> client = HttpGitClient(url)
>
> localrepo = Repo('django-
> graphwalker = localrepo.
> f, commit = localrepo.
> refs = client.
> 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?
This code still assumes full packs. You'll want to use
localrepo.
localrepo.
A trivial way to do it would be to create a temporary file/StringIO,
have fetch_pack write into that and then pass the read method on that
object to add_thin_pack.
Cheers,
Jelmer