diff mercurial/tags.py @ 9366:9ff178e7b627

tags: don't crash if unable to write tag cache This happens with hgweb in real life, if the httpd user is unable to write in the repository directory. Another case is doing 'hg incoming' on a repository in the filesystem owned by someone else.
author Greg Ward <greg-hg@gerg.ca>
date Tue, 18 Aug 2009 22:07:43 -0400
parents c5f0825c1dbb
children e2b1de5fee04
line wrap: on
line diff
--- a/mercurial/tags.py	Wed Aug 19 12:51:07 2009 +0200
+++ b/mercurial/tags.py	Tue Aug 18 22:07:43 2009 -0400
@@ -301,7 +301,10 @@
 
 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
 
-    cachefile = repo.opener('tags.cache', 'w', atomictemp=True)
+    try:
+        cachefile = repo.opener('tags.cache', 'w', atomictemp=True)
+    except (OSError, IOError):
+        return
     _debug(ui, 'writing cache file %s\n' % cachefile.name)
 
     realheads = repo.heads()            # for sanity checks below