forked from jelmer/dulwich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ollow flake8, pylint, pymy and other lint, style python code. Issue 811
- Loading branch information
1 parent
8bdcf9e
commit 3378f7e
Showing
4 changed files
with
39 additions
and
27 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
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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
#!/usr/bin/python | ||
# This trivial script demonstrates how to extract the unified diff for a single | ||
# commit in a local repository. | ||
# | ||
# Example usage: | ||
# python examples/diff.py | ||
"""Diff. | ||
This trivial script demonstrates how to extract the unified diff for a single | ||
commit in a local repository. | ||
Example usage: | ||
python examples/diff.py | ||
""" | ||
|
||
import sys | ||
|
||
from dulwich.repo import Repo | ||
|
||
from dulwich.patch import write_tree_diff | ||
import sys | ||
|
||
repo_path = "." | ||
commit_id = b"a6602654997420bcfd0bee2a0563d9416afe34b4" | ||
|
||
r = Repo(repo_path) | ||
REPO_PATH = "." | ||
COMMIT_ID = b"a6602654997420bcfd0bee2a0563d9416afe34b4" | ||
|
||
REPOSITORY = Repo(REPO_PATH) | ||
|
||
commit = r[commit_id] | ||
parent_commit = r[commit.parents[0]] | ||
commit = REPOSITORY[COMMIT_ID] | ||
parent_commit = REPOSITORY[commit.parents[0]] | ||
outstream = getattr(sys.stdout, 'buffer', sys.stdout) | ||
write_tree_diff(outstream, r.object_store, parent_commit.tree, commit.tree) | ||
write_tree_diff( | ||
outstream, REPOSITORY.object_store, parent_commit.tree, commit.tree) |
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
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