From patchwork Fri Oct 6 09:22:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07,of,14] configitems: register the 'shelve.maxbackups' config From: Boris Feld X-Patchwork-Id: 24587 Message-Id: <18cd210535b3d8dc1487.1507281743@FB> To: mercurial-devel@mercurial-scm.org Date: Fri, 06 Oct 2017 11:22:23 +0200 # HG changeset patch # User Boris Feld # Date 1498787059 -7200 # Fri Jun 30 03:44:19 2017 +0200 # Node ID 18cd210535b3d8dc1487a866f9e0553c4f1aa80e # Parent 6d1b0970f80c55692f43d2b466f017f44f0ea441 # EXP-Topic config.register.shelve # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 18cd210535b3 configitems: register the 'shelve.maxbackups' config diff -r 6d1b0970f80c -r 18cd210535b3 hgext/shelve.py --- 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])