convert: change default for git rename detection to 50%
authorSiddharth Agarwal <sid0@fb.com>
Tue, 23 Sep 2014 14:45:23 -0700
changeset 22512 6b6da715cb96
parent 22511 b1ec65b3ba31
child 22513 ca709785caf2
convert: change default for git rename detection to 50% This default mirrors the default for 'git diff'. Other commands have slightly different defaults -- for example, the move/copy detection for 'git blame' assumes that a hunk is moved if more than 40 alphanumeric characters are the same, or copied if more than 20 alphanumeric characters are the same. 50% seems to be the most common default, though.
hgext/convert/__init__.py
hgext/convert/git.py
tests/test-convert.t
--- a/hgext/convert/__init__.py	Tue Sep 23 14:40:32 2014 -0700
+++ b/hgext/convert/__init__.py	Tue Sep 23 14:45:23 2014 -0700
@@ -298,7 +298,7 @@
         percentage between ``0`` (disabled) and ``100`` (files must be
         identical). For example, ``90`` means that a delete/add pair will
         be imported as a rename if more than 90% of the file hasn't
-        changed. The default is ``0``.
+        changed. The default is ``50``.
 
     :convert.git.findcopiesharder: while detecting copies, look at all
         files in the working copy instead of just changed ones. This
--- a/hgext/convert/git.py	Tue Sep 23 14:40:32 2014 -0700
+++ b/hgext/convert/git.py	Tue Sep 23 14:45:23 2014 -0700
@@ -94,7 +94,8 @@
         if not os.path.exists(path + "/objects"):
             raise NoRepo(_("%s does not look like a Git repository") % path)
 
-        similarity = ui.configint('convert', 'git.similarity', default=0)
+        # The default value (50) is based on the default for 'git diff'.
+        similarity = ui.configint('convert', 'git.similarity', default=50)
         if similarity < 0 or similarity > 100:
             raise util.Abort(_('similarity must be between 0 and 100'))
         if similarity > 0:
--- a/tests/test-convert.t	Tue Sep 23 14:40:32 2014 -0700
+++ b/tests/test-convert.t	Tue Sep 23 14:45:23 2014 -0700
@@ -252,7 +252,7 @@
                     (disabled) and "100" (files must be identical). For example,
                     "90" means that a delete/add pair will be imported as a
                     rename if more than 90% of the file hasn't changed. The
-                    default is "0".
+                    default is "50".
       convert.git.findcopiesharder
                     while detecting copies, look at all files in the working
                     copy instead of just changed ones. This is very expensive