summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrowbrds <trowbrds@5efc13c4-1f27-0410-8691-ff2d1f55687e>2009-07-27 03:40:44 +0000
committertrowbrds <trowbrds@5efc13c4-1f27-0410-8691-ff2d1f55687e>2009-07-27 03:40:44 +0000
commit8b93139cac64225a56887ae5740cf74b3acecf24 (patch)
treeb5a69131a16f25cb341318ad8c3de065b2179b99
parent975ef607f1fcb8c375b2cf52a05db4de9460a823 (diff)
A variety of hgsubversion improvements
Corrected hgsubversion support for more recent versions of hgsubversion and add support for parent branch, guess summary, and guess description. Patch from Augie Fackler. Testing done: Been using it for over a week, haven't seen any major issues. Reviewed at http://reviews.review-board.org/r/842/
-rwxr-xr-xrbtools/postreview.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/rbtools/postreview.py b/rbtools/postreview.py
index d5cda25..a9c44be 100755
--- a/rbtools/postreview.py
+++ b/rbtools/postreview.py
@@ -1796,10 +1796,29 @@ class MercurialClient(SCMClient):
"""
Performs a diff across all modified files in a Mercurial repository.
"""
- # We don't support parent diffs with Mercurial yet, so return None
- # for the parent diff.
+ # We don't support parent diffs with Mercurial yet, so we always
+ # return None for the parent diff.
if self.type == 'svn':
- return (execute(["hg", "svn", "diff", ]), None)
+ parent = execute(['hg', 'parent', '--svn', '--template',
+ '{node}\n']).strip()
+
+ if options.parent_branch:
+ parent = options.parent_branch
+
+ if options.guess_summary and not options.summary:
+ options.summary = execute(['hg', 'log', '-r.', '--template',
+ r'{desc|firstline}\n'])
+
+ if options.guess_description and not options.description:
+ numrevs = len(execute(['hg', 'log', '-r.:%s' % parent,
+ '--follow', '--template',
+ r'{rev}\n']).strip().split('\n'))
+ options.description = execute(['hg', 'log', '-r.:%s' % parent,
+ '--follow', '--template',
+ r'{desc}\n\n', '--limit',
+ str(numrevs-1)]).strip()
+
+ return (execute(["hg", "diff", "--svn", '-r%s:.' % parent]), None)
return (execute(["hg", "diff"] + files), None)
@@ -2295,12 +2314,13 @@ def parse_options(args):
parser.add_option("--guess-summary",
dest="guess_summary", action="store_true",
default=False,
- help="guess summary from the latest commit (git only)")
+ help="guess summary from the latest commit (git/"
+ "hgsubversion only)")
parser.add_option("--guess-description",
dest="guess_description", action="store_true",
default=False,
help="guess description based on commits on this branch "
- "(git only)")
+ "(git/hgsubversion only)")
parser.add_option("--testing-done",
dest="testing_done", default=None,
help="details of testing done ")