git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael G Schwern <schwern@pobox.com>
To: Michael G Schwern <schwern@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	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 (4/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
Date: Tue, 17 Jul 2012 16:13:51 -0700	[thread overview]
Message-ID: <5005F1AF.1050609@pobox.com> (raw)
In-Reply-To: <5005B5EE.3050704@pobox.com>

>From 8f70be0424a770c299b6a0c5bf99e4030e5e4d92 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Thu, 12 Jul 2012 16:58:53 -0700
Subject: [PATCH 05/11] Make Git::SVN::Log work.

Changes to Git::SVN::Log to make it compile....
* Change the $_git_format lexical only used by Git::SVN::Log into a
Git::SVN::Log global
* Have it load the Git command functions itself
---
 git-svn.perl          |  8 +++++---
 perl/Git/SVN/Log.pm   | 10 +++++++++-
 perl/Makefile         |  1 +
 t/Git-SVN/00compile.t |  4 +++-
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 5e6e3b5..7c8ca49 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -11,6 +11,8 @@ $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
 $VERSION = '@@GIT_VERSION@@';

 use Git::SVN;
+use Git::SVN::Log;
+
 use Git::SVN::Utils qw(fatal can_compress);

 # From which subdir have we been invoked?
@@ -88,7 +90,7 @@ BEGIN {
 	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 Git::SVN::Log),
+		for my $package ( qw(Git::SVN::Migration),
 			__PACKAGE__) {
 			*{"${package}::$_"} = \&{"Git::$_"};
 		}
@@ -107,7 +109,7 @@ my ($_stdin, $_help, $_edit,
 	$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
 	$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
 	$_prefix, $_no_checkout, $_url, $_verbose,
-	$_git_format, $_commit_url, $_tag, $_merge_info, $_interactive);
+	$_commit_url, $_tag, $_merge_info, $_interactive);

 # This is a refactoring artifact so Git::SVN can get at this variable.
 sub opt_prefix { return $_prefix || '' }
@@ -271,7 +273,7 @@ my %cmd = (
 		    { 'url' => \$_url, } ],
 	'blame' => [ \&Git::SVN::Log::cmd_blame,
 	            "Show what revision and author last modified each line of a file",
-		    { 'git-format' => \$_git_format } ],
+		    { 'git-format' => \$Git::SVN::Log::_git_format } ],
 	'reset' => [ \&cmd_reset,
 		     "Undo fetches back to the specified SVN revision",
 		     { 'revision|r=s' => \$_revision,
diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm
index bbec3b0..7f3cb87 100644
--- a/perl/Git/SVN/Log.pm
+++ b/perl/Git/SVN/Log.pm
@@ -1,12 +1,17 @@
 package Git::SVN::Log;
+
 use strict;
 use warnings;
+
+use Git qw(command command_oneline command_output_pipe command_close_pipe);
 use Git::SVN::Utils qw(fatal);
 use POSIX qw/strftime/;
 use constant commit_log_separator => ('-' x 72) . "\n";
 use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline
             %rusers $show_commit $incremental/;
-my $l_fmt;
+
+# Options set in git-svn
+our $_git_format;

 sub cmt_showable {
 	my ($c) = @_;
@@ -52,6 +57,7 @@ sub git_svn_log_cmd {
 	}

 	my ($url, $rev, $uuid, $gs) = ::working_head_info($head);
+	require Git::SVN;
 	$gs ||= Git::SVN->_new;
 	my @cmd = (qw/log --abbrev-commit --pretty=raw --default/,
 	           $gs->refname);
@@ -113,6 +119,7 @@ sub run_pager {

 sub format_svn_date {
 	my $t = shift || time;
+	require Git::SVN;
 	my $gmoff = Git::SVN::get_tz($t);
 	return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
 }
@@ -183,6 +190,7 @@ sub process_commit {
 	return 1;
 }

+my $l_fmt;
 sub show_commit {
 	my $c = shift;
 	if ($oneline) {
diff --git a/perl/Makefile b/perl/Makefile
index d0a0c5c..2a4ca57 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -30,6 +30,7 @@ modules += Git/SVN
 modules += Git/SVN/Memoize/YAML
 modules += Git/SVN/Fetcher
 modules += Git/SVN/Editor
+modules += Git/SVN/Log
 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 c32ee4b..37626f4 100644
--- a/t/Git-SVN/00compile.t
+++ b/t/Git-SVN/00compile.t
@@ -3,7 +3,9 @@
 use strict;
 use warnings;

-use Test::More tests => 2;
+use Test::More tests => 4;

 require_ok 'Git::SVN';
 require_ok 'Git::SVN::Utils';
+require_ok 'Git::SVN::Ra';
+require_ok 'Git::SVN::Log';
-- 
1.7.11.1

  reply	other threads:[~2012-07-17 23:13 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     ` Michael G Schwern [this message]
2012-07-17 23:14     ` Extract Git classes from git-svn (5/10) (was Re: Fix git-svn tests for SVN 1.7.5.) 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   ` Extract Git classes from git-svn (6/10) " Michael G Schwern
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=5005F1AF.1050609@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).