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
changes/01/332501/1
tandrii@chromium.org 10 years ago
parent 310db36f52
commit 41a9ce45ee

@ -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)

Loading…
Cancel
Save