Fix handling of commands with arguments in paramiko SSH client.
[jelmer/dulwich.git] / examples / diff.py
1 #!/usr/bin/python
2 # This trivial script demonstrates how to extract the unified diff for a single
3 # commit in a local repository.
4 #
5 # Example usage:
6 #  python examples/diff.py
7
8 from dulwich.repo import Repo
9 from dulwich.patch import write_tree_diff
10 import sys
11
12 repo_path = "."
13 commit_id = "a6602654997420bcfd0bee2a0563d9416afe34b4"
14
15 r = Repo(repo_path)
16
17 commit = r[commit_id]
18 parent_commit = r[commit.parents[0]]
19 write_tree_diff(sys.stdout, r.object_store, parent_commit.tree, commit.tree)