OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 return values | 799 return values |
800 | 800 |
801 @staticmethod | 801 @staticmethod |
802 def GetCheckoutRoot(directory): | 802 def GetCheckoutRoot(directory): |
803 """Returns the top level directory of the current repository. | 803 """Returns the top level directory of the current repository. |
804 | 804 |
805 The directory is returned as an absolute path. | 805 The directory is returned as an absolute path. |
806 """ | 806 """ |
807 directory = os.path.abspath(directory) | 807 directory = os.path.abspath(directory) |
808 try: | 808 try: |
809 cur_dir_repo_root = SVN.CaptureInfo(directory)['Repository Root'] | 809 info = SVN.CaptureInfo(directory) |
| 810 cur_dir_repo_root = info['Repository Root'] |
| 811 url = info['URL'] |
810 except gclient_utils.Error: | 812 except gclient_utils.Error: |
811 return None | 813 return None |
812 while True: | 814 while True: |
813 parent = os.path.dirname(directory) | 815 parent = os.path.dirname(directory) |
814 try: | 816 try: |
815 if SVN.CaptureInfo(parent)['Repository Root'] != cur_dir_repo_root: | 817 info = SVN.CaptureInfo(parent) |
| 818 if (info['Repository Root'] != cur_dir_repo_root or |
| 819 info['URL'] != os.path.dirname(url)): |
816 break | 820 break |
| 821 url = info['URL'] |
817 except gclient_utils.Error: | 822 except gclient_utils.Error: |
818 break | 823 break |
819 directory = parent | 824 directory = parent |
820 return GetCasedPath(directory) | 825 return GetCasedPath(directory) |
821 | 826 |
822 @staticmethod | 827 @staticmethod |
823 def AssertVersion(min_version): | 828 def AssertVersion(min_version): |
824 """Asserts svn's version is at least min_version.""" | 829 """Asserts svn's version is at least min_version.""" |
825 def only_int(val): | 830 def only_int(val): |
826 if val.isdigit(): | 831 if val.isdigit(): |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 elif os.path.isfile(file_path) or os.path.islink(file_path): | 880 elif os.path.isfile(file_path) or os.path.islink(file_path): |
876 logging.info('os.remove(%s)' % file_path) | 881 logging.info('os.remove(%s)' % file_path) |
877 os.remove(file_path) | 882 os.remove(file_path) |
878 elif os.path.isdir(file_path): | 883 elif os.path.isdir(file_path): |
879 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) | 884 logging.info('gclient_utils.RemoveDirectory(%s)' % file_path) |
880 gclient_utils.RemoveDirectory(file_path) | 885 gclient_utils.RemoveDirectory(file_path) |
881 else: | 886 else: |
882 logging.critical( | 887 logging.critical( |
883 ('No idea what is %s.\nYou just found a bug in gclient' | 888 ('No idea what is %s.\nYou just found a bug in gclient' |
884 ', please ping maruel@chromium.org ASAP!') % file_path) | 889 ', please ping maruel@chromium.org ASAP!') % file_path) |
OLD | NEW |