dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00738
Re: dulwich porcelain
Am Thursday, den 13.09.2012, 15:39 -0700 schrieb Mark Mikofski:
> >>> 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?
Yes, the easiest thing to do is to write your own. This should be fairly
simple if you're just updating a single branch or copying over the refs
of another repository.
> Is new_refs *all* of the refs in objects? or is it only the ones that are not
> _old_?
It's just the changes to the refs.
> 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!
It's just the changes, though including refs that are already set (to
the same SHA1) shouldn't be harmful.
Cheers,
Jelmer
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups
References