Permalink
Browse files

Fix what I think is a bug in postreview.

I think this commit http://reviews.reviewboard.org/r/2776/ has moved the server
= initialization a little bit too high in the main() function. It seems that
server might now be uninitialized when going inside this if on line 1270.

Reviewed at http://reviews.reviewboard.org/r/3637/
  • Loading branch information...
cupcicm authored and davidt committed Dec 12, 2012
1 parent e25c695 commit fa30a0fbf22e7bc06ebb1c7f789607700e45a38f
Showing with 13 additions and 12 deletions.
  1. +1 −0 AUTHORS
  2. +12 −12 rbtools/postreview.py
View
@@ -39,6 +39,7 @@ Contributors:
* Luis Rodriguez
* Luke Lu
* Luke Robison
+ * Manu Cupcic
* Markku Linnoskivi
* Matthew Woehlke
* Mike Crute
View
@@ -1265,18 +1265,6 @@ def main():
if len(diff) == 0:
die("There don't seem to be any diffs!")
- if (isinstance(tool, PerforceClient) or
- isinstance(tool, PlasticClient)) and changenum is not None:
- changenum = tool.sanitize_changenum(changenum)
-
- # NOTE: In Review Board 1.5.2 through 1.5.3.1, the changenum support
- # is broken, so we have to force the deprecated API.
- if (parse_version(server.rb_version) >= parse_version('1.5.2') and
- parse_version(server.rb_version) <= parse_version('1.5.3.1')):
- debug('Using changenums on Review Board %s, which is broken. '
- 'Falling back to the deprecated 1.0 API' % server.rb_version)
- server.deprecated_api = True
-
if options.output_diff_only:
# The comma here isn't a typo, but rather suppresses the extra newline
print diff,
@@ -1294,6 +1282,18 @@ def main():
server = ReviewBoardServer(server_url, repository_info, cookie_file)
+ if (isinstance(tool, PerforceClient) or
+ isinstance(tool, PlasticClient)) and changenum is not None:
+ changenum = tool.sanitize_changenum(changenum)
+
+ # NOTE: In Review Board 1.5.2 through 1.5.3.1, the changenum support
+ # is broken, so we have to force the deprecated API.
+ if (parse_version(server.rb_version) >= parse_version('1.5.2') and
+ parse_version(server.rb_version) <= parse_version('1.5.3.1')):
+ debug('Using changenums on Review Board %s, which is broken. '
+ 'Falling back to the deprecated 1.0 API' % server.rb_version)
+ server.deprecated_api = True
+
# Handle the case where /api/ requires authorization (RBCommons).
if not server.check_api_version():
die("Unable to log in with the supplied username and password.")

0 comments on commit fa30a0f

Please sign in to comment.