Submitter | Siddharth Agarwal |
---|---|
Date | Sept. 23, 2014, 9:47 p.m. |
Message ID | <9d18972ea7b42f030326.1411508843@devbig136.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/5931/ |
State | Accepted |
Headers | show |
Comments
On 09/23/2014 02:47 PM, Siddharth Agarwal wrote: > # HG changeset patch > # User Siddharth Agarwal <sid0@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. Those two are pushed to the clowncopter. lets the bikeshedding about the value begin!
Patch
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