[PATCH] tags: don't allow environment errors to be raised from _writetagscache

Adrian Buehlmann adrian at cadifra.com
Thu Jun 16 15:45:30 CDT 2011


On 2011-06-16 22:26, Steve Borho wrote:
> # HG changeset patch
> # User Steve Borho <steve at borho.org>
> # Date 1308255977 18000
> # Node ID 4196f029b6b4a1f05dd0eac9a9df9d19424af4cc
> # Parent  ba3c36cea66e7a9cc0bb274b7f7b73ad65212df7
> tags: don't allow environment errors to be raised from _writetagscache
> 
> See https://bitbucket.org/tortoisehg/thg/issue/719

What is an "environment error"?

> diff -r ba3c36cea66e -r 4196f029b6b4 mercurial/tags.py
> --- a/mercurial/tags.py	Thu Jun 16 14:33:06 2011 -0500
> +++ b/mercurial/tags.py	Thu Jun 16 15:26:17 2011 -0500
> @@ -286,4 +286,7 @@
>      for (name, (node, hist)) in cachetags.iteritems():
>          cachefile.write("%s %s\n" % (hex(node), name))
>  
> -    cachefile.rename()
> +    try:
> +        cachefile.rename()
> +    except (OSError, IOError):
> +        pass

This still feels like papering over a problem not clearly understood (at
least on my part).

And, in total, I've pondered about file access on Windows for quite a
while now.


More information about the Mercurial-devel mailing list