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

Side by Side Diff: gclient.py

Issue 125147: Modify gclient to only delete unversioned trees during an update if... (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 11 years, 6 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2008 Google Inc. All Rights Reserved. 3 # Copyright 2008 Google Inc. All Rights Reserved.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 if run_scm: 1340 if run_scm:
1341 self._options.revision = revision_overrides.get(d) 1341 self._options.revision = revision_overrides.get(d)
1342 scm = SCMWrapper(url, self._root_dir, d) 1342 scm = SCMWrapper(url, self._root_dir, d)
1343 scm.RunCommand(command, self._options, args, file_list) 1343 scm.RunCommand(command, self._options, args, file_list)
1344 self._options.revision = None 1344 self._options.revision = None
1345 1345
1346 is_using_git = IsUsingGit(self._root_dir, entries.keys()) 1346 is_using_git = IsUsingGit(self._root_dir, entries.keys())
1347 self._RunHooks(command, file_list, is_using_git) 1347 self._RunHooks(command, file_list, is_using_git)
1348 1348
1349 if command == 'update': 1349 if command == 'update':
1350 # notify the user if there is an orphaned entry in their working copy. 1350 # Notify the user if there is an orphaned entry in their working copy.
1351 # TODO(darin): we should delete this directory manually if it doesn't 1351 # Only delete the directory if there are no changes in it, and
1352 # have any changes in it. 1352 # delete_unversioned_trees is set to true.
1353 prev_entries = self._ReadEntries() 1353 prev_entries = self._ReadEntries()
1354 for entry in prev_entries: 1354 for entry in prev_entries:
1355 e_dir = os.path.join(self._root_dir, entry) 1355 e_dir = os.path.join(self._root_dir, entry)
1356 if entry not in entries and os.path.exists(e_dir): 1356 if entry not in entries and os.path.exists(e_dir):
1357 if CaptureSVNStatus(e_dir): 1357 if not options.delete_unversioned_trees or CaptureSVNStatus(e_dir):
1358 # There are modified files in this entry 1358 # There are modified files in this entry
1359 entries[entry] = None # Keep warning until removed. 1359 entries[entry] = None # Keep warning until removed.
1360 print("\nWARNING: \"%s\" is no longer part of this client. " 1360 print("\nWARNING: \"%s\" is no longer part of this client. "
1361 "It is recommended that you manually remove it.\n") % entry 1361 "It is recommended that you manually remove it.\n") % entry
1362 else: 1362 else:
1363 # Delete the entry 1363 # Delete the entry
1364 print("\n________ deleting \'%s\' " + 1364 print("\n________ deleting \'%s\' " +
1365 "in \'%s\'") % (entry, self._root_dir) 1365 "in \'%s\'") % (entry, self._root_dir)
1366 RemoveDirectory(e_dir) 1366 RemoveDirectory(e_dir)
1367 # record the current list of entries for next time 1367 # record the current list of entries for next time
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 "containing the provided string")) 1697 "containing the provided string"))
1698 option_parser.add_option("", "--verbose", action="store_true", default=False, 1698 option_parser.add_option("", "--verbose", action="store_true", default=False,
1699 help="produce additional output for diagnostics") 1699 help="produce additional output for diagnostics")
1700 option_parser.add_option("", "--manually_grab_svn_rev", action="store_true", 1700 option_parser.add_option("", "--manually_grab_svn_rev", action="store_true",
1701 default=False, 1701 default=False,
1702 help="Skip svn up whenever possible by requesting " 1702 help="Skip svn up whenever possible by requesting "
1703 "actual HEAD revision from the repository") 1703 "actual HEAD revision from the repository")
1704 option_parser.add_option("", "--head", action="store_true", default=False, 1704 option_parser.add_option("", "--head", action="store_true", default=False,
1705 help=("skips any safesync_urls specified in " 1705 help=("skips any safesync_urls specified in "
1706 "configured solutions")) 1706 "configured solutions"))
1707 option_parser.add_option("", "--delete_unversioned_trees",
1708 action="store_true", default=False,
1709 help=("on update, delete any unexpected "
1710 "unversioned trees that are in the checkout"))
1707 1711
1708 if len(argv) < 2: 1712 if len(argv) < 2:
1709 # Users don't need to be told to use the 'help' command. 1713 # Users don't need to be told to use the 'help' command.
1710 option_parser.print_help() 1714 option_parser.print_help()
1711 return 1 1715 return 1
1712 # Add manual support for --version as first argument. 1716 # Add manual support for --version as first argument.
1713 if argv[1] == '--version': 1717 if argv[1] == '--version':
1714 option_parser.print_version() 1718 option_parser.print_version()
1715 return 0 1719 return 0
1716 1720
(...skipping 19 matching lines...) Expand all
1736 1740
1737 if "__main__" == __name__: 1741 if "__main__" == __name__:
1738 try: 1742 try:
1739 result = Main(sys.argv) 1743 result = Main(sys.argv)
1740 except Error, e: 1744 except Error, e:
1741 print >> sys.stderr, "Error: %s" % str(e) 1745 print >> sys.stderr, "Error: %s" % str(e)
1742 result = 1 1746 result = 1
1743 sys.exit(result) 1747 sys.exit(result)
1744 1748
1745 # vim: ts=2:sw=2:tw=80:et: 1749 # 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