-
Notifications
You must be signed in to change notification settings - Fork 2k
Add Dulwich to Appendinx B: embedding #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
=== Dulwich | ||
|
||
(((Dulwich)))((("Python"))) | ||
There is also a pure-Python Git implementation - Dulwich. | ||
The project is hosted under https://www.dulwich.io/ | ||
It aims to provide an interface to git repositories (both local and remote) that doesn't call out to git directly but instead uses pure Python. | ||
It has an optional C extensions though, that significantly improve the performance. | ||
|
||
Dulwich follows git design and separate two basic levels of API: plumbing and porcelain. | ||
|
||
Here is an example of using the lower level API to access the commit message of the last commit: | ||
|
||
[source, python] | ||
----- | ||
from dulwich.repo import Repo | ||
r = Repo('.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind renaming this variable to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now it's just 1-to-1 copy from https://www.dulwich.io/docs/#getting-started Please, let me know if you still think it should be change and I will be happy to do so. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. Should we make this example more readable, or easier to update? Let's stick with Dulwich's example then. |
||
r.head() | ||
# '57fbe010446356833a6ad1600059d80b1e731e15' | ||
|
||
c = r[r.head()] | ||
c | ||
# <Commit 015fc1267258458901a94d228e39f0a378370466> | ||
|
||
c.message | ||
# 'Add note about encoding.\n' | ||
----- | ||
|
||
To print a commit log using high-level porcelain API, one can use: | ||
|
||
[source, python] | ||
----- | ||
from dulwich import porcelain | ||
porcelain.log('.', max_entries=1) | ||
|
||
#commit: 57fbe010446356833a6ad1600059d80b1e731e15 | ||
#Author: Jelmer Vernooij <jelmer@jelmer.uk> | ||
#Date: Sat Apr 29 2017 23:57:34 +0000 | ||
----- | ||
|
||
|
||
==== Further Reading | ||
|
||
* The official API documentation is available at https://www.dulwich.io/apidocs/dulwich.html[] | ||
* Official tutorial at https://www.dulwich.io/docs/tutorial[] has many examples of how to do specific tasks with Dulwich |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Does this index entry require the quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not know, to be hones, I just copied it from libgit2 example.
Digging deeper, #471 seems to be a reason for those quotes.
Will be happy to remove those if you think there might be some side-effects, but I guess same logic should be applicable for go-git as well.
Let me know if you want me to remove both in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let's maybe clean them up in a separate PR then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #1096 created