From 10ccd1124c8efa7b069fb08b55f652734bf0cb1b Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Tue, 24 Aug 2010 16:48:42 +0000 Subject: [PATCH] Disable the use of -s or --server with gcl upload. It contradicts the previous changes to enforce codereview.settings. TEST=new unit test BUG=none Review URL: http://codereview.chromium.org/3171026 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@57195 0039d316-1c4b-4281-b951-d872f2087c98 --- gcl.py | 2 ++ tests/gcl_unittest.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) 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