Commit 373af80c authored by maruel@chromium.org's avatar maruel@chromium.org

Revert r138874 "Automatically adds quotes on Windows when necessary"

This breaks _some_ msysgit uses cases. I'll investigate later.

TBR=cmp@chromium.org
BUG=
TEST=


Review URL: https://chromiumcodereview.appspot.com/10445042

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@139114 0039d316-1c4b-4281-b951-d872f2087c98
parent 91655502
...@@ -51,21 +51,9 @@ def DieWithError(message): ...@@ -51,21 +51,9 @@ def DieWithError(message):
sys.exit(1) sys.exit(1)
def QuoteCommand(command):
"""Quotes command on Windows so it runs fine even with & and | in the string.
"""
if sys.platform == 'win32':
def fix(arg):
if ('&' in arg or '|' in arg) and '"' not in arg:
arg = '"%s"' % arg
return arg
command = [fix(arg) for arg in command]
return command
def RunCommand(args, error_ok=False, error_message=None, **kwargs): def RunCommand(args, error_ok=False, error_message=None, **kwargs):
try: try:
return subprocess2.check_output(QuoteCommand(args), **kwargs) return subprocess2.check_output(args, shell=False, **kwargs)
except subprocess2.CalledProcessError, e: except subprocess2.CalledProcessError, e:
if not error_ok: if not error_ok:
DieWithError( DieWithError(
...@@ -545,7 +533,8 @@ or verify this branch is set up to track another (via the --track argument to ...@@ -545,7 +533,8 @@ or verify this branch is set up to track another (via the --track argument to
# If the change was never uploaded, use the log messages of all commits # If the change was never uploaded, use the log messages of all commits
# up to the branch point, as git cl upload will prefill the description # up to the branch point, as git cl upload will prefill the description
# with these log messages. # with these log messages.
description = CreateDescriptionFromLog([upstream_branch + '..']) description = RunCommand(['git', 'log', '--pretty=format:%s%n%n%b',
'%s...' % (upstream_branch)]).strip()
if not author: if not author:
author = RunGit(['config', 'user.email']).strip() or None author = RunGit(['config', 'user.email']).strip() or None
...@@ -890,7 +879,7 @@ def CreateDescriptionFromLog(args): ...@@ -890,7 +879,7 @@ def CreateDescriptionFromLog(args):
log_args = [args[0] + '..' + args[1]] log_args = [args[0] + '..' + args[1]]
else: else:
log_args = args[:] # Hope for the best! log_args = args[:] # Hope for the best!
return RunGit(['log', '--pretty=format:%s%n%n%b'] + log_args) return RunGit(['log', '--pretty=format:%s\n\n%b'] + log_args)
def ConvertToInteger(inputval): def ConvertToInteger(inputval):
......
...@@ -112,11 +112,11 @@ class TestGitCl(TestCase): ...@@ -112,11 +112,11 @@ class TestGitCl(TestCase):
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', 'config', 'branch.master.rietveldissue'],), ''), ((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],), ''), ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master..'],), 'foo'), ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'), ((['git', 'config', 'user.email'],), 'me@example.com'),
((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],), ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],),
'+dat'), '+dat'),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master..'],), 'desc\n'), ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), 'desc\n'),
] ]
@staticmethod @staticmethod
...@@ -345,7 +345,7 @@ class TestGitCl(TestCase): ...@@ -345,7 +345,7 @@ class TestGitCl(TestCase):
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', 'config', 'branch.master.rietveldissue'],), ''), ((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],), ''), ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master..'],), 'foo'), ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'), ((['git', 'config', 'user.email'],), 'me@example.com'),
((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],), ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],),
'+dat'), '+dat'),
...@@ -354,7 +354,7 @@ class TestGitCl(TestCase): ...@@ -354,7 +354,7 @@ class TestGitCl(TestCase):
@staticmethod @staticmethod
def _gerrit_upload_calls(description, reviewers): def _gerrit_upload_calls(description, reviewers):
calls = [ calls = [
((['git', 'log', '--pretty=format:%s%n%n%b', 'master..'],), ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],),
description), description),
((['git', 'config', 'rietveld.cc'],), '') ((['git', 'config', 'rietveld.cc'],), '')
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment