Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: scm.py

Issue 6578029: Fix scm.SVN.GetCheckoutRoot() so it is not confused by intermixed checkouts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/scm_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | tests/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698