Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Prepare Git::SVN::Migration for extraction from git-svn.
author
Michael G. Schwern
<schwern@pobox.com>
Fri, 27 Jul 2012 00:26:02 +0000
(17:26 -0700)
committer
Eric Wong
<normalperson@yhbt.net>
Fri, 27 Jul 2012 22:36:12 +0000
(22:36 +0000)
* 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>
git-svn.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b74fda1
)
diff --git
a/git-svn.perl
b/git-svn.perl
index 15e5f3c0feda0dc362322662b8e1f042c6afa4f6..0266878120c452cac405c3b269797d172733ee6b 100755
(executable)
--- a/
git-svn.perl
+++ b/
git-svn.perl
@@
-14,6
+14,18
@@
use Git::SVN::Log;
use Git::SVN::Utils qw(fatal can_compress);
use Git::SVN::Log;
use Git::SVN::Utils qw(fatal can_compress);
+use Git qw(
+ git_cmd_try
+ command
+ command_oneline
+ command_noisy
+ command_output_pipe
+ command_close_pipe
+ command_bidi_pipe
+ command_close_bidi_pipe
+);
+
+
# From which subdir have we been invoked?
my $cmd_dir_prefix = eval {
command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
# From which subdir have we been invoked?
my $cmd_dir_prefix = eval {
command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
@@
-75,7
+87,6
@@
sub _req_svn {
use File::Find;
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
use IPC::Open3;
use File::Find;
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
use IPC::Open3;
-use Git;
use Git::SVN::Editor qw//;
use Git::SVN::Fetcher qw//;
use Git::SVN::Ra qw//;
use Git::SVN::Editor qw//;
use Git::SVN::Fetcher qw//;
use Git::SVN::Ra qw//;
@@
-83,16
+94,6
@@
sub _req_svn {
use Memoize; # core since 5.8.0, Jul 2002
BEGIN {
use Memoize; # core since 5.8.0, Jul 2002
BEGIN {
- # import functions from Git into our packages, en masse
- no strict 'refs';
- foreach (qw/command command_oneline command_noisy command_output_pipe
- command_input_pipe command_close_pipe
- command_bidi_pipe command_close_bidi_pipe/) {
- for my $package ( qw(Git::SVN::Migration),
- __PACKAGE__) {
- *{"${package}::$_"} = \&{"Git::$_"};
- }
- }
Memoize::memoize 'Git::config';
Memoize::memoize 'Git::config_bool';
}
Memoize::memoize 'Git::config';
Memoize::memoize 'Git::config_bool';
}
@@
-2079,7
+2080,14
@@
package Git::SVN::Migration;
use Carp qw/croak/;
use File::Path qw/mkpath/;
use File::Basename qw/dirname basename/;
use Carp qw/croak/;
use File::Path qw/mkpath/;
use File::Basename qw/dirname basename/;
-use vars qw/$_minimize/;
+
+our $_minimize;
+use Git qw(
+ command
+ command_noisy
+ command_output_pipe
+ command_close_pipe
+);
sub migrate_from_v0 {
my $git_dir = $ENV{GIT_DIR};
sub migrate_from_v0 {
my $git_dir = $ENV{GIT_DIR};
@@
-2188,6
+2196,7
@@
sub migrate_from_v2 {
read_old_urls(\%l_map, '', "$ENV{GIT_DIR}/svn");
my $migrated = 0;
read_old_urls(\%l_map, '', "$ENV{GIT_DIR}/svn");
my $migrated = 0;
+ require Git::SVN;
foreach my $ref_id (sort keys %l_map) {
eval { Git::SVN->init($l_map{$ref_id}, '', undef, $ref_id) };
if ($@) {
foreach my $ref_id (sort keys %l_map) {
eval { Git::SVN->init($l_map{$ref_id}, '', undef, $ref_id) };
if ($@) {
@@
-2199,6
+2208,9
@@
sub migrate_from_v2 {
}
sub minimize_connections {
}
sub minimize_connections {
+ require Git::SVN;
+ require Git::SVN::Ra;
+
my $r = Git::SVN::read_all_remotes();
my $new_urls = {};
my $root_repos = {};
my $r = Git::SVN::read_all_remotes();
my $new_urls = {};
my $root_repos = {};