OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 else: | 92 else: |
93 return 0 | 93 return 0 |
94 | 94 |
95 | 95 |
96 class GIT(object): | 96 class GIT(object): |
97 current_version = None | 97 current_version = None |
98 | 98 |
99 @staticmethod | 99 @staticmethod |
100 def Capture(args, cwd, **kwargs): | 100 def Capture(args, cwd, **kwargs): |
101 return subprocess2.check_output( | 101 return subprocess2.check_output( |
102 ['git'] + args, cwd=cwd, stderr=subprocess2.PIPE, **kwargs) | 102 ['git', '--no-pager'] + args, |
| 103 cwd=cwd, stderr=subprocess2.PIPE, **kwargs) |
103 | 104 |
104 @staticmethod | 105 @staticmethod |
105 def CaptureStatus(files, cwd, upstream_branch): | 106 def CaptureStatus(files, cwd, upstream_branch): |
106 """Returns git status. | 107 """Returns git status. |
107 | 108 |
108 @files can be a string (one file) or a list of files. | 109 @files can be a string (one file) or a list of files. |
109 | 110 |
110 Returns an array of (status, file) tuples.""" | 111 Returns an array of (status, file) tuples.""" |
111 if upstream_branch is None: | 112 if upstream_branch is None: |
112 upstream_branch = GIT.GetUpstreamBranch(cwd) | 113 upstream_branch = GIT.GetUpstreamBranch(cwd) |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 # revert, like for properties. | 1087 # revert, like for properties. |
1087 if not os.path.isdir(cwd): | 1088 if not os.path.isdir(cwd): |
1088 # '.' was deleted. It's not worth continuing. | 1089 # '.' was deleted. It's not worth continuing. |
1089 return | 1090 return |
1090 try: | 1091 try: |
1091 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1092 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
1092 except subprocess2.CalledProcessError: | 1093 except subprocess2.CalledProcessError: |
1093 if not os.path.exists(file_path): | 1094 if not os.path.exists(file_path): |
1094 continue | 1095 continue |
1095 raise | 1096 raise |
OLD | NEW |