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

Side by Side Diff: gclient.py

Issue 249021: gclient: fix to support reading .gclient_entries in old list format (Closed)
Patch Set: use isinstanceof Created 11 years, 2 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
« 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 # Notify the user if there is an orphaned entry in their working copy. 739 # Notify the user if there is an orphaned entry in their working copy.
740 # Only delete the directory if there are no changes in it, and 740 # Only delete the directory if there are no changes in it, and
741 # delete_unversioned_trees is set to true. 741 # delete_unversioned_trees is set to true.
742 prev_entries = self._ReadEntries() 742 prev_entries = self._ReadEntries()
743 for entry in prev_entries: 743 for entry in prev_entries:
744 # Fix path separator on Windows. 744 # Fix path separator on Windows.
745 entry_fixed = entry.replace('/', os.path.sep) 745 entry_fixed = entry.replace('/', os.path.sep)
746 e_dir = os.path.join(self._root_dir, entry_fixed) 746 e_dir = os.path.join(self._root_dir, entry_fixed)
747 # Use entry and not entry_fixed there. 747 # Use entry and not entry_fixed there.
748 if entry not in entries and os.path.exists(e_dir): 748 if entry not in entries and os.path.exists(e_dir):
749 file_list = [] 749 modified_files = False
750 scm = gclient_scm.CreateSCM(prev_entries[entry], self._root_dir, 750 if isinstance(prev_entries,list):
M-A Ruel 2009/09/28 18:49:08 if isinstance(prev_entries, list):
751 entry_fixed) 751 # old .gclient_entries format was list, now dict
752 scm.status(self._options, [], file_list) 752 modified_files = gclient_scm.CaptureSVNStatus(e_dir)
753 if not self._options.delete_unversioned_trees or file_list: 753 else:
754 file_list = []
755 scm = gclient_scm.CreateSCM(prev_entries[entry], self._root_dir,
756 entry_fixed)
757 scm.status(self._options, [], file_list)
758 modified_files = file_list != []
759 if not self._options.delete_unversioned_trees or modified_files:
754 # There are modified files in this entry. Keep warning until 760 # There are modified files in this entry. Keep warning until
755 # removed. 761 # removed.
756 print(("\nWARNING: \"%s\" is no longer part of this client. " 762 print(("\nWARNING: \"%s\" is no longer part of this client. "
757 "It is recommended that you manually remove it.\n") % 763 "It is recommended that you manually remove it.\n") %
758 entry_fixed) 764 entry_fixed)
759 else: 765 else:
760 # Delete the entry 766 # Delete the entry
761 print("\n________ deleting \'%s\' " + 767 print("\n________ deleting \'%s\' " +
762 "in \'%s\'") % (entry_fixed, self._root_dir) 768 "in \'%s\'") % (entry_fixed, self._root_dir)
763 gclient_utils.RemoveDirectory(e_dir) 769 gclient_utils.RemoveDirectory(e_dir)
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1189
1184 if "__main__" == __name__: 1190 if "__main__" == __name__:
1185 try: 1191 try:
1186 result = Main(sys.argv) 1192 result = Main(sys.argv)
1187 except Error, e: 1193 except Error, e:
1188 print >> sys.stderr, "Error: %s" % str(e) 1194 print >> sys.stderr, "Error: %s" % str(e)
1189 result = 1 1195 result = 1
1190 sys.exit(result) 1196 sys.exit(result)
1191 1197
1192 # vim: ts=2:sw=2:tw=80:et: 1198 # 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