dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00737
Re: dulwich porcelain
>>> Here is the push code:
>>>
>>> from dulwich.repo import Repo
>>> from dulwich.client import get_transport_and_path
>>> from getopt import getopt
>>> import sys
>>>
>>>
>>> def push(args):
>>> opts, args = getopt(args, "", [])
>>> opts = dict(opts)
>>> client, path = get_transport_and_path(args.pop(0))
>>> r = Repo(".")
>>> objsto = r.object_store
>>> refs = client.send_pack(path,
>>> objsto.determine_wants_all,
>>> objsto.generate_pack_contents,
>>> sys.stdout.write)
>>>
>>> and the traceback pushing to github over SSH
>>> (git@xxxxxxxxxx:mikofski/dulwichPorcelain) reads something like
>>> this ...
>>>
>>> in client.py at line 289:
>>> for refname in set(new_refs.keys() + old_refs.keys()):
>>> 'List' has no attribute 'keys'
>>> from client.py at line 450-451:
>>> (have, want) = self._handle_receive_pack_head(proto,
>>> negotiated_capabilities, old_refs, new_refs)
>>> from dulwich_push at line 16:
>>> progress=sys.stdout.write
>>> from stdin at line 1
>>> push(['git@xxxxxxxxxx:mikofski/dulwichPorcelain'])
>>>
>> So when I use send_pack, I use determine_wants_all from repo.object_
>> store, which is returning an empty list, but it should be a dictionary
>> of {refs:shas}. When _handle_receive_pack_head is called it tries to get
>> the keys and bam, AttributeError.
>>
>> But I have 4 refs/shas in .git/objects by using bin/dulwich commit?
> So, the signature for determine_wants is different for send_pack and
> receive_pack. determine_wants_all is meant to be used with the pack
> receiver.
>
> We should really rename the determine_wants argument for send_pack to
> avoid this confusion.
>
> Cheers,
>
> jelmer
>
Hi Jelmer,
So what is supposed to be used with send_pack? Should I modify or write
my own determine_wants_all for send_pack that returns the dictionary as
requested?
Is new_refs *all* of the refs in objects? or is it only the ones that are not
_old_?
For example, I have 4 ref:shas in objects. One commit is already on the
remote, because it was there when I cloned it. So I assume that's old_ref.
Now is new_refs the 3 remaining refs in objects, not including the one
already on the remote? I really need to learn a lot more about git plumbing!
Thanks!
--Mark
Follow ups
References