OLD | NEW |
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 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 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 # TODO(maruel): Merge with Capture? | 279 # TODO(maruel): Merge with Capture? |
280 if cwd is None: | 280 if cwd is None: |
281 cwd = self.checkout_path | 281 cwd = self.checkout_path |
282 stdout=None | 282 stdout=None |
283 if redirect_stdout: | 283 if redirect_stdout: |
284 stdout=subprocess.PIPE | 284 stdout=subprocess.PIPE |
285 if cwd == None: | 285 if cwd == None: |
286 cwd = self.checkout_path | 286 cwd = self.checkout_path |
287 cmd = [self.COMMAND] | 287 cmd = [self.COMMAND] |
288 cmd.extend(args) | 288 cmd.extend(args) |
289 sp = subprocess.Popen(cmd, cwd=cwd, stdout=stdout) | 289 logging.debug(cmd) |
290 output = sp.communicate()[0] | 290 try: |
| 291 sp = subprocess.Popen(cmd, cwd=cwd, stdout=stdout) |
| 292 output = sp.communicate()[0] |
| 293 except OSError: |
| 294 raise gclient_utils.Error("git command '%s' failed to run." % |
| 295 ' '.join(cmd) + "\nCheck that you have git installed.") |
291 if checkrc and sp.returncode: | 296 if checkrc and sp.returncode: |
292 raise gclient_utils.Error('git command %s returned %d' % | 297 raise gclient_utils.Error('git command %s returned %d' % |
293 (args[0], sp.returncode)) | 298 (args[0], sp.returncode)) |
294 if output is not None: | 299 if output is not None: |
295 return output.strip() | 300 return output.strip() |
296 | 301 |
297 | 302 |
298 class SVNWrapper(SCMWrapper, scm.SVN): | 303 class SVNWrapper(SCMWrapper, scm.SVN): |
299 """ Wrapper for SVN """ | 304 """ Wrapper for SVN """ |
300 | 305 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 command = ['status'] | 521 command = ['status'] |
517 command.extend(args) | 522 command.extend(args) |
518 if not os.path.isdir(path): | 523 if not os.path.isdir(path): |
519 # svn status won't work if the directory doesn't exist. | 524 # svn status won't work if the directory doesn't exist. |
520 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 525 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
521 "does not exist." | 526 "does not exist." |
522 % (' '.join(command), path)) | 527 % (' '.join(command), path)) |
523 # There's no file list to retrieve. | 528 # There's no file list to retrieve. |
524 else: | 529 else: |
525 self.RunAndGetFileList(options, command, path, file_list) | 530 self.RunAndGetFileList(options, command, path, file_list) |
OLD | NEW |