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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 print(file_path) | 478 print(file_path) |
479 if file_status[0].isspace(): | 479 if file_status[0].isspace(): |
480 logging.error('No idea what is the status of %s.\n' | 480 logging.error('No idea what is the status of %s.\n' |
481 'You just found a bug in gclient, please ping ' | 481 'You just found a bug in gclient, please ping ' |
482 'maruel@chromium.org ASAP!' % file_path) | 482 'maruel@chromium.org ASAP!' % file_path) |
483 # svn revert is really stupid. It fails on inconsistent line-endings, | 483 # svn revert is really stupid. It fails on inconsistent line-endings, |
484 # on switched directories, etc. So take no chance and delete everything! | 484 # on switched directories, etc. So take no chance and delete everything! |
485 try: | 485 try: |
486 if not os.path.exists(file_path): | 486 if not os.path.exists(file_path): |
487 pass | 487 pass |
488 elif os.path.isfile(file_path): | 488 elif os.path.isfile(file_path) or os.path.islink(file_path): |
489 logging.info('os.remove(%s)' % file_path) | 489 logging.info('os.remove(%s)' % file_path) |
490 os.remove(file_path) | 490 os.remove(file_path) |
491 elif os.path.isdir(file_path): | 491 elif os.path.isdir(file_path): |
492 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) | 492 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) |
493 gclient_utils.RemoveDirectory(file_path) | 493 gclient_utils.RemoveDirectory(file_path) |
494 else: | 494 else: |
495 logging.error('no idea what is %s.\nYou just found a bug in gclient' | 495 logging.error('no idea what is %s.\nYou just found a bug in gclient' |
496 ', please ping maruel@chromium.org ASAP!' % file_path) | 496 ', please ping maruel@chromium.org ASAP!' % file_path) |
497 except EnvironmentError: | 497 except EnvironmentError: |
498 logging.error('Failed to remove %s.' % file_path) | 498 logging.error('Failed to remove %s.' % file_path) |
(...skipping 22 matching lines...) Expand all Loading... |
521 command = ['status'] | 521 command = ['status'] |
522 command.extend(args) | 522 command.extend(args) |
523 if not os.path.isdir(path): | 523 if not os.path.isdir(path): |
524 # svn status won't work if the directory doesn't exist. | 524 # svn status won't work if the directory doesn't exist. |
525 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 525 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
526 "does not exist." | 526 "does not exist." |
527 % (' '.join(command), path)) | 527 % (' '.join(command), path)) |
528 # There's no file list to retrieve. | 528 # There's no file list to retrieve. |
529 else: | 529 else: |
530 self.RunAndGetFileList(options, command, path, file_list) | 530 self.RunAndGetFileList(options, command, path, file_list) |
OLD | NEW |