# HG changeset patch # User Pierre-Yves David # Date 2017-06-17 11:21:06 # Node ID 0a638f37f2d23599b1a84e264184cd5479c91dec # Parent 7dc090faa8a4a10466a3d61905348288f7337244 configitems: register 'blackbox.maxsize' as an example of 'configbytes' This exercise the default value handling in 'configbytes'. diff --git a/hgext/blackbox.py b/hgext/blackbox.py --- a/hgext/blackbox.py +++ b/hgext/blackbox.py @@ -58,6 +58,13 @@ testedwith = 'ships-with-hg-core' cmdtable = {} command = registrar.command(cmdtable) +configtable = {} +configitem = registrar.configitem(configtable) + +configitem('blackbox', 'maxsize', + default=1048576, +) + lastui = None filehandles = {} @@ -120,7 +127,7 @@ def wrapui(ui): (newpath, oldpath, err.strerror)) fp = _openlog(self._bbvfs) - maxsize = self.configbytes('blackbox', 'maxsize', 1048576) + maxsize = self.configbytes('blackbox', 'maxsize') if maxsize > 0: st = self._bbvfs.fstat(fp) if st.st_size >= maxsize: