Make gcl delete foo more useful by being able to delete corrupted change.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/4135011

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@64599 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gcl.py b/gcl.py
index 0936425..04c62b7 100755
--- a/gcl.py
+++ b/gcl.py
@@ -445,7 +445,10 @@
     split_data = gclient_utils.FileRead(info_file, 'r').split(
         ChangeInfo._SEPARATOR, 2)
     if len(split_data) != 3:
-      ErrorExit("Changelist file %s is corrupt" % info_file)
+      ErrorExit(
+          ('Changelist file %s is corrupt.\n'
+           'Either run "gcl delete %s" or manually edit the file') % (
+              info_file, changename))
     items = split_data[0].split(', ')
     issue = 0
     patchset = 0
@@ -464,7 +467,7 @@
     description = split_data[2]
     save = False
     if update_status:
-      for item in files:
+      for item in files[:]:
         filename = os.path.join(local_root, item[1])
         status_result = SVN.CaptureStatus(filename)
         if not status_result or not status_result[0][0]:
@@ -1193,10 +1196,11 @@
   return 0
 
 
-@need_change
-def CMDdelete(change_info):
+def CMDdelete(args):
   """Deletes a changelist."""
-  change_info.Delete()
+  if not len(args) == 1:
+    ErrorExit('You need to pass a change list name')
+  os.remove(GetChangelistInfoFile(args[0]))
   return 0