dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00748
Re: Fetch branch
>> >> >> I thought that fetch and clone would pull all branches,
>> >> >> but it only seems to pull ref/heads/master. How could
>> >> >> I fetch all refs without knowing their shas a priori? Do
>> >> >> I need a custom graphwalker?
>> >> > They take a determine_wants() function that can determine
>> >> > what objects to fetch, and both return the full list of remote
>> >> > refs that you can use to update the local refs.
>> >> >
>> >> > Cheers,
>> >> >
>> >> > Jelmer
>> >> >
>> >>
>> >> First thanks for being so patient and answering questions in such
>> >> a positive way.
>> >> I can't seem to checkout any other branch. I followed this
>> >> thread [1] and tried
>> > I don't see a [1] ?
>>
>> [1] https://lists.launchpad.net/dulwich-users/msg00719.html ;
> That's about switching branches though, not about fetching more.
>
>> >> `r.refs.set_symbolic_ref("HEAD",
>> >> "refs/remotes/origin/porcelain")` but of course
>> >> that ref doesn't exist yet. I looked in .git/ and there is no
>
>> >> "packed-refs" folder,
>> >> but there are an "objects/pack/pack-<sha>.idx &
>> >> .pack" files. In "refs/" there is
>> >> only "refs/heads/master" no surprise. There are no
>> >> other folders.
>> > packs just contain objects, never refs.
>> How to unpack objects so that I can see their shas? If there
>> are no refs in the pack, how will I know what refs are on the
>> remote?
> The refs are returned by the function that fetches the pack, and
> they're specified as argument to the determine_wants() callback.
>
>> > Refs don't live in a pack file. You have to set them manually.
>> How can I find out what refs were set on the remote, so that I can
>> set them locally?
> The fetch function returns them.
Yes:
refs = client.fetch(host_path, r, objsto.determine_wants_all, sys.stdout.write)
does it! It was right there in the docstring!
Thanks Jelmer!
PS I noticed that you have already merged high level checkout function in launchpad
https://bugs.launchpad.net/dulwich/+bug/719026 ;
https://github.com/jelmer/dulwich/commit/e6bc1d3bf08abbce3bd1e07bb1860e116330f2fd ;
https://github.com/jelmer/dulwich/blob/master/dulwich/repo.py on line 1381
References