-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide example for Reference.log_append
I would have found this useful when trying to do reflog additions. It might not be massively complex but examples always help.
- Loading branch information
1 parent
7296b92
commit 1f111c0
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,23 @@ The Reference type | |
.. automethod:: pygit2.Reference.resolve | ||
.. automethod:: pygit2.Reference.log | ||
.. automethod:: pygit2.Reference.log_append | ||
|
||
Example:: | ||
|
||
>>> branch = repository.lookup_reference("refs/heads/master") | ||
>>> branch.target = another_commit.id | ||
>>> committer = Signature('Cecil Committer', '[email protected]') | ||
>>> branch.log_append(another_commit.id, committer, | ||
"changed branch target using pygit2") | ||
|
||
This creates a reflog entry in ``git reflog master`` which looks like:: | ||
|
||
7296b92 master@{10}: changed branch target using pygit2 | ||
|
||
In order to make an entry in ``git reflog``, ie. the reflog for ``HEAD``, you | ||
have to get the Reference object for ``HEAD`` and call ``log_append`` on | ||
that. | ||
|
||
.. automethod:: pygit2.Reference.get_object | ||
|
||
|
||
|