dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00708
Deleting a remote branch via Dulwich?
Hello, I am trying to patch the "hg-git" project, which is based on
Dulwich. I do not understand very much about what I am doing and am mostly
working by studying the surrounding code. What I am trying to do is add a
feature where I delete a remote branch by name.
As far as I can tell, the way I'm meant to communicate with the server is
to call
client.send_pack(path, changed, genpack)
where client is a GitClient object, path is the appropriate git path,
"changed" is a method taking a dictionary of branch-name
->branch-points-to-rev and returning a new dictionary describing same, and
"genpack" is dulwich.object_store.BaseObjectStore.generate_pack_contents.
The existing hg-git code uses this interface to upload objects and assign
refs.
How can I use the GitClient object to *delete* a ref, though?
It seems like there must be some way to do it using the send_pack
interface, because if my "changed" method returns {} it, um, deletes all
remote branches except "master". However I can't seem to get this to
function as something a little more fine grained than a "delete everything"
switch. If I have "changed" return the passed-in refs dictionary minus the
branch name I want to delete, it appears to leave the branch unperturbed on
the remote server.
I read the Dulwich tutorial but it didn't seem to address this sort of
thing. Any advice or links to further reading would be appreciated. Thanks!
Follow ups