mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
convert: config option for git rename limit
By default, Git applies rename and copy detection to 400 files. The diff.renamelimit config option and -l argument to diff commands can override this. As part of converting some repositories in the wild, I was hitting the default limit. Unfortunately, the warnings that Git prints in this scenario are swallowed because the process running functionality in common.py redirects stderr to /dev/null by default. This seems like a bug, but a bug for another day. This commit establishes a config option to send the rename limit through to `git diff-tree`. The added tests demonstrate a too-low rename limit doesn't result in copy metadata being recorded.
This commit is contained in:
parent
55f132e688
commit
8f73471951
@ -320,6 +320,13 @@ def convert(ui, src, dest=None, revmapfile=None, **opts):
|
||||
is very expensive for large projects, and is only effective when
|
||||
``convert.git.similarity`` is greater than 0. The default is False.
|
||||
|
||||
:convert.git.renamelimit: perform rename and copy detection up to this
|
||||
many changed files in a commit. Increasing this will make rename
|
||||
and copy detection more accurate but will significantly slow down
|
||||
computation on large projects. The option is only relevant if
|
||||
``convert.git.similarity`` is greater than 0. The default is
|
||||
``400``.
|
||||
|
||||
:convert.git.remoteprefix: remote refs are converted as bookmarks with
|
||||
``convert.git.remoteprefix`` as a prefix followed by a /. The default
|
||||
is 'remote'.
|
||||
|
@ -78,6 +78,10 @@ class convert_git(common.converter_source, common.commandline):
|
||||
False)
|
||||
if findcopiesharder:
|
||||
self.simopt.append('--find-copies-harder')
|
||||
|
||||
renamelimit = ui.configint('convert', 'git.renamelimit',
|
||||
default=400)
|
||||
self.simopt.append('-l%d' % renamelimit)
|
||||
else:
|
||||
self.simopt = []
|
||||
|
||||
|
@ -374,6 +374,31 @@ source, the copy source took the contents of the copy dest)
|
||||
A bar-copied2
|
||||
bar
|
||||
|
||||
renamelimit config option works
|
||||
|
||||
$ cd git-repo2
|
||||
$ cp bar bar-copy0
|
||||
$ echo 0 >> bar-copy0
|
||||
$ cp bar bar-copy1
|
||||
$ echo 1 >> bar-copy1
|
||||
$ git add bar-copy0 bar-copy1
|
||||
$ commit -a -m 'copy bar 2 times'
|
||||
$ cd ..
|
||||
|
||||
$ hg -q convert --config convert.git.renamelimit=1 \
|
||||
> --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2
|
||||
$ hg -R fullrepo2 status -C --change master
|
||||
A bar-copy0
|
||||
A bar-copy1
|
||||
|
||||
$ hg -q convert --config convert.git.renamelimit=100 \
|
||||
> --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3
|
||||
$ hg -R fullrepo3 status -C --change master
|
||||
A bar-copy0
|
||||
bar
|
||||
A bar-copy1
|
||||
bar
|
||||
|
||||
test binary conversion (issue1359)
|
||||
|
||||
$ count=19
|
||||
|
@ -261,6 +261,13 @@
|
||||
for large projects, and is only effective when
|
||||
"convert.git.similarity" is greater than 0. The default is
|
||||
False.
|
||||
convert.git.renamelimit
|
||||
perform rename and copy detection up to this many changed
|
||||
files in a commit. Increasing this will make rename and copy
|
||||
detection more accurate but will significantly slow down
|
||||
computation on large projects. The option is only relevant
|
||||
if "convert.git.similarity" is greater than 0. The default
|
||||
is "400".
|
||||
convert.git.remoteprefix
|
||||
remote refs are converted as bookmarks with
|
||||
"convert.git.remoteprefix" as a prefix followed by a /. The
|
||||
|
Loading…
Reference in New Issue
Block a user