diff mercurial/error.py @ 22595:244478687edd

error: add CensoredNodeError, will be thrown when content deliberately erased This change introduces the error plus a corresponding catch in dispatch, to provide localized error messages. The verb "censor" is used in this commit and all following to refer to erasing the content of a revlog revision (filelog, for now) without recalculating node IDs, leaving that revision invalid. Further work must be done to safely share such revision data with compliant clients. I find the analogy to censorship straightforward; for less politically charged options, consider "erase", "excise", "expunge", or "blackhole".
author Mike Edgar <adgar@google.com>
date Wed, 03 Sep 2014 15:59:03 -0400
parents e3714b927af5
children 73f394f4affc
line wrap: on
line diff
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -117,3 +117,9 @@
     """error raised when code tries to alter a part being generated"""
     pass
 
+class CensoredNodeError(RevlogError):
+    """error raised when content verification fails on a censored node"""
+
+    def __init__(self, filename, node):
+        from node import short
+        RevlogError.__init__(self, '%s:%s' % (filename, short(node)))