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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 Args: | 506 Args: |
507 verbose: If True, uses verbose output | 507 verbose: If True, uses verbose output |
508 args: A sequence of command line parameters to be passed to svn. | 508 args: A sequence of command line parameters to be passed to svn. |
509 cwd: The directory where svn is to be run. | 509 cwd: The directory where svn is to be run. |
510 | 510 |
511 Raises: | 511 Raises: |
512 Error: An error occurred while running the svn command. | 512 Error: An error occurred while running the svn command. |
513 """ | 513 """ |
514 stdout = stdout or sys.stdout | 514 stdout = stdout or sys.stdout |
| 515 if file_list is None: |
| 516 # Even if our caller doesn't care about file_list, we use it internally. |
| 517 file_list = [] |
515 | 518 |
516 # svn update and svn checkout use the same pattern: the first three columns | 519 # svn update and svn checkout use the same pattern: the first three columns |
517 # are for file status, property status, and lock status. This is followed | 520 # are for file status, property status, and lock status. This is followed |
518 # by two spaces, and then the path to the file. | 521 # by two spaces, and then the path to the file. |
519 update_pattern = '^... (.*)$' | 522 update_pattern = '^... (.*)$' |
520 | 523 |
521 # The first three columns of svn status are the same as for svn update and | 524 # The first three columns of svn status are the same as for svn update and |
522 # svn checkout. The next three columns indicate addition-with-history, | 525 # svn checkout. The next three columns indicate addition-with-history, |
523 # switch, and remote lock status. This is followed by one space, and then | 526 # switch, and remote lock status. This is followed by one space, and then |
524 # the path to the file. | 527 # the path to the file. |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 # revert, like for properties. | 1103 # revert, like for properties. |
1101 if not os.path.isdir(cwd): | 1104 if not os.path.isdir(cwd): |
1102 # '.' was deleted. It's not worth continuing. | 1105 # '.' was deleted. It's not worth continuing. |
1103 return | 1106 return |
1104 try: | 1107 try: |
1105 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1108 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
1106 except subprocess2.CalledProcessError: | 1109 except subprocess2.CalledProcessError: |
1107 if not os.path.exists(file_path): | 1110 if not os.path.exists(file_path): |
1108 continue | 1111 continue |
1109 raise | 1112 raise |
OLD | NEW |