From 668ef5a2d6153285e1d1870019cf653a3dbb63e0 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Fri, 30 Apr 2010 20:25:24 +0000 Subject: [PATCH] Add "gcl rename " subcommand. Review URL: http://codereview.chromium.org/1697022 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@46110 0039d316-1c4b-4281-b951-d872f2087c98 --- gcl.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcl.py b/gcl.py index 966779f4b..f782985a4 100755 --- a/gcl.py +++ b/gcl.py @@ -664,6 +664,9 @@ Advanced commands: gcl changes Lists all the the changelists and the files in them. + gcl rename + Renames an existing change. + gcl nothave [optional directory] Lists files unknown to Subversion. @@ -1174,6 +1177,19 @@ def main(argv=None): DeleteEmptyChangeLists() return 0 + if command == "rename": + if len(argv) != 4: + ErrorExit("Usage: gcl rename .") + src, dst = argv[2:4] + src_file = GetChangelistInfoFile(src) + if not os.path.isfile(src_file): + ErrorExit("Change '%s' does not exist." % src) + dst_file = GetChangelistInfoFile(dst) + if os.path.isfile(dst_file): + ErrorExit("Change '%s' already exists; pick a new name." % dst) + os.rename(src_file, dst_file) + print "Change '%s' renamed '%s'." % (src, dst) + return 0 if command == "change": if len(argv) == 2: # Generate a random changelist name.