[PATCH 2 of 2] convert: change default for git rename detection to 50%
Siddharth Agarwal
sid0 at fb.com
Tue Sep 23 21:47:23 UTC 2014
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1411508723 25200
# Tue Sep 23 14:45:23 2014 -0700
# Node ID 9d18972ea7b42f030326633b70e7e83d7076b027
# Parent 08dc4b2c31c0452927ce637e32f814406a639344
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.
diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -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
diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -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:
diff --git a/tests/test-convert.t b/tests/test-convert.t
--- a/tests/test-convert.t
+++ b/tests/test-convert.t
@@ -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
More information about the Mercurial-devel
mailing list