| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 class SVN(object): | 391 class SVN(object): |
| 392 current_version = None | 392 current_version = None |
| 393 | 393 |
| 394 @staticmethod | 394 @staticmethod |
| 395 def Capture(args, **kwargs): | 395 def Capture(args, **kwargs): |
| 396 """Always redirect stderr. | 396 """Always redirect stderr. |
| 397 | 397 |
| 398 Throws an exception if non-0 is returned. | 398 Throws an exception if non-0 is returned. |
| 399 """ | 399 """ |
| 400 return subprocess2.check_output(['svn'] + args, **kwargs) | 400 return subprocess2.check_output( |
| 401 ['svn'] + args, stderr=subprocess2.PIPE, **kwargs) |
| 401 | 402 |
| 402 @staticmethod | 403 @staticmethod |
| 403 def RunAndGetFileList(verbose, args, cwd, file_list, stdout=None): | 404 def RunAndGetFileList(verbose, args, cwd, file_list, stdout=None): |
| 404 """Runs svn checkout, update, or status, output to stdout. | 405 """Runs svn checkout, update, or status, output to stdout. |
| 405 | 406 |
| 406 The first item in args must be either "checkout", "update", or "status". | 407 The first item in args must be either "checkout", "update", or "status". |
| 407 | 408 |
| 408 svn's stdout is parsed to collect a list of files checked out or updated. | 409 svn's stdout is parsed to collect a list of files checked out or updated. |
| 409 These files are appended to file_list. svn's stdout is also printed to | 410 These files are appended to file_list. svn's stdout is also printed to |
| 410 sys.stdout as in Run. | 411 sys.stdout as in Run. |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (file_status[0][0] in ('D', 'A', '!') or | 982 if (file_status[0][0] in ('D', 'A', '!') or |
| 982 not file_status[0][1:].isspace()): | 983 not file_status[0][1:].isspace()): |
| 983 # Added, deleted file requires manual intervention and require calling | 984 # Added, deleted file requires manual intervention and require calling |
| 984 # revert, like for properties. | 985 # revert, like for properties. |
| 985 try: | 986 try: |
| 986 SVN.Capture(['revert', file_status[1]], cwd=repo_root) | 987 SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
| 987 except subprocess2.CalledProcessError: | 988 except subprocess2.CalledProcessError: |
| 988 if not os.path.exists(file_path): | 989 if not os.path.exists(file_path): |
| 989 continue | 990 continue |
| 990 raise | 991 raise |
| OLD | NEW |