Commit 41a9ce45 authored by tandrii@chromium.org's avatar tandrii@chromium.org

Fail with user friendly error when no new parent branch is specified.

Before this change, running
$ git reparent-branch
produced stacktrace and
"TypeError: sequence item 4: expected string, NoneType found"

R=iannucci@chromium.org
TEST=manual + unittest + coverage.
BUG=

Review URL: https://codereview.chromium.org/1280633003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296235 0039d316-1c4b-4281-b951-d872f2087c98
parent 310db36f
......@@ -36,6 +36,8 @@ def main(args):
elif opts.lkgr:
new_parent = 'lkgr'
else:
if not opts.new_parent:
parser.error('Must specify new parent somehow')
new_parent = opts.new_parent
cur_parent = upstream(branch)
......
......@@ -152,6 +152,8 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase):
self.assertEqual(self.repo.git('status', '--porcelain').stdout, '?? bob\n')
self.repo.git('checkout', 'origin/master')
_, err = self.repo.capture_stdio(self.rp.main, [])
self.assertIn('Must specify new parent somehow', err)
_, err = self.repo.capture_stdio(self.rp.main, ['foobar'])
self.assertIn('Must be on the branch', err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment