Add NoneType check for revisions in Perforce get_changenum().
Review Request #8133 — Created April 28, 2016 and submitted
When posting a diff of a range of submitted changelists, rbt post command fails with teh following Traceback:
rbt post --repository=Perforce //a/b/c/...@23,@28File "/usr/local/bin/rbt", line 9, in <module>
load_entry_point('RBTools==0.7.6', 'console_scripts', 'rbt')()
File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.6-py2.7.egg/rbtools/commands/main.py", line 133, in main
command.run_from_argv([RB_MAIN, command_name] + args)
File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.6-py2.7.egg/rbtools/commands/init.py", line 629, in run_from_argv
exit_code = self.main(*args) or 0
File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.6-py2.7.egg/rbtools/commands/post.py", line 767, in main
changenum = self.tool.get_changenum(self.revisions)
File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.6-py2.7.egg/rbtools/clients/perforce.py", line 666, in get_changenum
tip = revisions['tip']
TypeError: 'NoneType' object has no attribute 'getitem'This is because the range of revisions does not associate with a single changelist.
Adding a NoneType check for revisions in Perforce get_changenum() fixes it.
Manual Testing:
Uploaded / updated Perforce reviews.
Description | From | Last Updated |
---|---|---|
Col: 22 E711 comparison to None should be 'if cond is not None:' |
reviewbot |
- Change Summary:
-
Use 'is not' instead of '!=' as per PEP8 Style.
- Commit:
-
d1457b3983405b84254f861d41bea9b54a3e9f866358738b96f8b2fe4845b7d8c570094806860457
- Diff:
-
Revision 2 (+6 -5)