changeset 34496:18cd210535b3

configitems: register the 'shelve.maxbackups' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:44:19 +0200
parents 6d1b0970f80c
children f9734580f2b6
files hgext/shelve.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Fri Jun 30 03:43:33 2017 +0200
+++ b/hgext/shelve.py	Fri Jun 30 03:44:19 2017 +0200
@@ -63,6 +63,13 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('shelve', 'maxbackups',
+    default=10,
+)
+
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
 shelvefileextensions = ['hg', 'patch', 'oshelve']
@@ -271,7 +278,7 @@
 
 def cleanupoldbackups(repo):
     vfs = vfsmod.vfs(repo.vfs.join(backupdir))
-    maxbackups = repo.ui.configint('shelve', 'maxbackups', 10)
+    maxbackups = repo.ui.configint('shelve', 'maxbackups')
     hgfiles = [f for f in vfs.listdir()
                if f.endswith('.' + patchextension)]
     hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles])