diff options
author | David Trowbridge <trowbrds@gmail.com> | 2009-09-24 18:40:10 -0700 |
---|---|---|
committer | David Trowbridge <trowbrds@gmail.com> | 2009-09-24 18:42:08 -0700 |
commit | 6085ed147af85e3351c91bca1c809a0ad2598f76 (patch) | |
tree | 0a52b21332a867b9252fab3071ac5faa5c282686 | |
parent | c5ce0847175c5c8a03aea70d6623ee0960b6409d (diff) |
Support "revision-range" option with git
Patch from Flavio Castelli. With this patch post-review will support the
revision-range option following the syntax explained at
http://www.review-board.org/docs/manual/dev/users/tools/post-review/#posting-committed-code
Testing done:
I have tested this new feature locally and it works fine.
I have successfully tested the following commands:
post-review --revision-range=rev1:rev2 --guess-summary --guess-description
post-review --revision-range=rev1:rev2 --guess-description
post-review --revision-range=rev1:rev2
post-review --revision-range=rev --guess-summary --guess-description
post-review --revision-range=rev
Reviewed at http://reviews.review-board.org/r/1049/
-rw-r--r-- | AUTHORS | 1 | ||||
-rwxr-xr-x | rbtools/postreview.py | 29 |
2 files changed, 29 insertions, 1 deletions
@@ -9,6 +9,7 @@ Contributors: * Chris Clark * Dana Lacoste * Eric Huss + * Flavio Castelli * Jeremy Bettis * Lepton Wu * Luke Lu 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 = ( |