convert: add support to find git copies from all files in the working copy
I couldn't think of a better name for this option, so I stole the Git one in
the hope that anyone converting a Git repo knows what it means.
--- a/hgext/convert/__init__.py Fri Sep 12 11:23:26 2014 -0700
+++ b/hgext/convert/__init__.py Fri Sep 12 12:28:30 2014 -0700
@@ -300,6 +300,11 @@
be imported as a rename if more than 90% of the file hasn't
changed. The default is ``0``.
+ :convert.git.findcopiesharder: while detecting copies, look at all
+ files in the working copy instead of just changed ones. This
+ is very expensive for large projects, and is only effective when
+ ``convert.git.similarity`` is greater than 0. The default is False.
+
Perforce Source
###############
--- a/hgext/convert/git.py Fri Sep 12 11:23:26 2014 -0700
+++ b/hgext/convert/git.py Fri Sep 12 12:28:30 2014 -0700
@@ -102,6 +102,10 @@
raise util.Abort(_('similarity must be between 0 and 100'))
if similarity > 0:
self.simopt = '--find-copies=%d%%' % similarity
+ findcopiesharder = ui.configbool('convert', 'git.findcopiesharder',
+ False)
+ if findcopiesharder:
+ self.simopt += ' --find-copies-harder'
else:
self.simopt = ''
--- a/tests/test-convert-git.t Fri Sep 12 11:23:26 2014 -0700
+++ b/tests/test-convert-git.t Fri Sep 12 12:28:30 2014 -0700
@@ -277,6 +277,18 @@
foo
R foo
+ $ cd git-repo2
+ $ cp bar bar-copied2
+ $ git add bar-copied2
+ $ commit -a -m 'copy with no changes'
+ $ cd ..
+
+ $ hg -q convert --config convert.git.similarity=100 \
+ > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
+ $ hg -R fullrepo status -C --change master
+ A bar-copied2
+ bar
+
test binary conversion (issue1359)
$ count=19
--- a/tests/test-convert.t Fri Sep 12 11:23:26 2014 -0700
+++ b/tests/test-convert.t Fri Sep 12 12:28:30 2014 -0700
@@ -253,6 +253,12 @@
"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".
+ convert.git.findcopiesharder
+ while detecting copies, look at all files in the working
+ copy instead of just changed ones. This is very expensive
+ for large projects, and is only effective when
+ "convert.git.similarity" is greater than 0. The default is
+ False.
Perforce Source
###############