def add_git_similarity(parser):
    parser.add_option('--similarity', metavar='SIM', type='int', action='store', help='Sets the percentage that a pair of files need to match in order to be considered copies (default 50)')
    parser.add_option('--find-copies', action='store_true', help='Allows git to look for copies.')
    parser.add_option('--no-find-copies', action='store_false', dest='find_copies', help='Disallows git from looking for copies.')
    old_parser_args = parser.parse_args

    def Parse(args):
        (options, args) = old_parser_args(args)
        if (options.similarity is None):
            options.similarity = git_get_branch_default('git-cl-similarity', 50)
        else:
            print(('Note: Saving similarity of %d%% in git config.' % options.similarity))
            git_set_branch_value('git-cl-similarity', options.similarity)
        options.similarity = max(0, min(options.similarity, 100))
        if (options.find_copies is None):
            options.find_copies = bool(git_get_branch_default('git-find-copies', True))
        else:
            git_set_branch_value('git-find-copies', int(options.find_copies))
        print(('Using %d%% similarity for rename/copy detection. Override with --similarity.' % options.similarity))
        return (options, args)
    parser.parse_args = Parse
def add_git_similarity(parser):
    parser.add_option('--similarity', metavar='SIM', type='int', action='store', help='Sets the percentage that a pair of files need to match in order to be considered copies (default 50)')
    parser.add_option('--find-copies', action='store_true', help='Allows git to look for copies.')
    parser.add_option('--no-find-copies', action='store_false', dest='find_copies', help='Disallows git from looking for copies.')
    old_parser_args = parser.parse_args

    def Parse(args):
        (options, args) = old_parser_args(args)
        if (options.similarity is None):
            options.similarity = git_get_branch_default('git-cl-similarity', 50)
        else:
            print(('Note: Saving similarity of %d%% in git config.' % options.similarity))
            git_set_branch_value('git-cl-similarity', options.similarity)
        options.similarity = max(0, min(options.similarity, 100))
        if (options.find_copies is None):
            options.find_copies = bool(git_get_branch_default('git-find-copies', True))
        else:
            git_set_branch_value('git-find-copies', int(options.find_copies))
        print(('Using %d%% similarity for rename/copy detection. Override with --similarity.' % options.similarity))
        return (options, args)
    parser.parse_args = Parse