Mercurial > hg-stable
changeset 33142:0a638f37f2d2
configitems: register 'blackbox.maxsize' as an example of 'configbytes'
This exercise the default value handling in 'configbytes'.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 17 Jun 2017 13:21:06 +0200 |
parents | 7dc090faa8a4 |
children | 59c135bb31bc |
files | hgext/blackbox.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/blackbox.py Sat Jun 17 13:41:28 2017 +0200 +++ b/hgext/blackbox.py Sat Jun 17 13:21:06 2017 +0200 @@ -58,6 +58,13 @@ cmdtable = {} command = registrar.command(cmdtable) +configtable = {} +configitem = registrar.configitem(configtable) + +configitem('blackbox', 'maxsize', + default=1048576, +) + lastui = None filehandles = {} @@ -120,7 +127,7 @@ (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: