summaryrefslogtreecommitdiff
path: root/rbtools/postreview.py
diff options
context:
space:
mode:
Diffstat (limited to 'rbtools/postreview.py')
-rwxr-xr-xrbtools/postreview.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/rbtools/postreview.py b/rbtools/postreview.py
index db91b82..4411e86 100755
--- a/rbtools/postreview.py
+++ b/rbtools/postreview.py
@@ -2093,7 +2093,34 @@ class GitClient(SCMClient):
return diff_data
def diff_between_revisions(self, revision_range, args, repository_info):
- pass
+ """Perform a diff between two arbitrary revisions"""
+ if ":" not in revision_range:
+ # only one revision is specified
+ if options.guess_summary and not options.summary:
+ options.summary = execute(
+ ["git", "log", "--pretty=format:%s", revision_range + ".."],
+ ignore_errors=True).strip()
+
+ if options.guess_description and not options.description:
+ options.description = execute(
+ ["git", "log", "--pretty=format:%s%n%n%b", revision_range + ".."],
+ ignore_errors=True).strip()
+
+ return self.make_diff(revision_range)
+ else:
+ r1, r2 = revision_range.split(":")
+
+ if options.guess_summary and not options.summary:
+ options.summary = execute(
+ ["git", "log", "--pretty=format:%s", "%s..%s" % (r1, r2)],
+ ignore_errors=True).strip()
+
+ if options.guess_description and not options.description:
+ options.description = execute(
+ ["git", "log", "--pretty=format:%s%n%n%b", "%s..%s" % (r1, r2)],
+ ignore_errors=True).strip()
+
+ return self.make_diff(r1, r2)
SCMCLIENTS = (