From d36b3ed726fd23e3a67dbf104fd3381cabbee1b6 Mon Sep 17 00:00:00 2001 From: "chase@chromium.org" Date: Mon, 9 Nov 2009 18:51:42 +0000 Subject: [PATCH] Error when creating a CL in a read-only checkout. BUG=25824 TEST=running 'gcl change foo' in a read-only checkout shows an error, --force creates a CL anyway, and gcl change in read-write checkouts continues to work. Review URL: http://codereview.chromium.org/378027 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@31452 0039d316-1c4b-4281-b951-d872f2087c98 --- gcl.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcl.py b/gcl.py index fa321627f..9f13c10eb 100755 --- a/gcl.py +++ b/gcl.py @@ -994,6 +994,17 @@ def Commit(change_info, args): def Change(change_info, args): """Creates/edits a changelist.""" silent = FilterFlag(args, "--silent") + + # Verify the user is running the change command from a read-write checkout. + svn_info = gclient_scm.CaptureSVNInfo('.') + if not svn_info: + ErrorExit("Current checkout is unversioned. Please retry with a versioned " + "directory.") + if (svn_info.get('URL', '').startswith('http:') and + not FilterFlag(args, "--force")): + ErrorExit("This is a read-only checkout. Retry in a read-write checkout " + "or use --force to override.") + if (len(args) == 1): filename = args[0] f = open(filename, 'rU')