changeset 28152:5ec1ce8fdf0a

automv: switch to specifying the similarity as an integer (0-100) This is consistent with the addremove --similarity option.
author Martijn Pieters <mjpieters@fb.com>
date Mon, 15 Feb 2016 17:24:42 +0000
parents 74e3d634a30e
children 17c474fdb225
files hgext/automv.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/automv.py	Mon Feb 15 17:16:07 2016 +0000
+++ b/hgext/automv.py	Mon Feb 15 17:24:42 2016 +0000
@@ -10,7 +10,8 @@
 comes from an unrecorded mv.
 
 The threshold at which a file is considered a move can be set with the
-``automv.similarity`` config option; the default value is 1.00.
+``automv.similarity`` config option. This option takes a percentage between 0
+(disabled) and 100 (files must be identical), the default is 100.
 
 """
 from __future__ import absolute_import
@@ -36,11 +37,12 @@
     renames = None
     disabled = opts.pop('no_automv', False)
     if not disabled:
-        threshold = float(ui.config('automv', 'similarity', '1.00'))
+        threshold = float(ui.config('automv', 'similarity', '100'))
         if threshold > 0:
             match = scmutil.match(repo[None], pats, opts)
             added, removed = _interestingfiles(repo, match)
-            renames = _findrenames(repo, match, added, removed, threshold)
+            renames = _findrenames(repo, match, added, removed,
+                                   threshold / 100.0)
 
     with repo.wlock():
         if renames is not None: