Looking for assistance on replicating existing usage of GitPython code (to replace with dulwich) #1345
Replies: 2 comments 1 reply
-
My adaptation of porcelain.status to try to reduce time (6x
|
Beta Was this translation helpful? Give feedback.
-
So dulwich' porcelain module is still fairly limited in terms of what it supports. Here's some ideas for the commands you're looking at:
dulwich.porcelain.rev_list() should ideally take a range but today doesn't. You can use Repo.get_walker() and pass in include=['HEAD'], exclude=['refs/heads/origin/main']
This isn't supported at the moment (see dulwich.porcelain.log) although you could copy that function and modify it to print commits with that format.
dulwich.porcelain.reset(mode="hard") only supports resetting the index at the moment. |
Beta Was this translation helpful? Give feedback.
-
I've been digging round the docs and the code and have found some of the answers I am looking for, and others I can't get the full functionality I am after, so hoping theres a different way to achieve the same outcome.
Im including all the commands i'm looking to replicate for completeness. These are all executed in code via subprocess, so no need for direct cli replication, just a pointer to how this would be achieved in dulwich, if it can be achieved.
dulwich rev-list wants a commit id, can't see a way to check for the diff between remote and local (happy to use plumbing over porcelain if the functionality can be replicated, just need pointing to where to look)
porcelain.status can replicate what I need from
git status -s
but is 8 times slower than subprocess call to equivalent git command.porcelain.tag does not appear to sort listing (or filtering) edit: Found tag_list.
porcelain.log does not appear to support formatting, or changing the separator edit: might not need either of those as have raw commits, but can't work out how to get logs between a range.
have not looked into add/reset/commit/tag yet, but can see plumbing for those, so don't expect those to be as much of an issue.
Beta Was this translation helpful? Give feedback.
All reactions