Patchwork [1,of,5] error: add metadata attribute to CensoredNodeError

login
register
mail settings
Submitter adgar@google.com
Date Nov. 6, 2014, 7:03 p.m.
Message ID <f54bf90d831c689fc0c0.1415300587@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/6610/
State Changes Requested
Headers show

Comments

adgar@google.com - Nov. 6, 2014, 7:03 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1410735479 14400
#      Sun Sep 14 18:57:59 2014 -0400
# Node ID f54bf90d831c689fc0c0be93d733851644dc8a86
# Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
error: add metadata attribute to CensoredNodeError

This attribute will be used to construct appropriate changegroup
deltas, preserving the censorship tombstone data, while still
treating censored nodes as an exceptional case in all code paths.
Pierre-Yves David - Nov. 6, 2014, 11:01 p.m.
On 11/06/2014 07:03 PM, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1410735479 14400
> #      Sun Sep 14 18:57:59 2014 -0400
> # Node ID f54bf90d831c689fc0c0be93d733851644dc8a86
> # Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
> error: add metadata attribute to CensoredNodeError

After reading the whole series, I understand it is about allowing 
packing and unbundling of a changegroup containing (or based one) 
Censored revision.

This series propose to use the content of the tombstone as a the 
base-data for the delta computation. I do not think it make sense to use 
the tombstone content here. An empty string doing the job at least as 
well with less complexity.

I discussed that a bit on IRC with Mike. I'm now waiting for a V2 not 
using the tombstone content.

In the censored base could also be avoided entirely when using general 
delta. But this is further adventure.

Patch

diff -r 2d54aa5397cd -r f54bf90d831c mercurial/error.py
--- a/mercurial/error.py	Sat Oct 18 01:09:41 2014 -0700
+++ b/mercurial/error.py	Sun Sep 14 18:57:59 2014 -0400
@@ -130,6 +130,7 @@ 
 class CensoredNodeError(RevlogError):
     """error raised when content verification fails on a censored node"""
 
-    def __init__(self, filename, node):
+    def __init__(self, filename, node, metadata):
+        self.metadata = metadata
         from node import short
         RevlogError.__init__(self, '%s:%s' % (filename, short(node)))
diff -r 2d54aa5397cd -r f54bf90d831c mercurial/filelog.py
--- a/mercurial/filelog.py	Sat Oct 18 01:09:41 2014 -0700
+++ b/mercurial/filelog.py	Sun Sep 14 18:57:59 2014 -0400
@@ -101,7 +101,7 @@ 
             super(filelog, self).checkhash(text, p1, p2, node, rev=rev)
         except error.RevlogError:
             if _censoredtext(text):
-                raise error.CensoredNodeError(self.indexfile, node)
+                raise error.CensoredNodeError(self.indexfile, node, text)
             raise
 
     def _file(self, f):