# HG changeset patch # User Mike Edgar # Date 2014-09-03 20:34:29 # Node ID 8a096d4d0862c5ba5b08ed22c732015bbc866add # Parent 3a60cd44e619097bdf21e13a782755aedca726d6 revlog: support importing censored file revision tombstones This change allows a revision log to not fail integrity checks when applying a changegroup delta (eg from a bundle) results in a censored file tombstone. The tombstone is inserted as-is, so future integrity verification will observe the tombstone. Deltas based on the tombstone will also remain correct. The new code path is encountered for *exactly* the cases where _addrevision is importing a tombstone from a changegroup. When committing a file containing the "magic" tombstone text, the "text" parameter will be non-empty and the checkhash call is not executed (and when committing, the node will be computed to match the "magic" tombstone text). diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -42,6 +42,7 @@ REVIDX_KNOWN_FLAGS = 0 RevlogError = error.RevlogError LookupError = error.LookupError +CensoredNodeError = error.CensoredNodeError def getoffset(q): return int(q >> 16) @@ -1176,7 +1177,10 @@ class revlog(object): ifh.flush() basetext = self.revision(self.node(cachedelta[0])) btext[0] = mdiff.patch(basetext, cachedelta[1]) - self.checkhash(btext[0], p1, p2, node) + try: + self.checkhash(btext[0], p1, p2, node) + except CensoredNodeError: + pass # always import a censor tombstone. return btext[0] def builddelta(rev):