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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index a92cce05c0426d817b7ed9bfe6a99b0c394ad7ae..fb9775945bc53aacc13eaf89d35bf0c31e6271f1 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1316,10 +1316,12 @@ been automagically updated. The previous version is available at %s.old.
# Return a new GClient instance based on the new content.
new_content = ast2str(a)
dot_gclient_fn = os.path.join(path, options.config_filename)
- os.rename(dot_gclient_fn, dot_gclient_fn + '.old')
- fh = open(dot_gclient_fn, 'w')
- fh.write(new_content)
- fh.close()
+ try:
+ os.rename(dot_gclient_fn, dot_gclient_fn + '.old')
+ except OSError:
+ pass
+ with open(dot_gclient_fn, 'w') as fh:
+ fh.write(new_content)
client = GClient(path, options)
client.SetConfig(new_content)
return client
« 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