[PATCH] obsolete: use ProgrammingError over assert for volatile set registration
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Jun 16 23:41:20 UTC 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1493611056 -7200
# Mon May 01 05:57:36 2017 +0200
# Node ID 71bd57c9bcd3982861ef502bde397bcdce9b4abb
# Parent 29558247b00eff8c95c7604032b59cfbab34010d
# EXP-Topic programming-error
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
# hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 71bd57c9bcd3
obsolete: use ProgrammingError over assert for volatile set registration
We have ProgrammingError now.
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1273,7 +1273,9 @@ cachefuncs = {}
def cachefor(name):
"""Decorator to register a function as computing the cache for a set"""
def decorator(func):
- assert name not in cachefuncs
+ if name in cachefuncs:
+ msg = "duplicated registration for volatileset '%s' (existing: %r)"
+ raise error.ProgrammingError(msg % (name, cachefuncs[name]))
cachefuncs[name] = func
return func
return decorator
More information about the Mercurial-devel
mailing list