OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-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 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 Returns: | 54 Returns: |
55 The output sent to stdout as a string. | 55 The output sent to stdout as a string. |
56 """ | 56 """ |
57 c = [GIT.COMMAND] | 57 c = [GIT.COMMAND] |
58 c.extend(args) | 58 c.extend(args) |
59 try: | 59 try: |
60 return gclient_utils.CheckCall(c, in_directory, print_error) | 60 return gclient_utils.CheckCall(c, in_directory, print_error) |
61 except gclient_utils.CheckCallError: | 61 except gclient_utils.CheckCallError: |
62 if error_ok: | 62 if error_ok: |
63 return '' | 63 return ('', '') |
64 raise | 64 raise |
65 | 65 |
66 @staticmethod | 66 @staticmethod |
67 def CaptureStatus(files, upstream_branch='origin'): | 67 def CaptureStatus(files, upstream_branch='origin'): |
68 """Returns git status. | 68 """Returns git status. |
69 | 69 |
70 @files can be a string (one file) or a list of files. | 70 @files can be a string (one file) or a list of files. |
71 | 71 |
72 Returns an array of (status, file) tuples.""" | 72 Returns an array of (status, file) tuples.""" |
73 command = ["diff", "--name-status", "-r", "%s.." % upstream_branch] | 73 command = ["diff", "--name-status", "-r", "%s.." % upstream_branch] |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if not cur_dir_repo_root: | 733 if not cur_dir_repo_root: |
734 return None | 734 return None |
735 | 735 |
736 while True: | 736 while True: |
737 parent = os.path.dirname(directory) | 737 parent = os.path.dirname(directory) |
738 if (SVN.CaptureInfo(parent, print_error=False).get( | 738 if (SVN.CaptureInfo(parent, print_error=False).get( |
739 "Repository Root") != cur_dir_repo_root): | 739 "Repository Root") != cur_dir_repo_root): |
740 break | 740 break |
741 directory = parent | 741 directory = parent |
742 return GetCasedPath(directory) | 742 return GetCasedPath(directory) |
OLD | NEW |