diff options
author | David Trowbridge <trowbrds@gmail.com> | 2010-02-06 10:18:13 -0800 |
---|---|---|
committer | David Trowbridge <trowbrds@gmail.com> | 2010-02-06 10:18:13 -0800 |
commit | 84f17d2c858213f726ab0a2f33bfcb3c4d765009 (patch) | |
tree | 94d5d11e533938759285361818c8956bbff24d7e | |
parent | a822ccf61e9ded0f5a8f76acf04c0f2deeec1c20 (diff) |
Fixes associated to Issue 1345
Patch from Laurent Nicolas. post-review does not process a *pending* Perforce
changeset in v0.2 beta3 (Note that it is a regression from v0.2 beta2).
Also 2 changes that are not strictly related:
1) allow *pending* to be on the second line in addition to the first line
2) append the list of bugs to existing list if it exists already rather than
overwritting it.
Note the "view diffs" view does not show a white space change on line 1586. I
fixed the indentation, otherwise the for loop was ending after the first line.
Testing done:
Tested post-review against our perforce repository, using two *pending*
changeset. Tried combination of with and without -r to find existing review
based on changeset number or review id. Added bug list to check append feature.
Checked for different values of --bugs-closed. After each invocation, checked
the GUI for a correct list, and then submitted the review before the next try:
1) No option
Bugs: empty
2) --bugs-closed=123
Bugs: 123
3) --bugs-closed=456
Bugs: 123, 456
4) --bugs-closed=456 (repeat)
Bugs: 123, 456
5) --bugs-closed=12
Bugs: 12, 123, 456
6) --bugs-closed=1234
Bugs: 12, 123, 456, 1234
7) --bugs-closed="1234, 12345, 1,"
Bugs: 1, 12, 123, 456, 1234, 12345
8) --bugs-closed="1,, 234, 12345, 1, ,,"
Bugs: 1, 123, 234, 456, 1234, 12345
10) --bugs-closed=" ,, ,,1,, 234, 12345, 1, ,, , , ,,,, ,,,,,"
Bugs: 1, 12, 123, 234, 456, 1234, 12345
Checked the database: Bugs field: 1234,12,456,1,123,234,12345
Fixes bug 1345
-rwxr-xr-x | rbtools/postreview.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/rbtools/postreview.py b/rbtools/postreview.py index effa801..2419b92 100755 --- a/rbtools/postreview.py +++ b/rbtools/postreview.py @@ -1612,13 +1612,13 @@ class PerforceClient(SCMClient): description = execute(["p4", "describe", "-s", changenum], split_lines=True) - if '*pending*' in description[0]: + # Some P4 wrappers are addding an extra line before the description + if '*pending*' in description[0] or '*pending*' in description[1]: cl_is_pending = True - description = [] v = self.p4d_version - if cl_is_pending and (v[1] < 2002 or (v[1] == "2002" and v[2] < 2)): + if cl_is_pending and (v[0] < 2002 or (v[0] == "2002" and v[1] < 2)): # Pre-2002.2 doesn't give file list in pending changelists, so we # have to get it a different way info = execute(["p4", "opened", "-c", str(changenum)], @@ -1633,10 +1633,10 @@ class PerforceClient(SCMClient): for line_num, line in enumerate(description): if 'Affected files ...' in line: break - else: - # Got to the end of all the description lines and didn't find - # what we were looking for. - die("Couldn't find any affected files for this change.") + else: + # Got to the end of all the description lines and didn't find + # what we were looking for. + die("Couldn't find any affected files for this change.") description = description[line_num+2:] @@ -2418,7 +2418,11 @@ def tempt_fate(server, tool, changenum, diff_content=None, server.set_review_request_field(review_request, 'branch', options.branch) - if options.bugs_closed: + if options.bugs_closed: # append to existing list + options.bugs_closed = options.bugs_closed.strip(", ") + bug_set = set(re.split("[, ]+", options.bugs_closed)) | \ + set(review_request['bugs_closed']) + options.bugs_closed = ",".join(bug_set) server.set_review_request_field(review_request, 'bugs_closed', options.bugs_closed) |