Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index 29ee421acc431bcaa380eed0ef84c8bed1f7d5b0..adb15539e3f96de0ea4b017ca034d10abf0ab170 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -134,7 +134,7 @@ def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards): |
| return None |
| -def print_stats(args): |
| +def print_stats(options, args): |
| """Prints statistics about the change to the user.""" |
| # --no-ext-diff is broken in some versions of Git, so try to work around |
| # this by overriding the environment (but there is still a problem if the |
| @@ -144,7 +144,7 @@ def print_stats(args): |
| del env['GIT_EXTERNAL_DIFF'] |
| return subprocess2.call( |
| ['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', |
| - '-l100000'] + args, env=env) |
| + '-C%s' % options.git_similarity, '-l100000'] + args, env=env) |
| class Settings(object): |
| @@ -1037,6 +1037,8 @@ def RietveldUpload(options, args, cl): |
| if cc: |
| upload_args.extend(['--cc', cc]) |
| + upload_args.extend(['--git_similarity', str(options.git_similarity)]) |
| + |
| # Include the upstream repo's URL in the change -- this is useful for |
| # projects that have their source spread across multiple repos. |
| remote_url = cl.GetGitBaseUrlFromConfig() |
| @@ -1138,7 +1140,7 @@ def CMDupload(parser, args): |
| if not options.reviewers and hook_results.reviewers: |
| options.reviewers = hook_results.reviewers |
| - print_stats(args) |
| + print_stats(options, args) |
| if settings.GetIsGerrit(): |
| return GerritUpload(options, args, cl) |
| return RietveldUpload(options, args, cl) |
| @@ -1271,7 +1273,7 @@ def SendUpstream(parser, args, cmd): |
| branches = [base_branch, cl.GetBranchRef()] |
| if not options.force: |
| - print_stats(branches) |
| + print_stats(options, branches) |
| ask_for_data('About to commit; enter to confirm.') |
| # We want to squash all this branch's commits into one commit with the proper |
| @@ -1320,6 +1322,7 @@ def SendUpstream(parser, args, cmd): |
| else: |
| # dcommit the merge branch. |
| retcode, output = RunGitWithCode(['svn', 'dcommit', |
| + '-C%s' % options.git_similarity, |
| '--no-rebase', '--rmdir']) |
| finally: |
| # And then swap back to the original branch and clean up. |
| @@ -1677,6 +1680,11 @@ def main(argv): |
| parser.add_option( |
| '-v', '--verbose', action='count', default=0, |
| help='Use 2 times for more debugging info') |
| + parser.add_option( |
| + '-C', '-M', '--git_similarity', '--find-copies-harder', type='int', |
|
cmp
2012/09/18 01:44:15
let's call this just --similarity to keep it simpl
|
| + dest='git_similarity', action='store', metavar='SIM', default=50, |
| + help='Sets the percentage that a pair of files need to match in order to' |
| + ' be considered copies (default 50)') |
|
cmp
2012/09/18 01:44:15
please note here that this is only used for Git (n
|
| old_parser_args = parser.parse_args |
| def Parse(args): |
| options, args = old_parser_args(args) |