From 336f1714ae4211f97a33e2f672ec9c3479b4e5ba Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 11 Jan 2007 02:14:43 -0800 Subject: [PATCH] git-svn: cleanup: avoid re-use()ing Git.pm in sub-packages I will be using functions from Git.pm in more modules, so I want to avoid re-importing the long argument list everywhere it's used. Also removed an unused command-line switch (--no-ignore-externals) and some variables. Signed-off-by: Eric Wong --- git-svn.perl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 5a3a87770..55d9412ec 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -49,19 +49,28 @@ use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/; use POSIX qw/strftime/; use IPC::Open3; use Memoize; -use Git qw/command command_oneline command_noisy - command_output_pipe command_input_pipe command_close_pipe/; +use Git; memoize('revisions_eq'); memoize('cmt_metadata'); memoize('get_commit_time'); +BEGIN { + my $s; + foreach (qw/command command_oneline command_noisy command_output_pipe + command_input_pipe command_close_pipe/) { + $s .= "*SVN::Git::Editor::$_ = *SVN::Git::Fetcher::$_ = ". + "*$_ = *Git::$_; "; + } + eval $s; +} + my ($SVN); my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS}; my $sha1 = qr/[a-f\d]{40}/; my $sha1_short = qr/[a-f\d]{4,40}/; my $_esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/; -my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit, +my ($_revision,$_stdin,$_help,$_rmdir,$_edit, $_find_copies_harder, $_l, $_cp_similarity, $_cp_remote, $_repack, $_repack_nr, $_repack_flags, $_q, $_message, $_file, $_no_metadata, @@ -70,13 +79,11 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit, $_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m, $_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive, $_pager, $_color, $_prefix); -my (@_branch_from, %tree_map, %users, %rusers, %equiv); -my ($_svn_can_do_switch); +my (@_branch_from, %tree_map, %users, %rusers); my @repo_path_split_cache; use vars qw/$_follow_parent/; -my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext, - 'branch|b=s' => \@_branch_from, +my %fc_opts = ( 'branch|b=s' => \@_branch_from, 'follow-parent|follow' => \$_follow_parent, 'branch-all-refs|B' => \$_branch_all_refs, 'authors-file|A=s' => \$_authors, @@ -117,8 +124,7 @@ my %cmd = ( 'show-ignore' => [ \&show_ignore, "Show svn:ignore listings", { 'revision|r=i' => \$_revision } ], rebuild => [ \&rebuild, "Rebuild git-svn metadata (after git clone)", - { 'no-ignore-externals' => \$_no_ignore_ext, - 'copy-remote|remote=s' => \$_cp_remote, + { 'copy-remote|remote=s' => \$_cp_remote, 'upgrade' => \$_upgrade } ], 'graft-branches' => [ \&graft_branches, 'Detect merges/branches from already imported history', @@ -2476,8 +2482,6 @@ use strict; use warnings; use Carp qw/croak/; use IO::File qw//; -use Git qw/command command_oneline command_noisy - command_output_pipe command_input_pipe command_close_pipe/; # file baton members: path, mode_a, mode_b, pool, fh, blob, base sub new { @@ -2684,8 +2688,6 @@ use strict; use warnings; use Carp qw/croak/; use IO::File; -use Git qw/command command_oneline command_noisy - command_output_pipe command_input_pipe command_close_pipe/; sub new { my $class = shift; -- 2.30.2