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 <normalperson@yhbt.net>
Michael G. Schwern committed
Jul 26, 2012 at 17:26 UTC
b0e75250c8c1fc40ba9d42c31ae99146f1cdeb71
1 file changed
+24
-12
git-svn.perl
+24
-12
@@ -14,6 +14,18 @@ use Git::SVN;
14
use Git::SVN::Log;
15
use Git::SVN::Utils qw(fatal can_compress);
16
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
+
29
# From which subdir have we been invoked?
30
my $cmd_dir_prefix = eval {
31
command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
@@ -75,7 +87,6 @@ use File::Spec;
87
use File::Find;
88
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
89
use IPC::Open3;
78
-use Git;
90
use Git::SVN::Editor qw//;
91
use Git::SVN::Fetcher qw//;
92
use Git::SVN::Ra qw//;
@@ -83,16 +94,6 @@ use Git::SVN::Prompt qw//;
94
use Memoize; # core since 5.8.0, Jul 2002
95
96
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
- }
97
Memoize::memoize 'Git::config';
98
Memoize::memoize 'Git::config_bool';
99
}
@@ -2079,7 +2080,14 @@ use warnings;
2080
use Carp qw/croak/;
2081
use File::Path qw/mkpath/;
2082
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
+);
2091
2092
sub migrate_from_v0 {
2093
my $git_dir = $ENV{GIT_DIR};
@@ -2188,6 +2196,7 @@ sub migrate_from_v2 {
2196
read_old_urls(\%l_map, '', "$ENV{GIT_DIR}/svn");
2197
my $migrated = 0;
2198
2199
+ require Git::SVN;
2200
foreach my $ref_id (sort keys %l_map) {
2201
eval { Git::SVN->init($l_map{$ref_id}, '', undef, $ref_id) };
2202
if ($@) {
@@ -2199,6 +2208,9 @@ sub migrate_from_v2 {
2208
}
2209
2210
sub minimize_connections {
2211
+ require Git::SVN;
2212
+ require Git::SVN::Ra;
2213
+
2214
my $r = Git::SVN::read_all_remotes();
2215
my $new_urls = {};
2216
my $root_repos = {};