# HG changeset patch # User Matt Mackall # Date 1433447878 18000 # Node ID 0bda5bfaf0b148e585e68257fe5b48ab9c88f9a7 # Parent 4642f0b803ae0970ecdcb6c567e9182d728c135a revlog: move size limit check to addrevision This lets us add the name of the indexfile to the message. diff -r 4642f0b803ae -r 0bda5bfaf0b1 mercurial/revlog.py --- a/mercurial/revlog.py Wed May 20 11:55:59 2015 -0500 +++ b/mercurial/revlog.py Thu Jun 04 14:57:58 2015 -0500 @@ -167,12 +167,6 @@ return index, getattr(index, 'nodemap', None), cache def packentry(self, entry, node, version, rev): - uncompressedlength = entry[2] - if uncompressedlength > _maxentrysize: - raise RevlogError( - _("size of %d bytes exceeds maximum revlog storage of 2GiB") - % uncompressedlength) - p = _pack(indexformatng, *entry) if rev == 0: p = _pack(versionformat, version) + p[4:] @@ -1190,6 +1184,12 @@ if link == nullrev: raise RevlogError(_("attempted to add linkrev -1 to %s") % self.indexfile) + + if len(text) > _maxentrysize: + raise RevlogError( + _("%s: size of %d bytes exceeds maximum revlog storage of 2GiB") + % (self.indexfile, len(text))) + node = node or self.hash(text, p1, p2) if node in self.nodemap: return node