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

Side by Side Diff: gclient_utils.py

Issue 501143: Remove gclient-specific hacks from trychange into gcl. (Closed)
Patch Set: Small unit test fix Created 11 years 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
« gcl.py ('K') | « gcl.py ('k') | tests/gclient_utils_test.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 2009 Google Inc. All Rights Reserved. 1 # Copyright 2009 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 22 matching lines...) Expand all
33 self.cwd = cwd 33 self.cwd = cwd
34 self.retcode = retcode 34 self.retcode = retcode
35 self.stdout = stdout 35 self.stdout = stdout
36 36
37 37
38 def CheckCall(command, cwd=None): 38 def CheckCall(command, cwd=None):
39 """Like subprocess.check_call() but returns stdout. 39 """Like subprocess.check_call() but returns stdout.
40 40
41 Works on python 2.4 41 Works on python 2.4
42 """ 42 """
43 process = subprocess.Popen(command, cwd=cwd, 43 try:
44 shell=sys.platform.startswith('win'), 44 process = subprocess.Popen(command, cwd=cwd,
45 stdout=subprocess.PIPE) 45 shell=sys.platform.startswith('win'),
46 output = process.communicate()[0] 46 stdout=subprocess.PIPE)
47 if process.retcode: 47 output = process.communicate()[0]
48 raise CheckCallError(command, cwd, process.retcode, output) 48 except OSError, e:
49 raise CheckCallError(command, cwd, errno, None)
50 if process.returncode:
51 raise CheckCallError(command, cwd, process.returncode, output)
49 return output 52 return output
50 53
51 54
52 def SplitUrlRevision(url): 55 def SplitUrlRevision(url):
53 """Splits url and returns a two-tuple: url, rev""" 56 """Splits url and returns a two-tuple: url, rev"""
54 if url.startswith('ssh:'): 57 if url.startswith('ssh:'):
55 # Make sure ssh://test@example.com/test.git@stable works 58 # Make sure ssh://test@example.com/test.git@stable works
56 regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\./]+)(?:@(.+))?" 59 regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\./]+)(?:@(.+))?"
57 components = re.search(regex, url).groups() 60 components = re.search(regex, url).groups()
58 else: 61 else:
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 raise Error(msg) 296 raise Error(msg)
294 297
295 298
296 def IsUsingGit(root, paths): 299 def IsUsingGit(root, paths):
297 """Returns True if we're using git to manage any of our checkouts. 300 """Returns True if we're using git to manage any of our checkouts.
298 |entries| is a list of paths to check.""" 301 |entries| is a list of paths to check."""
299 for path in paths: 302 for path in paths:
300 if os.path.exists(os.path.join(root, path, '.git')): 303 if os.path.exists(os.path.join(root, path, '.git')):
301 return True 304 return True
302 return False 305 return False
OLDNEW
« gcl.py ('K') | « gcl.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698