[PATCH 03 of 18 V2] branchmap: ignore Abort error while writing cache

Kevin Bullock kbullock+mercurial at ringworld.org
Thu Jan 3 21:31:55 CST 2013


On 3 Jan 2013, at 7:04 PM, Pierre-Yves David wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1357260638 -3600
> # Node ID 3152faab1da3699af0637d78e6b9b3b74a9e3fab
> # Parent  f8a602bc30ba2903fcdf0d0a84c20c3f5c394ad3
> branchmap: ignore Abort error while writing cache
> 
> Read only vfs can now raise Abort exception. Note that encoding.local are also a
> possible raiser.
> 
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -129,19 +129,23 @@ class branchcache(dict):
> 
> 
>     def write(self, repo):
>         try:
>             f = repo.opener(_filename(repo), "w", atomictemp=True)
> +        except (IOError, OSError, util.Abort):
> +            return
> +        try:
>             cachekey = [hex(self.tipnode), str(self.tiprev)]
>             if self.filteredhash is not None:
>                 cachekey.append(hex(self.filteredhash))
>             f.write(" ".join(cachekey) + '\n')
>             for label, nodes in self.iteritems():
>                 for node in nodes:
>                     f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
>             f.close()
> -        except (IOError, OSError):
> +        except (IOError, OSError, util.Abort):
> +            # Abort may be raise by read only opener
Misplaced comment -- looks like it should be on the other 'except:'.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list