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 497333003: Fix gclient hook for stubborn hooks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: only the rename Created 6 years, 4 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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 print( 1309 print(
1310 """ 1310 """
1311 WARNING: gclient detected an obsolete setting in your %s file. The file has 1311 WARNING: gclient detected an obsolete setting in your %s file. The file has
1312 been automagically updated. The previous version is available at %s.old. 1312 been automagically updated. The previous version is available at %s.old.
1313 """ % (options.config_filename, options.config_filename)) 1313 """ % (options.config_filename, options.config_filename))
1314 1314
1315 # Replace existing .gclient with the updated version. 1315 # Replace existing .gclient with the updated version.
1316 # Return a new GClient instance based on the new content. 1316 # Return a new GClient instance based on the new content.
1317 new_content = ast2str(a) 1317 new_content = ast2str(a)
1318 dot_gclient_fn = os.path.join(path, options.config_filename) 1318 dot_gclient_fn = os.path.join(path, options.config_filename)
1319 os.rename(dot_gclient_fn, dot_gclient_fn + '.old') 1319 try:
1320 fh = open(dot_gclient_fn, 'w') 1320 os.rename(dot_gclient_fn, dot_gclient_fn + '.old')
1321 fh.write(new_content) 1321 except OSError:
1322 fh.close() 1322 pass
1323 with open(dot_gclient_fn, 'w') as fh:
1324 fh.write(new_content)
1323 client = GClient(path, options) 1325 client = GClient(path, options)
1324 client.SetConfig(new_content) 1326 client.SetConfig(new_content)
1325 return client 1327 return client
1326 1328
1327 @staticmethod 1329 @staticmethod
1328 def LoadCurrentConfig(options): 1330 def LoadCurrentConfig(options):
1329 """Searches for and loads a .gclient file relative to the current working 1331 """Searches for and loads a .gclient file relative to the current working
1330 dir. Returns a GClient object.""" 1332 dir. Returns a GClient object."""
1331 if options.spec: 1333 if options.spec:
1332 client = GClient('.', options) 1334 client = GClient('.', options)
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 print >> sys.stderr, 'Error: %s' % str(e) 2192 print >> sys.stderr, 'Error: %s' % str(e)
2191 return 1 2193 return 1
2192 finally: 2194 finally:
2193 gclient_utils.PrintWarnings() 2195 gclient_utils.PrintWarnings()
2194 2196
2195 2197
2196 if '__main__' == __name__: 2198 if '__main__' == __name__:
2197 sys.exit(Main(sys.argv[1:])) 2199 sys.exit(Main(sys.argv[1:]))
2198 2200
2199 # vim: ts=2:sw=2:tw=80:et: 2201 # 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