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

Side by Side Diff: gclient.py

Issue 275103009: gclient: fix --delete_unversioned_trees bug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: try GIT and SVn Created 6 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Meta checkout manager supporting both Subversion and GIT.""" 6 """Meta checkout manager supporting both Subversion and GIT."""
7 # Files 7 # Files
8 # .gclient : Current client configuration, written by 'config' command. 8 # .gclient : Current client configuration, written by 'config' command.
9 # Format is a Python script defining 'solutions', a list whose 9 # Format is a Python script defining 'solutions', a list whose
10 # entries each are maps binding the strings "name" and "url" 10 # entries each are maps binding the strings "name" and "url"
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 for path in path_list) 1307 for path in path_list)
1308 1308
1309 # Use entry and not entry_fixed there. 1309 # Use entry and not entry_fixed there.
1310 if (entry not in entries and 1310 if (entry not in entries and
1311 (not any(path.startswith(entry + '/') for path in entries)) and 1311 (not any(path.startswith(entry + '/') for path in entries)) and
1312 os.path.exists(e_dir)): 1312 os.path.exists(e_dir)):
1313 scm = gclient_scm.CreateSCM( 1313 scm = gclient_scm.CreateSCM(
1314 prev_url, self.root_dir, entry_fixed, self.outbuf) 1314 prev_url, self.root_dir, entry_fixed, self.outbuf)
1315 1315
1316 # Check to see if this directory is now part of a higher-up checkout. 1316 # Check to see if this directory is now part of a higher-up checkout.
1317 if scm.GetCheckoutRoot() in full_entries: 1317 # The directory might be part of a git OR svn checkout.
1318 scm_root = None
1319 for scm_class in (gclient_scm.scm.GIT, gclient_scm.scm.SVN):
1320 try:
1321 scm_root = scm_class.GetCheckoutRoot(scm.checkout_path)
1322 except subprocess2.CalledProcessError:
1323 pass
1324 if scm_root:
1325 break
1326 else:
1327 logging.warning('Could not find checkout root for %s. Unable to '
1328 'determine whether it is part of a higher-level '
1329 'checkout, so not removing.' % entry)
1330 continue
1331 if scm_root in full_entries:
1318 logging.info('%s is part of a higher level checkout, not ' 1332 logging.info('%s is part of a higher level checkout, not '
1319 'removing.', scm.GetCheckoutRoot()) 1333 'removing.', scm.GetCheckoutRoot())
1320 continue 1334 continue
1321 1335
1322 file_list = [] 1336 file_list = []
1323 scm.status(self._options, [], file_list) 1337 scm.status(self._options, [], file_list)
1324 modified_files = file_list != [] 1338 modified_files = file_list != []
1325 if (not self._options.delete_unversioned_trees or 1339 if (not self._options.delete_unversioned_trees or
1326 (modified_files and not self._options.force)): 1340 (modified_files and not self._options.force)):
1327 # There are modified files in this entry. Keep warning until 1341 # There are modified files in this entry. Keep warning until
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 print >> sys.stderr, 'Error: %s' % str(e) 1982 print >> sys.stderr, 'Error: %s' % str(e)
1969 return 1 1983 return 1
1970 finally: 1984 finally:
1971 gclient_utils.PrintWarnings() 1985 gclient_utils.PrintWarnings()
1972 1986
1973 1987
1974 if '__main__' == __name__: 1988 if '__main__' == __name__:
1975 sys.exit(Main(sys.argv[1:])) 1989 sys.exit(Main(sys.argv[1:]))
1976 1990
1977 # vim: ts=2:sw=2:tw=80:et: 1991 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698