diff --git a/gcl.py b/gcl.py index ea91fdaf5..dfe02096d 100755 --- a/gcl.py +++ b/gcl.py @@ -722,6 +722,8 @@ def CMDupload(change_info, args): This does not submit a try job; use gcl try to submit a try job. """ + if '-s' in args or '--server' in args: + ErrorExit('Don\'t use the -s flag, fix codereview.settings instead') if not change_info.GetFiles(): print "Nothing to upload, changelist is empty." return 0 diff --git a/tests/gcl_unittest.py b/tests/gcl_unittest.py index c160aa178..8da6c1e84 100755 --- a/tests/gcl_unittest.py +++ b/tests/gcl_unittest.py @@ -325,6 +325,22 @@ class CMDuploadUnittest(GclTestsBase): self.assertEquals(change_info.issue, 1) self.assertEquals(change_info.patchset, 2) + def testNoServer(self): + self.mox.StubOutWithMock(gcl.sys, 'stderr') + gcl.sys.stderr.write( + 'Don\'t use the -s flag, fix codereview.settings instead') + gcl.sys.stderr.write('\n') + gcl.GetRepositoryRoot().AndReturn(self.fake_root_dir) + gcl.ChangeInfo.Load('naame', self.fake_root_dir, True, True + ).AndReturn(1) + self.mox.ReplayAll() + + try: + gcl.CMDupload(['naame', '-s', 'foo']) + self.fail() + except SystemExit: + pass + if __name__ == '__main__': import unittest