From: Karl Hasselström Date: Tue, 29 Jan 2008 03:16:19 GMT Subject: [StGit PATCH 3/4] Teach new infrastructure to diff two trees Message-ID: <20080129031558.1177.80102.stgit@yoghurt> In-Reply-To: <20080129031310.1177.83290.stgit@yoghurt> Nothing uses this yet, but "stg edit" will soon. Signed-off-by: Karl Hasselström --- stgit/lib/git.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/stgit/lib/git.py b/stgit/lib/git.py index 9cb2521..d75f724 100644 --- a/stgit/lib/git.py +++ b/stgit/lib/git.py @@ -1,5 +1,6 @@ import os, os.path, re from stgit import exception, run, utils +from stgit.config import config class RepositoryException(exception.StgException): pass @@ -355,6 +356,11 @@ class Repository(RunWithEnv): return None finally: index.delete() + def diff_tree(self, t1, t2, diff_opts): + assert isinstance(t1, Tree) + assert isinstance(t2, Tree) + return self.run(['git', 'diff-tree', '-p'] + list(diff_opts) + + [t1.sha1, t2.sha1]).raw_output() class MergeException(exception.StgException): pass