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>
Eric Wong committed
Jan 11, 2007 at 02:14 UTC
336f1714ae4211f97a33e2f672ec9c3479b4e5ba
1 file changed
+15
-13
git-svn.perl
+15
-13
@@ -49,19 +49,28 @@ use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
49
use POSIX qw/strftime/;
50
use IPC::Open3;
51
use Memoize;
52
-use Git qw/command command_oneline command_noisy
53
- command_output_pipe command_input_pipe command_close_pipe/;
52
+use Git;
53
memoize('revisions_eq');
54
memoize('cmt_metadata');
55
memoize('get_commit_time');
56
57
+BEGIN {
58
+ my $s;
59
+ foreach (qw/command command_oneline command_noisy command_output_pipe
60
+ command_input_pipe command_close_pipe/) {
61
+ $s .= "*SVN::Git::Editor::$_ = *SVN::Git::Fetcher::$_ = ".
62
+ "*$_ = *Git::$_; ";
63
+ }
64
+ eval $s;
65
+}
66
+
67
my ($SVN);
68
69
my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS};
70
my $sha1 = qr/[a-f\d]{40}/;
71
my $sha1_short = qr/[a-f\d]{4,40}/;
72
my $_esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
64
-my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
73
+my ($_revision,$_stdin,$_help,$_rmdir,$_edit,
74
$_find_copies_harder, $_l, $_cp_similarity, $_cp_remote,
75
$_repack, $_repack_nr, $_repack_flags, $_q,
76
$_message, $_file, $_no_metadata,
@@ -70,13 +79,11 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
79
$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
80
$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
81
$_pager, $_color, $_prefix);
73
-my (@_branch_from, %tree_map, %users, %rusers, %equiv);
74
-my ($_svn_can_do_switch);
82
+my (@_branch_from, %tree_map, %users, %rusers);
83
my @repo_path_split_cache;
84
use vars qw/$_follow_parent/;
85
78
-my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
79
- 'branch|b=s' => \@_branch_from,
86
+my %fc_opts = ( 'branch|b=s' => \@_branch_from,
87
'follow-parent|follow' => \$_follow_parent,
88
'branch-all-refs|B' => \$_branch_all_refs,
89
'authors-file|A=s' => \$_authors,
@@ -117,8 +124,7 @@ my %cmd = (
124
'show-ignore' => [ \&show_ignore, "Show svn:ignore listings",
125
{ 'revision|r=i' => \$_revision } ],
126
rebuild => [ \&rebuild, "Rebuild git-svn metadata (after git clone)",
120
- { 'no-ignore-externals' => \$_no_ignore_ext,
121
- 'copy-remote|remote=s' => \$_cp_remote,
127
+ { 'copy-remote|remote=s' => \$_cp_remote,
128
'upgrade' => \$_upgrade } ],
129
'graft-branches' => [ \&graft_branches,
130
'Detect merges/branches from already imported history',
@@ -2476,8 +2482,6 @@ use strict;
2482
use warnings;
2483
use Carp qw/croak/;
2484
use IO::File qw//;
2479
-use Git qw/command command_oneline command_noisy
2480
- command_output_pipe command_input_pipe command_close_pipe/;
2485
2486
# file baton members: path, mode_a, mode_b, pool, fh, blob, base
2487
sub new {
@@ -2684,8 +2688,6 @@ use strict;
2688
use warnings;
2689
use Carp qw/croak/;
2690
use IO::File;
2687
-use Git qw/command command_oneline command_noisy
2688
- command_output_pipe command_input_pipe command_close_pipe/;
2691
2692
sub new {
2693
my $class = shift;