changeset 33190:54bc88c56ec8

configitems: register the 'automv.similarity' config Default value has been ported.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 30 Jun 2017 03:27:24 +0200
parents 2b233065f57a
children 1df74b71396d
files hgext/automv.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/automv.py	Sat Jul 01 20:58:34 2017 +0200
+++ b/hgext/automv.py	Fri Jun 30 03:27:24 2017 +0200
@@ -32,10 +32,18 @@
     copies,
     error,
     extensions,
+    registrar,
     scmutil,
     similar
 )
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('automv', 'similarity',
+    default=95,
+)
+
 def extsetup(ui):
     entry = extensions.wrapcommand(
         commands.table, 'commit', mvcheck)
@@ -48,7 +56,7 @@
     renames = None
     disabled = opts.pop('no_automv', False)
     if not disabled:
-        threshold = ui.configint('automv', 'similarity', 95)
+        threshold = ui.configint('automv', 'similarity')
         if not 0 <= threshold <= 100:
             raise error.Abort(_('automv.similarity must be between 0 and 100'))
         if threshold > 0: