Skip to content

Commit b0e7525

Browse files
schwernEric Wong
authored andcommitted
Prepare Git::SVN::Migration for extraction from git-svn.
* Load Git command functions on its own. * Load Git::SVN modules on its own. Drive by refactorings... * Use our() instead of use vars. * Eliminate the auto loading of Git functions. Signed-off-by: Eric Wong <[email protected]>
1 parent b74fda1 commit b0e7525

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

git-svn.perl

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
use Git::SVN::Log;
1515
use Git::SVN::Utils qw(fatal can_compress);
1616

17+
use Git qw(
18+
git_cmd_try
19+
command
20+
command_oneline
21+
command_noisy
22+
command_output_pipe
23+
command_close_pipe
24+
command_bidi_pipe
25+
command_close_bidi_pipe
26+
);
27+
28+
1729
# From which subdir have we been invoked?
1830
my $cmd_dir_prefix = eval {
1931
command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
@@ -75,24 +87,13 @@ sub _req_svn {
7587
use File::Find;
7688
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
7789
use IPC::Open3;
78-
use Git;
7990
use Git::SVN::Editor qw//;
8091
use Git::SVN::Fetcher qw//;
8192
use Git::SVN::Ra qw//;
8293
use Git::SVN::Prompt qw//;
8394
use Memoize; # core since 5.8.0, Jul 2002
8495

8596
BEGIN {
86-
# import functions from Git into our packages, en masse
87-
no strict 'refs';
88-
foreach (qw/command command_oneline command_noisy command_output_pipe
89-
command_input_pipe command_close_pipe
90-
command_bidi_pipe command_close_bidi_pipe/) {
91-
for my $package ( qw(Git::SVN::Migration),
92-
__PACKAGE__) {
93-
*{"${package}::$_"} = \&{"Git::$_"};
94-
}
95-
}
9697
Memoize::memoize 'Git::config';
9798
Memoize::memoize 'Git::config_bool';
9899
}
@@ -2079,7 +2080,14 @@ package Git::SVN::Migration;
20792080
use Carp qw/croak/;
20802081
use File::Path qw/mkpath/;
20812082
use File::Basename qw/dirname basename/;
2082-
use vars qw/$_minimize/;
2083+
2084+
our $_minimize;
2085+
use Git qw(
2086+
command
2087+
command_noisy
2088+
command_output_pipe
2089+
command_close_pipe
2090+
);
20832091

20842092
sub migrate_from_v0 {
20852093
my $git_dir = $ENV{GIT_DIR};
@@ -2188,6 +2196,7 @@ sub migrate_from_v2 {
21882196
read_old_urls(\%l_map, '', "$ENV{GIT_DIR}/svn");
21892197
my $migrated = 0;
21902198

2199+
require Git::SVN;
21912200
foreach my $ref_id (sort keys %l_map) {
21922201
eval { Git::SVN->init($l_map{$ref_id}, '', undef, $ref_id) };
21932202
if ($@) {
@@ -2199,6 +2208,9 @@ sub migrate_from_v2 {
21992208
}
22002209

22012210
sub minimize_connections {
2211+
require Git::SVN;
2212+
require Git::SVN::Ra;
2213+
22022214
my $r = Git::SVN::read_all_remotes();
22032215
my $new_urls = {};
22042216
my $root_repos = {};

0 commit comments

Comments
 (0)