Mercurial > hg-stable
changeset 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 | 1257cc6c1a2f |
children | 27e2317efe89 |
files | mercurial/dispatch.py mercurial/error.py |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Tue Sep 30 16:01:19 2014 -0700 +++ b/mercurial/dispatch.py Wed Sep 03 15:59:03 2014 -0400 @@ -193,6 +193,8 @@ ui.warn(_(" empty string\n")) else: ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) + except error.CensoredNodeError, inst: + ui.warn(_("abort: file censored %s!\n") % inst) except error.RevlogError, inst: ui.warn(_("abort: %s!\n") % inst) except error.SignalInterrupt:
--- a/mercurial/error.py Tue Sep 30 16:01:19 2014 -0700 +++ b/mercurial/error.py Wed Sep 03 15:59:03 2014 -0400 @@ -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)))