From: Michael G Schwern <schwern@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, robbat2@gentoo.org,
Eric Wong <normalperson@yhbt.net>,
Ben Walton <bwalton@artsci.utoronto.ca>
Subject: Extract Git classes from git-svn (6/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
Date: Tue, 17 Jul 2012 16:16:03 -0700 [thread overview]
Message-ID: <5005F233.1070905@pobox.com> (raw)
In-Reply-To: <20120717174446.GA14244@burratino>
>From cb1a73929da15e87fa3dcc41c4cfa9ca592081fa Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Thu, 12 Jul 2012 17:14:24 -0700
Subject: [PATCH 07/11] Fix Git::SVN::Migration after its move.
Also...
* eliminate the big "import all the Git command functions" loop, nothing needs it
any more
* only load Git::SVN::Migration if we need it
---
git-svn.perl | 28 +++++++++++++++-------------
perl/Git/SVN/Migration.pm | 16 +++++++++++++++-
perl/Makefile | 1 +
t/Git-SVN/00compile.t | 3 ++-
4 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index f2bf759..8b8607d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -11,7 +11,6 @@ $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
$VERSION = '@@GIT_VERSION@@';
use Git::SVN;
-use Git::SVN::Log;
use Git::SVN::Utils qw(fatal can_compress);
@@ -77,24 +76,26 @@ use File::Spec;
use File::Find;
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
use IPC::Open3;
-use Git;
+
+use Git qw(
+ git_cmd_try
+ command
+ command_oneline
+ command_noisy
+ command_output_pipe
+ command_close_pipe
+ command_bidi_pipe
+ command_close_bidi_pipe
+);
+
use Git::SVN::Editor qw//;
use Git::SVN::Fetcher qw//;
-use Git::SVN::Ra qw//;
+use Git::SVN::Log;
use Git::SVN::Prompt qw//;
+use Git::SVN::Ra qw//;
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';
}
@@ -365,6 +366,7 @@ if (defined $_authors_prog) {
}
unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
+ require Git::SVN::Migration;
Git::SVN::Migration::migration_check();
}
Git::SVN::init_vars();
diff --git a/perl/Git/SVN/Migration.pm b/perl/Git/SVN/Migration.pm
index 082a788..b17fe00 100644
--- a/perl/Git/SVN/Migration.pm
+++ b/perl/Git/SVN/Migration.pm
@@ -32,12 +32,22 @@ package Git::SVN::Migration;
# rebuilding the .rev_db. Rebuilding the rev_db is not
# possible if noMetadata or useSvmProps are set; but should
# be no problem for users that use the (sensible) defaults.
+
use strict;
use warnings;
+
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};
@@ -146,6 +156,7 @@ sub migrate_from_v2 {
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 ($@) {
@@ -157,6 +168,9 @@ sub migrate_from_v2 {
}
sub minimize_connections {
+ require Git::SVN;
+ require Git::SVN::Ra;
+
my $r = Git::SVN::read_all_remotes();
my $new_urls = {};
my $root_repos = {};
diff --git a/perl/Makefile b/perl/Makefile
index 2a4ca57..d6a0e84 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -31,6 +31,7 @@ modules += Git/SVN/Memoize/YAML
modules += Git/SVN/Fetcher
modules += Git/SVN/Editor
modules += Git/SVN/Log
+modules += Git/SVN/Migration
modules += Git/SVN/Prompt
modules += Git/SVN/Ra
modules += Git/SVN/Utils
diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t
index 37626f4..1307b65 100644
--- a/t/Git-SVN/00compile.t
+++ b/t/Git-SVN/00compile.t
@@ -3,9 +3,10 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 5;
require_ok 'Git::SVN';
require_ok 'Git::SVN::Utils';
require_ok 'Git::SVN::Ra';
require_ok 'Git::SVN::Log';
+require_ok 'Git::SVN::Migration';
--
1.7.11.1
next prev parent reply other threads:[~2012-07-17 23:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-17 0:53 Fix git-svn tests for SVN 1.7.5 Michael G Schwern
2012-07-17 17:44 ` Jonathan Nieder
2012-07-17 18:58 ` Michael G Schwern
2012-07-17 23:13 ` Extract Git classes from git-svn (4/10) (was Re: Fix git-svn tests for SVN 1.7.5.) Michael G Schwern
2012-07-17 23:14 ` Extract Git classes from git-svn (5/10) " Michael G Schwern
2012-07-17 23:05 ` Find .pm files automatically " Michael G Schwern
2012-07-18 0:01 ` Jonathan Nieder
2012-07-18 1:41 ` Michael G Schwern
2012-07-18 2:14 ` Jonathan Nieder
2012-07-17 23:12 ` Extract Git classes from git-svn (2/10) " Michael G Schwern
2012-07-18 0:08 ` Jonathan Nieder
2012-07-18 10:58 ` Eric Wong
2012-07-19 0:11 ` Michael G Schwern
2012-07-17 23:13 ` Extract Git classes from git-svn (3/10) " Michael G Schwern
2012-07-18 0:12 ` Jonathan Nieder
2012-07-17 23:16 ` Michael G Schwern [this message]
2012-07-17 23:16 ` Extract Git classes from git-svn (7/10) " Michael G Schwern
2012-07-17 23:17 ` Extract Git classes from git-svn (8/10) " Michael G Schwern
2012-07-17 23:17 ` Extract Git classes from git-svn (9/10) " Michael G Schwern
2012-07-17 23:17 ` Extract Git classes from git-svn (10/10) " Michael G Schwern
[not found] ` <5005F139.8050205@pobox.com>
2012-07-17 23:31 ` Extract Git classes from git-svn (1/10) " Jonathan Nieder
2012-07-18 5:49 ` Extract Git classes from git-svn (1/10) Junio C Hamano
2012-07-19 3:43 ` Thiago Farina
2012-07-24 22:38 ` Michael G Schwern
2012-07-24 23:25 ` Jonathan Nieder
2012-07-25 2:55 ` Eric Wong
2012-07-25 5:37 ` Michael G Schwern
2012-07-25 5:54 ` OT: mail-based interfaces and web-based interfaces (Re: Extract Git classes from git-svn (1/10)) Jonathan Nieder
2012-07-25 6:20 ` Michael G Schwern
2012-07-25 23:48 ` OT: mail-based interfaces and web-based interfaces (Re: Extract Eric Wong
2012-07-26 2:33 ` Michael G Schwern
2012-07-26 2:47 ` Jonathan Nieder
2012-07-26 3:10 ` Eric Wong
2012-07-21 0:27 ` Fix git-svn tests for SVN 1.7.5 Ben Walton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5005F233.1070905@pobox.com \
--to=schwern@pobox.com \
--cc=bwalton@artsci.utoronto.ca \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=normalperson@yhbt.net \
--cc=robbat2@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).