[WIP] Give better error messages when bug 3273 is hit.

Review Request #5624 — Created March 14, 2014 and discarded — Latest diff uploaded

Information

RBTools
master
949bada...

Reviewers

2 patch stack:


Removing broken git-svn codepath.

The attribute self.merge_base has not been valid since
029787313887e85444b1372a35ec1a727ee859d1 went in.


Short circuit when the diff is None.

Previously, some diff routines would return None instead of an
empty string (see bug 3273 for discussion). Now at we'll get the
expected "There don't seem to be any diffs!" error instead of
"object of type 'NoneType' has no len()".

Before:

$ rbt post --debug -g --tracking-branch master --parent HEAD^
// snip details....
Traceback (most recent call last):
  File "/usr/local/bin//rbt", line 9, in <module>
    load_entry_point('RBTools==0.6alpha0.dev', 'console_scripts', 'rbt')()
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/main.py", line 127, in main
    command.run_from_argv([RB_MAIN] + args)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/__init__.py", line 361, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/post.py", line 680, in main
    extra_args=extra_args)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/clients/git.py", line 421, in diff
    diff_lines = self.make_diff(revisions['base'], revisions['tip'], files)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/clients/git.py", line 472, in make_diff
    return self.make_svn_diff(base, diff_lines)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/clients/git.py", line 486, in make_svn_diff
    if not rev and self.merge_base:
AttributeError: 'GitClient' object has no attribute 'merge_base'

After:

$ rbt post --debug -g --tracking-branch master --parent HEAD^
// snip details....
Traceback (most recent call last):
  File "/usr/local/bin//rbt", line 9, in <module>
    load_entry_point('RBTools==0.6alpha0.dev', 'console_scripts', 'rbt')()
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/main.py", line 127, in main
    command.run_from_argv([RB_MAIN] + args)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/__init__.py", line 361, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.6alpha0.dev-py2.7.egg/rbtools/commands/post.py", line 688, in main
    raise CommandError("There don't seem to be any diffs!")
rbtools.commands.CommandError: There don't seem to be any diffs!
    Loading...