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 <normalperson@yhbt.net>
This commit is contained in:
Eric Wong 2007-01-11 02:14:43 -08:00
parent d81bf82719
commit 336f1714ae

View File

@ -49,19 +49,28 @@ use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
use POSIX qw/strftime/; use POSIX qw/strftime/;
use IPC::Open3; use IPC::Open3;
use Memoize; use Memoize;
use Git qw/command command_oneline command_noisy use Git;
command_output_pipe command_input_pipe command_close_pipe/;
memoize('revisions_eq'); memoize('revisions_eq');
memoize('cmt_metadata'); memoize('cmt_metadata');
memoize('get_commit_time'); 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 ($SVN);
my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS}; my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS};
my $sha1 = qr/[a-f\d]{40}/; my $sha1 = qr/[a-f\d]{40}/;
my $sha1_short = qr/[a-f\d]{4,40}/; my $sha1_short = qr/[a-f\d]{4,40}/;
my $_esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/; 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, $_find_copies_harder, $_l, $_cp_similarity, $_cp_remote,
$_repack, $_repack_nr, $_repack_flags, $_q, $_repack, $_repack_nr, $_repack_flags, $_q,
$_message, $_file, $_no_metadata, $_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, $_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive, $_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
$_pager, $_color, $_prefix); $_pager, $_color, $_prefix);
my (@_branch_from, %tree_map, %users, %rusers, %equiv); my (@_branch_from, %tree_map, %users, %rusers);
my ($_svn_can_do_switch);
my @repo_path_split_cache; my @repo_path_split_cache;
use vars qw/$_follow_parent/; use vars qw/$_follow_parent/;
my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext, my %fc_opts = ( 'branch|b=s' => \@_branch_from,
'branch|b=s' => \@_branch_from,
'follow-parent|follow' => \$_follow_parent, 'follow-parent|follow' => \$_follow_parent,
'branch-all-refs|B' => \$_branch_all_refs, 'branch-all-refs|B' => \$_branch_all_refs,
'authors-file|A=s' => \$_authors, 'authors-file|A=s' => \$_authors,
@ -117,8 +124,7 @@ my %cmd = (
'show-ignore' => [ \&show_ignore, "Show svn:ignore listings", 'show-ignore' => [ \&show_ignore, "Show svn:ignore listings",
{ 'revision|r=i' => \$_revision } ], { 'revision|r=i' => \$_revision } ],
rebuild => [ \&rebuild, "Rebuild git-svn metadata (after git clone)", 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 } ], 'upgrade' => \$_upgrade } ],
'graft-branches' => [ \&graft_branches, 'graft-branches' => [ \&graft_branches,
'Detect merges/branches from already imported history', 'Detect merges/branches from already imported history',
@ -2476,8 +2482,6 @@ use strict;
use warnings; use warnings;
use Carp qw/croak/; use Carp qw/croak/;
use IO::File qw//; 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 # file baton members: path, mode_a, mode_b, pool, fh, blob, base
sub new { sub new {
@ -2684,8 +2688,6 @@ use strict;
use warnings; use warnings;
use Carp qw/croak/; use Carp qw/croak/;
use IO::File; use IO::File;
use Git qw/command command_oneline command_noisy
command_output_pipe command_input_pipe command_close_pipe/;
sub new { sub new {
my $class = shift; my $class = shift;