From f1c2f43cad67c349d63185aec1a3d8c44f417822 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Mon, 19 Sep 2011 23:29:08 +0000 Subject: [PATCH] Fix gcl sometimes stripping the new line characters when changing the issue description on the server. This change replaces \n with \r\n before giving the description to the editor on Windows (not through cygwin though), and then replaces \r\n with \n when saving it locally or sending it to reitveld. BUG=95618 Review URL: http://codereview.chromium.org/7875004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@101863 0039d316-1c4b-4281-b951-d872f2087c98 --- gcl.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcl.py b/gcl.py index 72f70f43c..b593ff1eb 100755 --- a/gcl.py +++ b/gcl.py @@ -1095,7 +1095,12 @@ def CMDchange(args): "---Repository Root: " + change_info.GetLocalRoot() + "\n" "---Paths in this changelist (" + change_info.name + "):\n") separator2 = "\n\n---Paths modified but not in any changelist:\n\n" - text = (description + separator1 + '\n' + + + description_to_write = description + if sys.platform == 'win32': + description_to_write = description.replace('\n', '\r\n') + + text = (description_to_write + separator1 + '\n' + '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) if change_info.Exists(): @@ -1136,6 +1141,10 @@ def CMDchange(args): # Update the CL description if it has changed. new_description = split_result[0] + + if sys.platform == 'win32': + new_description = new_description.replace('\r\n', '\n') + cl_files_text = split_result[1] if new_description != description or override_description: change_info.description = new_description