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

Side by Side Diff: scm.py

Issue 7860041: Update subprocess2.check_output() to behave like subprocess.check_output(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: update comment and docstring, they were unclear Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « presubmit_canned_checks.py ('k') | subprocess2.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """SCM-specific utility classes.""" 5 """SCM-specific utility classes."""
6 6
7 import cStringIO 7 import cStringIO
8 import glob 8 import glob
9 import logging 9 import logging
10 import os 10 import os
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 """ 72 """
73 if os.path.isdir(os.path.join(root, '.svn')): 73 if os.path.isdir(os.path.join(root, '.svn')):
74 return 'svn' 74 return 'svn'
75 elif os.path.isdir(os.path.join(root, '.git')): 75 elif os.path.isdir(os.path.join(root, '.git')):
76 return 'git' 76 return 'git'
77 else: 77 else:
78 try: 78 try:
79 subprocess2.check_output( 79 subprocess2.check_output(
80 ['git', 'rev-parse', '--show-cdup'], 80 ['git', 'rev-parse', '--show-cdup'],
81 stdout=subprocess2.VOID, 81 stdout=subprocess2.VOID,
82 stderr=subprocess2.VOID,
82 cwd=root) 83 cwd=root)
83 return 'git' 84 return 'git'
84 except (OSError, subprocess2.CalledProcessError): 85 except (OSError, subprocess2.CalledProcessError):
85 return None 86 return None
86 87
87 88
88 class GIT(object): 89 class GIT(object):
89 @staticmethod 90 @staticmethod
90 def Capture(args, **kwargs): 91 def Capture(args, **kwargs):
91 return subprocess2.check_output( 92 return subprocess2.check_output(
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 if (file_status[0][0] in ('D', 'A', '!') or 983 if (file_status[0][0] in ('D', 'A', '!') or
983 not file_status[0][1:].isspace()): 984 not file_status[0][1:].isspace()):
984 # Added, deleted file requires manual intervention and require calling 985 # Added, deleted file requires manual intervention and require calling
985 # revert, like for properties. 986 # revert, like for properties.
986 try: 987 try:
987 SVN.Capture(['revert', file_status[1]], cwd=repo_root) 988 SVN.Capture(['revert', file_status[1]], cwd=repo_root)
988 except subprocess2.CalledProcessError: 989 except subprocess2.CalledProcessError:
989 if not os.path.exists(file_path): 990 if not os.path.exists(file_path):
990 continue 991 continue
991 raise 992 raise
OLDNEW
« no previous file with comments | « presubmit_canned_checks.py ('k') | subprocess2.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698