[PATCH 03 of 21 RFC] error: add CensoredNodeError, will be thrown when content deliberately erased

Matt Mackall mpm at selenic.com
Thu Sep 11 12:50:40 CDT 2014


On Wed, 2014-09-10 at 20:26 -0400, michaeljedgar at gmail.com wrote:
> # HG changeset patch
> # User Mike Edgar <adgar at google.com>
> # Date 1409774343 14400
> #      Wed Sep 03 15:59:03 2014 -0400
> # Node ID c0a3869d01b083463c70bcf5dc7476e6711a50c5
> # Parent  4ddf6bdba3e218f3809a1632348167f54498e1e7
> error: add CensoredNodeError, will be thrown when content deliberately erased
> 
> This merely introduces the error and leaves it unused. The error provides the
> censored node in the "node" attribute, as it may be raised in ambiguous
> scenarios (eg. delta application).
> 
> 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", a term
> often invoked to indicate permanent data destruction.
> 
> diff -r 4ddf6bdba3e2 -r c0a3869d01b0 mercurial/error.py
> --- a/mercurial/error.py	Sun Aug 31 23:50:53 2014 +0200
> +++ b/mercurial/error.py	Wed Sep 03 15:59:03 2014 -0400
> @@ -117,3 +117,11 @@
>      """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, node, metadata):
> +        self.node = node
> +        self.metadata = metadata
> +        from node import short
> +        RevlogError.__init__(self, 'censored node %s' % short(node))

Wants _(). Maybe wants to take a filename? Dunno about metadata.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list