Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: gcl.py

Issue 160139: Get rid of annoying empty changelists!... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: s/clear/delete Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcl.py
===================================================================
--- gcl.py (revision 22513)
+++ gcl.py (working copy)
@@ -681,6 +681,10 @@
of changenames.
--> Use 'gcl help try' for more information!
+ gcl deleteempties
+ Deletes all changelists that have no files associated with them. Careful,
+ you can lose your descriptions.
+
gcl help [command]
Print this help menu, or help for the given command if it exists.
""")
@@ -973,7 +977,7 @@
description = change_info.description
other_files = GetFilesNotInCL()
-
+
#Edited files will have a letter for the first character in a string.
#This regex looks for the presence of that character.
file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE)
@@ -1023,6 +1027,11 @@
status = line[:7]
file = line[7:]
new_cl_files.append((status, file))
+
+ if (not len(change_info._files)) and (not change_info.issue) and \
+ (not len(new_description) and (not new_cl_files)):
+ ErrorExit("Empty changelist not saved")
+
change_info._files = new_cl_files
change_info.Save()
@@ -1094,6 +1103,16 @@
print "".join(file)
+def DeleteEmptyChangeLists():
+ """Delete all changelists that have no files."""
+ print "\n--- Deleting:"
+ for cl in GetCLs():
+ change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True)
+ if not len(change_info._files):
+ print change_info.name
+ change_info.Delete()
+
+
def main(argv=None):
if argv is None:
argv = sys.argv
@@ -1151,6 +1170,9 @@
print '\n'.join(("%s: %s" % (str(k), str(v))
for (k,v) in CODEREVIEW_SETTINGS.iteritems()))
return 0
+ if command == "deleteempties":
+ DeleteEmptyChangeLists()
+ return 0
if len(argv) == 2:
if command == "change":
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698