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

Unified Diff: scm.py

Issue 3104036: Cleanup the code in gclient_utils to standardize on CheckCall nomenclature. (Closed)
Patch Set: Rewrote the patch in part as I had introduced regressions. Removed a lot of dead code Created 10 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 | « gclient_utils.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index ae765f0cd05b106ffc6532236574328ac625cb4f..1c1df13a482573f34466099405967ee5f5fc9a9d 100644
--- a/scm.py
+++ b/scm.py
@@ -65,8 +65,6 @@ def GenFakeDiff(filename):
class GIT(object):
- COMMAND = "git"
-
@staticmethod
def Capture(args, in_directory=None, print_error=True, error_ok=False):
"""Runs git, capturing output sent to stdout as a string.
@@ -78,10 +76,8 @@ class GIT(object):
Returns:
The output sent to stdout as a string.
"""
- c = [GIT.COMMAND]
- c.extend(args)
try:
- return gclient_utils.CheckCall(c, in_directory, print_error)
+ return gclient_utils.CheckCall(['git'] + args, in_directory, print_error)
except gclient_utils.CheckCallError:
if error_ok:
return ('', '')
@@ -117,11 +113,6 @@ class GIT(object):
return results
@staticmethod
- def RunAndFilterOutput(args, **kwargs):
- """Wrapper to gclient_utils.SubprocessCallAndFilter()."""
- return gclient_utils.SubprocessCallAndFilter([GIT.COMMAND] + args, **kwargs)
-
- @staticmethod
def GetEmail(repo_root):
"""Retrieves the user email address if known."""
# We could want to look at the svn cred when it has a svn remote but it
@@ -312,13 +303,13 @@ class GIT(object):
class SVN(object):
- COMMAND = "svn"
current_version = None
@staticmethod
def Run(args, **kwargs):
- """Wrappers to gclient_utils.SubprocessCall()."""
- return gclient_utils.SubprocessCall([SVN.COMMAND] + args, **kwargs)
+ """Wrappers to gclient_utils.CheckCallAndFilterAndHeader()."""
+ return gclient_utils.CheckCallAndFilterAndHeader(['svn'] + args,
+ always=True, **kwargs)
@staticmethod
def Capture(args, in_directory=None, print_error=True):
@@ -331,13 +322,11 @@ class SVN(object):
Returns:
The output sent to stdout as a string.
"""
- c = [SVN.COMMAND]
- c.extend(args)
stderr = None
if not print_error:
stderr = subprocess.PIPE
- return gclient_utils.Popen(c, cwd=in_directory, stdout=subprocess.PIPE,
- stderr=stderr).communicate()[0]
+ return gclient_utils.Popen(['svn'] + args, cwd=in_directory,
+ stdout=subprocess.PIPE, stderr=stderr).communicate()[0]
@staticmethod
def RunAndGetFileList(verbose, args, cwd, file_list, stdout=None):
@@ -393,10 +382,12 @@ class SVN(object):
failure.append(line)
try:
- SVN.RunAndFilterOutput(args, cwd=cwd, print_messages=verbose,
- print_stdout=True,
- filter_fn=CaptureMatchingLines,
- stdout=stdout)
+ gclient_utils.CheckCallAndFilterAndHeader(
+ ['svn'] + args,
+ cwd=cwd,
+ always=verbose,
+ filter_fn=CaptureMatchingLines,
+ stdout=stdout)
except gclient_utils.Error:
def IsKnownFailure():
for x in failure:
@@ -438,11 +429,6 @@ class SVN(object):
break
@staticmethod
- def RunAndFilterOutput(args, **kwargs):
- """Wrapper for gclient_utils.SubprocessCallAndFilter()."""
- return gclient_utils.SubprocessCallAndFilter([SVN.COMMAND] + args, **kwargs)
-
- @staticmethod
def CaptureInfo(relpath, in_directory=None, print_error=True):
"""Returns a dictionary from the svn info output for the given file.
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698