|
@@ -34,6 +34,7 @@ from dulwich.client import get_transport_and_path
|
|
|
from dulwich.errors import ApplyDeltaError
|
|
|
from dulwich.index import Index
|
|
|
from dulwich.pack import Pack, sha_to_hex
|
|
|
+from dulwich.patch import write_tree_diff
|
|
|
from dulwich.repo import Repo
|
|
|
from dulwich.server import update_server_info
|
|
|
|
|
@@ -98,6 +99,20 @@ def cmd_log(args):
|
|
|
todo.extend([p for p in commit.parents if p not in done])
|
|
|
|
|
|
|
|
|
+def cmd_diff(args):
|
|
|
+ opts, args = getopt(args, "", [])
|
|
|
+
|
|
|
+ if args == []:
|
|
|
+ print "Usage: dulwich diff COMMITID"
|
|
|
+ sys.exit(1)
|
|
|
+
|
|
|
+ r = Repo(".")
|
|
|
+ commit_id = args[0]
|
|
|
+ commit = r[commit_id]
|
|
|
+ parent_commit = r[commit.parents[0]]
|
|
|
+ write_tree_diff(sys.stdout, r.object_store, parent_commit.tree, commit.tree)
|
|
|
+
|
|
|
+
|
|
|
def cmd_dump_pack(args):
|
|
|
opts, args = getopt(args, "", [])
|
|
|
|
|
@@ -203,6 +218,7 @@ commands = {
|
|
|
"clone": cmd_clone,
|
|
|
"archive": cmd_archive,
|
|
|
"update-server-info": cmd_update_server_info,
|
|
|
+ "diff": cmd_diff,
|
|
|
}
|
|
|
|
|
|
if len(sys.argv) < 2:
|