git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-25  6:01 Move Git::SVN into its own .pm file Michael G. Schwern
@ 2012-07-25  6:01 ` Michael G. Schwern
  0 siblings, 0 replies; 31+ messages in thread
From: Michael G. Schwern @ 2012-07-25  6:01 UTC (permalink / raw)
  To: git, gitster; +Cc: robbat2, bwalton, normalperson, Michael G. Schwern

From: "Michael G. Schwern" <schwern@pobox.com>

Also it can compile on its own now, yay!
---
 git-svn.perl          | 4 ----
 perl/Git/SVN.pm       | 9 +++++++--
 t/Git-SVN/00compile.t | 3 ++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 4c77f69..ef10f6f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -20,10 +20,7 @@ my $cmd_dir_prefix = eval {
 
 my $git_dir_user_set = 1 if defined $ENV{GIT_DIR};
 $ENV{GIT_DIR} ||= '.git';
-$Git::SVN::default_repo_id = 'svn';
-$Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn';
 $Git::SVN::Ra::_log_window_size = 100;
-$Git::SVN::_minimize_url = 'unset';
 
 if (! exists $ENV{SVN_SSH} && exists $ENV{GIT_SSH}) {
 	$ENV{SVN_SSH} = $ENV{GIT_SSH};
@@ -114,7 +111,6 @@ my ($_stdin, $_help, $_edit,
 # This is a refactoring artifact so Git::SVN can get at this git-svn switch.
 sub opt_prefix { return $_prefix || '' }
 
-$Git::SVN::_follow_parent = 1;
 $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
 $_q ||= 0;
 my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index c71c041..2e0d7f0 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -3,9 +3,9 @@ use strict;
 use warnings;
 use Fcntl qw/:DEFAULT :seek/;
 use constant rev_map_fmt => 'NH40';
-use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
+use vars qw/$_no_metadata
             $_repack $_repack_flags $_use_svm_props $_head
-            $_use_svnsync_props $no_reuse_existing $_minimize_url
+            $_use_svnsync_props $no_reuse_existing
 	    $_use_log_author $_add_author_from $_localtime/;
 use Carp qw/croak/;
 use File::Path qw/mkpath/;
@@ -30,6 +30,11 @@ BEGIN {
 	$can_use_yaml = eval { require Git::SVN::Memoize::YAML; 1};
 }
 
+our $_follow_parent  = 1;
+our $_minimize_url   = 'unset';
+our $default_repo_id = 'svn';
+our $default_ref_id  = $ENV{GIT_SVN_ID} || 'git-svn';
+
 my ($_gc_nr, $_gc_period);
 
 # properties that we do not log:
diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t
index a7aa85a..97475d9 100644
--- a/t/Git-SVN/00compile.t
+++ b/t/Git-SVN/00compile.t
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 require_ok 'Git::SVN::Utils';
+require_ok 'Git::SVN';
-- 
1.7.11.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Extract Git::SVN from git-svn, take 2.
@ 2012-07-26 23:22 Michael G. Schwern
  2012-07-26 23:22 ` [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN Michael G. Schwern
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Michael G. Schwern @ 2012-07-26 23:22 UTC (permalink / raw)
  To: git, gitster; +Cc: robbat2, bwalton, normalperson, jrnieder

Same as before, now with tab indentation in the new Perl tests.

As before, patch #3 is 132k and will be rejected by some of the lists.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.
  2012-07-26 23:22 Extract Git::SVN from git-svn, take 2 Michael G. Schwern
@ 2012-07-26 23:22 ` Michael G. Schwern
  2012-07-27  5:18   ` Junio C Hamano
  2012-07-26 23:22 ` [PATCH 2/4] Prepare Git::SVN for extraction into its own file Michael G. Schwern
  2012-07-26 23:22 ` [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN Michael G. Schwern
  2 siblings, 1 reply; 31+ messages in thread
From: Michael G. Schwern @ 2012-07-26 23:22 UTC (permalink / raw)
  To: git, gitster; +Cc: robbat2, bwalton, normalperson, jrnieder, Michael G. Schwern

From: "Michael G. Schwern" <schwern@pobox.com>

Put them in a new module called Git::SVN::Utils.  Yeah, not terribly
original and it will be a dumping ground.  But its better than having
them in the main git-svn program.  At least they can be documented
and tested.

* fatal() is used by many classes.
* Change the $can_compress lexical into a function.

This should be enough to extract Git::SVN.

Signed-off-by: Michael G. Schwern <schwern@pobox.com>
---
 git-svn.perl                   | 34 +++++++++++++-----------
 perl/Git/SVN/Utils.pm          | 59 ++++++++++++++++++++++++++++++++++++++++++
 perl/Makefile                  |  1 +
 t/Git-SVN/00compile.t          |  8 ++++++
 t/Git-SVN/Utils/can_compress.t | 11 ++++++++
 t/Git-SVN/Utils/fatal.t        | 34 ++++++++++++++++++++++++
 6 files changed, 132 insertions(+), 15 deletions(-)
 create mode 100644 perl/Git/SVN/Utils.pm
 create mode 100644 t/Git-SVN/00compile.t
 create mode 100644 t/Git-SVN/Utils/can_compress.t
 create mode 100644 t/Git-SVN/Utils/fatal.t

diff --git a/git-svn.perl b/git-svn.perl
index 0b074c4..79fe4a4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -10,6 +10,8 @@ use vars qw/	$AUTHOR $VERSION
 $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
 $VERSION = '@@GIT_VERSION@@';
 
+use Git::SVN::Utils qw(fatal can_compress);
+
 # From which subdir have we been invoked?
 my $cmd_dir_prefix = eval {
 	command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
@@ -35,8 +37,6 @@ $Git::SVN::Log::TZ = $ENV{TZ};
 $ENV{TZ} = 'UTC';
 $| = 1; # unbuffer STDOUT
 
-sub fatal (@) { print STDERR "@_\n"; exit 1 }
-
 # All SVN commands do it.  Otherwise we may die on SIGPIPE when the remote
 # repository decides to close the connection which we expect to be kept alive.
 $SIG{PIPE} = 'IGNORE';
@@ -66,7 +66,7 @@ sub _req_svn {
 		fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)";
 	}
 }
-my $can_compress = eval { require Compress::Zlib; 1};
+
 use Carp qw/croak/;
 use Digest::MD5;
 use IO::File qw//;
@@ -1578,7 +1578,7 @@ sub cmd_reset {
 }
 
 sub cmd_gc {
-	if (!$can_compress) {
+	if (!can_compress()) {
 		warn "Compress::Zlib could not be found; unhandled.log " .
 		     "files will not be compressed.\n";
 	}
@@ -2014,13 +2014,13 @@ sub md5sum {
 	} elsif (!$ref) {
 		$md5->add($arg) or croak $!;
 	} else {
-		::fatal "Can't provide MD5 hash for unknown ref type: '", $ref, "'";
+		fatal "Can't provide MD5 hash for unknown ref type: '", $ref, "'";
 	}
 	return $md5->hexdigest();
 }
 
 sub gc_directory {
-	if ($can_compress && -f $_ && basename($_) eq "unhandled.log") {
+	if (can_compress() && -f $_ && basename($_) eq "unhandled.log") {
 		my $out_filename = $_ . ".gz";
 		open my $in_fh, "<", $_ or die "Unable to open $_: $!\n";
 		binmode $in_fh;
@@ -2055,6 +2055,9 @@ use Time::Local;
 use Memoize;  # core since 5.8.0, Jul 2002
 use Memoize::Storable;
 use POSIX qw(:signal_h);
+
+use Git::SVN::Utils qw(fatal can_compress);
+
 my $can_use_yaml;
 BEGIN {
 	$can_use_yaml = eval { require Git::SVN::Memoize::YAML; 1};
@@ -2880,8 +2883,8 @@ sub assert_index_clean {
 		command_noisy('read-tree', $treeish);
 		$x = command_oneline('write-tree');
 		if ($y ne $x) {
-			::fatal "trees ($treeish) $y != $x\n",
-			        "Something is seriously wrong...";
+			fatal "trees ($treeish) $y != $x\n",
+			      "Something is seriously wrong...";
 		}
 	});
 }
@@ -3236,7 +3239,7 @@ sub mkemptydirs {
 	my %empty_dirs = ();
 	my $gz_file = "$self->{dir}/unhandled.log.gz";
 	if (-f $gz_file) {
-		if (!$can_compress) {
+		if (!can_compress()) {
 			warn "Compress::Zlib could not be found; ",
 			     "empty directories in $gz_file will not be read\n";
 		} else {
@@ -3919,7 +3922,7 @@ sub set_tree {
 	my ($self, $tree) = (shift, shift);
 	my $log_entry = ::get_commit_entry($tree);
 	unless ($self->{last_rev}) {
-		::fatal("Must have an existing revision to commit");
+		fatal("Must have an existing revision to commit");
 	}
 	my %ed_opts = ( r => $self->{last_rev},
 	                log => $log_entry->{log},
@@ -4348,6 +4351,7 @@ sub remove_username {
 package Git::SVN::Log;
 use strict;
 use warnings;
+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
@@ -4446,15 +4450,15 @@ sub config_pager {
 sub run_pager {
 	return unless defined $pager;
 	pipe my ($rfd, $wfd) or return;
-	defined(my $pid = fork) or ::fatal "Can't fork: $!";
+	defined(my $pid = fork) or fatal "Can't fork: $!";
 	if (!$pid) {
 		open STDOUT, '>&', $wfd or
-		                     ::fatal "Can't redirect to stdout: $!";
+		                     fatal "Can't redirect to stdout: $!";
 		return;
 	}
-	open STDIN, '<&', $rfd or ::fatal "Can't redirect stdin: $!";
+	open STDIN, '<&', $rfd or fatal "Can't redirect stdin: $!";
 	$ENV{LESS} ||= 'FRSX';
-	exec $pager or ::fatal "Can't run pager: $! ($pager)";
+	exec $pager or fatal "Can't run pager: $! ($pager)";
 }
 
 sub format_svn_date {
@@ -4603,7 +4607,7 @@ sub cmd_show_log {
 		} elsif ($::_revision =~ /^\d+$/) {
 			$r_min = $r_max = $::_revision;
 		} else {
-			::fatal "-r$::_revision is not supported, use ",
+			fatal "-r$::_revision is not supported, use ",
 				"standard 'git log' arguments instead";
 		}
 	}
diff --git a/perl/Git/SVN/Utils.pm b/perl/Git/SVN/Utils.pm
new file mode 100644
index 0000000..3d0bfa4
--- /dev/null
+++ b/perl/Git/SVN/Utils.pm
@@ -0,0 +1,59 @@
+package Git::SVN::Utils;
+
+use strict;
+use warnings;
+
+use base qw(Exporter);
+
+our @EXPORT_OK = qw(fatal can_compress);
+
+
+=head1 NAME
+
+Git::SVN::Utils - utility functions used across Git::SVN
+
+=head1 SYNOPSIS
+
+    use Git::SVN::Utils qw(functions to import);
+
+=head1 DESCRIPTION
+
+This module contains functions which are useful across many different
+parts of Git::SVN.  Mostly it's a place to put utility functions
+rather than duplicate the code or have classes grabbing at other
+classes.
+
+=head1 FUNCTIONS
+
+All functions can be imported only on request.
+
+=head3 fatal
+
+    fatal(@message);
+
+Display a message and exit with a fatal error code.
+
+=cut
+
+# Note: not certain why this is in use instead of die.  Probably because
+# the exit code of die is 255?  Doesn't appear to be used consistently.
+sub fatal (@) { print STDERR "@_\n"; exit 1 }
+
+
+=head3 can_compress
+
+    my $can_compress = can_compress;
+
+Returns true if Compress::Zlib is available, false otherwise.
+
+=cut
+
+my $can_compress;
+sub can_compress {
+    return $can_compress if defined $can_compress;
+
+    return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
+}
+
+
+1;
diff --git a/perl/Makefile b/perl/Makefile
index 6ca7d47..24a9f5a 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -31,6 +31,7 @@ modules += Git/SVN/Fetcher
 modules += Git/SVN/Editor
 modules += Git/SVN/Prompt
 modules += Git/SVN/Ra
+modules += Git/SVN/Utils
 
 $(makfile): ../GIT-CFLAGS Makefile
 	echo all: private-Error.pm Git.pm Git/I18N.pm > $@
diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t
new file mode 100644
index 0000000..a7aa85a
--- /dev/null
+++ b/t/Git-SVN/00compile.t
@@ -0,0 +1,8 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+require_ok 'Git::SVN::Utils';
diff --git a/t/Git-SVN/Utils/can_compress.t b/t/Git-SVN/Utils/can_compress.t
new file mode 100644
index 0000000..d7b49b8
--- /dev/null
+++ b/t/Git-SVN/Utils/can_compress.t
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+use Git::SVN::Utils qw(can_compress);
+
+# !! is the "convert this to boolean" operator.
+is !!can_compress(), !!eval { require Compress::Zlib };
diff --git a/t/Git-SVN/Utils/fatal.t b/t/Git-SVN/Utils/fatal.t
new file mode 100644
index 0000000..49e1438
--- /dev/null
+++ b/t/Git-SVN/Utils/fatal.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+BEGIN {
+	# Override exit at BEGIN time before Git::SVN::Utils is loaded
+	# so it will see our local exit later.
+	*CORE::GLOBAL::exit = sub(;$) {
+	return @_ ? CORE::exit($_[0]) : CORE::exit();
+	};
+}
+
+use Git::SVN::Utils qw(fatal);
+
+# fatal()
+{
+	# Capture the exit code and prevent exit.
+	my $exit_status;
+	no warnings 'redefine';
+	local *CORE::GLOBAL::exit = sub { $exit_status = $_[0] || 0 };
+
+	# Trap fatal's message to STDERR
+	my $stderr;
+	close STDERR;
+	ok open STDERR, ">", \$stderr;
+
+	fatal "Some", "Stuff", "Happened";
+
+	is $stderr, "Some Stuff Happened\n";
+	is $exit_status, 1;
+}
-- 
1.7.11.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 2/4] Prepare Git::SVN for extraction into its own file.
  2012-07-26 23:22 Extract Git::SVN from git-svn, take 2 Michael G. Schwern
  2012-07-26 23:22 ` [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN Michael G. Schwern
@ 2012-07-26 23:22 ` Michael G. Schwern
  2012-07-27  5:18   ` Junio C Hamano
  2012-07-26 23:22 ` [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN Michael G. Schwern
  2 siblings, 1 reply; 31+ messages in thread
From: Michael G. Schwern @ 2012-07-26 23:22 UTC (permalink / raw)
  To: git, gitster; +Cc: robbat2, bwalton, normalperson, jrnieder, Michael G. Schwern

From: "Michael G. Schwern" <schwern@pobox.com>

This means it should be able to load without git-svn being loaded.

* Load Git.pm on its own and all the needed command functions.

* It needs to grab at a git-svn lexical $_prefix representing the --prefix
  option.  Provide opt_prefix() for that.  This is a refactoring artifact.
  The prefix should really be passed into Git::SVN->new.

* Unqualify unnecessarily fully qualified globals like
  $Git::SVN::default_repo_id.

* Lexically isolate the class just to make sure nothing is leaking out.
---
 git-svn.perl | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 79fe4a4..9cdf6fc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -89,7 +89,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 Git::SVN),
+		for my $package ( qw(Git::SVN::Migration Git::SVN::Log),
 			__PACKAGE__) {
 			*{"${package}::$_"} = \&{"Git::$_"};
 		}
@@ -109,6 +109,10 @@ my ($_stdin, $_help, $_edit,
 	$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
 	$_prefix, $_no_checkout, $_url, $_verbose,
 	$_git_format, $_commit_url, $_tag, $_merge_info, $_interactive);
+
+# This is a refactoring artifact so Git::SVN can get at this git-svn switch.
+sub opt_prefix { return $_prefix || '' }
+
 $Git::SVN::_follow_parent = 1;
 $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
 $_q ||= 0;
@@ -2038,6 +2042,7 @@ sub gc_directory {
 	}
 }
 
+{
 package Git::SVN;
 use strict;
 use warnings;
@@ -2056,6 +2061,13 @@ use Memoize;  # core since 5.8.0, Jul 2002
 use Memoize::Storable;
 use POSIX qw(:signal_h);
 
+use Git qw(
+    command
+    command_oneline
+    command_noisy
+    command_output_pipe
+    command_close_pipe
+);
 use Git::SVN::Utils qw(fatal can_compress);
 
 my $can_use_yaml;
@@ -4280,12 +4292,13 @@ sub find_rev_after {
 sub _new {
 	my ($class, $repo_id, $ref_id, $path) = @_;
 	unless (defined $repo_id && length $repo_id) {
-		$repo_id = $Git::SVN::default_repo_id;
+		$repo_id = $default_repo_id;
 	}
 	unless (defined $ref_id && length $ref_id) {
-		$_prefix = '' unless defined($_prefix);
+		# Access the prefix option from the git-svn main program if it's loaded.
+		my $prefix = defined &::opt_prefix ? ::opt_prefix() : "";
 		$_[2] = $ref_id =
-		             "refs/remotes/$_prefix$Git::SVN::default_ref_id";
+		             "refs/remotes/$prefix$default_ref_id";
 	}
 	$_[1] = $repo_id;
 	my $dir = "$ENV{GIT_DIR}/svn/$ref_id";
@@ -4347,6 +4360,7 @@ sub uri_decode {
 sub remove_username {
 	$_[0] =~ s{^([^:]*://)[^@]+@}{$1};
 }
+}
 
 package Git::SVN::Log;
 use strict;
-- 
1.7.11.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-26 23:22 Extract Git::SVN from git-svn, take 2 Michael G. Schwern
  2012-07-26 23:22 ` [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN Michael G. Schwern
  2012-07-26 23:22 ` [PATCH 2/4] Prepare Git::SVN for extraction into its own file Michael G. Schwern
@ 2012-07-26 23:22 ` Michael G. Schwern
  2012-07-27  5:18   ` Junio C Hamano
  2 siblings, 1 reply; 31+ messages in thread
From: Michael G. Schwern @ 2012-07-26 23:22 UTC (permalink / raw)
  To: git, gitster; +Cc: robbat2, bwalton, normalperson, jrnieder, Michael G. Schwern

From: "Michael G. Schwern" <schwern@pobox.com>

Also it can compile on its own now, yay!
---
 git-svn.perl          | 4 ----
 perl/Git/SVN.pm       | 9 +++++++--
 t/Git-SVN/00compile.t | 3 ++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 4c77f69..ef10f6f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -20,10 +20,7 @@ my $cmd_dir_prefix = eval {
 
 my $git_dir_user_set = 1 if defined $ENV{GIT_DIR};
 $ENV{GIT_DIR} ||= '.git';
-$Git::SVN::default_repo_id = 'svn';
-$Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn';
 $Git::SVN::Ra::_log_window_size = 100;
-$Git::SVN::_minimize_url = 'unset';
 
 if (! exists $ENV{SVN_SSH} && exists $ENV{GIT_SSH}) {
 	$ENV{SVN_SSH} = $ENV{GIT_SSH};
@@ -114,7 +111,6 @@ my ($_stdin, $_help, $_edit,
 # This is a refactoring artifact so Git::SVN can get at this git-svn switch.
 sub opt_prefix { return $_prefix || '' }
 
-$Git::SVN::_follow_parent = 1;
 $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
 $_q ||= 0;
 my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index c71c041..2e0d7f0 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -3,9 +3,9 @@ use strict;
 use warnings;
 use Fcntl qw/:DEFAULT :seek/;
 use constant rev_map_fmt => 'NH40';
-use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
+use vars qw/$_no_metadata
             $_repack $_repack_flags $_use_svm_props $_head
-            $_use_svnsync_props $no_reuse_existing $_minimize_url
+            $_use_svnsync_props $no_reuse_existing
 	    $_use_log_author $_add_author_from $_localtime/;
 use Carp qw/croak/;
 use File::Path qw/mkpath/;
@@ -30,6 +30,11 @@ BEGIN {
 	$can_use_yaml = eval { require Git::SVN::Memoize::YAML; 1};
 }
 
+our $_follow_parent  = 1;
+our $_minimize_url   = 'unset';
+our $default_repo_id = 'svn';
+our $default_ref_id  = $ENV{GIT_SVN_ID} || 'git-svn';
+
 my ($_gc_nr, $_gc_period);
 
 # properties that we do not log:
diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t
index a7aa85a..97475d9 100644
--- a/t/Git-SVN/00compile.t
+++ b/t/Git-SVN/00compile.t
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 require_ok 'Git::SVN::Utils';
+require_ok 'Git::SVN';
-- 
1.7.11.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/4] Prepare Git::SVN for extraction into its own file.
  2012-07-26 23:22 ` [PATCH 2/4] Prepare Git::SVN for extraction into its own file Michael G. Schwern
@ 2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  5:23     ` Junio C Hamano
  2012-07-27  8:16     ` Michael G Schwern
  0 siblings, 2 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  5:18 UTC (permalink / raw)
  To: Michael G. Schwern; +Cc: git, robbat2, bwalton, normalperson, jrnieder

"Michael G. Schwern" <schwern@pobox.com> writes:

> From: "Michael G. Schwern" <schwern@pobox.com>
>
> This means it should be able to load without git-svn being loaded.
>
> * Load Git.pm on its own and all the needed command functions.
>
> * It needs to grab at a git-svn lexical $_prefix representing the --prefix
>   option.  Provide opt_prefix() for that.  This is a refactoring artifact.
>   The prefix should really be passed into Git::SVN->new.

I agree that the prefix is part of SVN->new arguments in the final
state after applying the whole series (not just these four but also
with the follow-up patches).

> * Unqualify unnecessarily fully qualified globals like
>   $Git::SVN::default_repo_id.
>
> * Lexically isolate the class just to make sure nothing is leaking out.
> ---

Forgot to sign-off, or are you still unsure about this step?

> diff --git a/git-svn.perl b/git-svn.perl
> index 79fe4a4..9cdf6fc 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -109,6 +109,10 @@ my ($_stdin, $_help, $_edit,
>  	$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
>  	$_prefix, $_no_checkout, $_url, $_verbose,
>  	$_git_format, $_commit_url, $_tag, $_merge_info, $_interactive);
> +
> +# This is a refactoring artifact so Git::SVN can get at this git-svn switch.
> +sub opt_prefix { return $_prefix || '' }
> +
>  $Git::SVN::_follow_parent = 1;
>  $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
>  $_q ||= 0;
> @@ -4280,12 +4292,13 @@ sub find_rev_after {
>  sub _new {
>  	my ($class, $repo_id, $ref_id, $path) = @_;
>  	unless (defined $repo_id && length $repo_id) {
> -		$repo_id = $Git::SVN::default_repo_id;
> +		$repo_id = $default_repo_id;
>  	}
>  	unless (defined $ref_id && length $ref_id) {
> -		$_prefix = '' unless defined($_prefix);
> +		# Access the prefix option from the git-svn main program if it's loaded.
> +		my $prefix = defined &::opt_prefix ? ::opt_prefix() : "";

Again, I agree with you that passing $prefix as one of the arguments
to ->new is the right thing to do in the final state after applying
the whole series.  I don't know if later steps in your patch series
will do so, but it _might_ make more sense to update ->new and its
callers to do so without doing anything else first, so that you do
not have to call out to the ::opt_prefix() when you split things
out.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.
  2012-07-26 23:22 ` [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN Michael G. Schwern
@ 2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  8:19     ` Michael G Schwern
  2012-07-27 11:34     ` Eric Wong
  0 siblings, 2 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  5:18 UTC (permalink / raw)
  To: Michael G. Schwern; +Cc: git, robbat2, bwalton, normalperson, jrnieder

"Michael G. Schwern" <schwern@pobox.com> writes:

> From: "Michael G. Schwern" <schwern@pobox.com>
>
> Put them in a new module called Git::SVN::Utils.  Yeah, not terribly
> original and it will be a dumping ground.  But its better than having
> them in the main git-svn program.  At least they can be documented
> and tested.
>
> * fatal() is used by many classes.
> * Change the $can_compress lexical into a function.
>
> This should be enough to extract Git::SVN.
>
> Signed-off-by: Michael G. Schwern <schwern@pobox.com>
> ---

Looks good.

> diff --git a/perl/Git/SVN/Utils.pm b/perl/Git/SVN/Utils.pm
> new file mode 100644
> index 0000000..3d0bfa4
> --- /dev/null
> +++ b/perl/Git/SVN/Utils.pm
> @@ -0,0 +1,59 @@
> ...
> +=head1 FUNCTIONS
> +
> +All functions can be imported only on request.
> +
> +=head3 fatal
> +
> +    fatal(@message);
> +
> +Display a message and exit with a fatal error code.
> +
> +=cut
> +
> +# Note: not certain why this is in use instead of die.  Probably because
> +# the exit code of die is 255?  Doesn't appear to be used consistently.
> +sub fatal (@) { print STDERR "@_\n"; exit 1 }

Very true.  Also I do not think the line-noise prototype buys us
anything (other than making the code look mysterious to non Perl
programmers); we are not emulating any Perl's builtin with this
function, and I do not see a reason why we want to force list
context to its arguments, either.  But removal of it is not part of
this step anyway, so I wouldn't complain.

> +=head3 can_compress
> +
> +    my $can_compress = can_compress;
> +
> +Returns true if Compress::Zlib is available, false otherwise.
> +
> +=cut
> +
> +my $can_compress;
> +sub can_compress {
> +    return $can_compress if defined $can_compress;
> +
> +    return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
> +}

The original said "eval { require Compress::Zlib; 1; }"; presumably,
when require does succeed, the value inside is the "1;" that has to
be at the end of Compress::Zlib, so the difference should not matter.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-26 23:22 ` [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN Michael G. Schwern
@ 2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  5:38     ` Jonathan Nieder
  2012-07-27  8:41     ` Michael G Schwern
  0 siblings, 2 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  5:18 UTC (permalink / raw)
  To: Michael G. Schwern; +Cc: git, robbat2, bwalton, normalperson, jrnieder

"Michael G. Schwern" <schwern@pobox.com> writes:

> From: "Michael G. Schwern" <schwern@pobox.com>
>
> Also it can compile on its own now, yay!

Hmmm.

If you swap the order of steps 3/4 and 4/4 by creating Git/SVN.pm
that only has these variable definitions (i.e. "our $X" and "use
vars $X") and make git-svn.perl use them from Git::SVN in the first
step, and then do the bulk-moving (equivalent of your 3/4) in the
second step, would it free you from having to say "it's doubtful it
will compile by itself"?

In short:

 - I didn't see anything questionable in 1/4;

 - Calling up ::opt_prefix() from module in 2/4 looked ugly to me
   but I suspect it should be easy to fix;

 - 3/4 was a straight move and I didn't see anything questionable in
   it, but I think it would be nicer if intermediate steps can be
   made to still work by making 4/4 come first or something
   similarly simple.

If the issues in 2/4 and 3/4 are easily fixable by going the route I
handwaved above, the result of doing so based on this round is ready
to be applied, I think.

Eric, Jonathan, what do you think?

> ---
>  git-svn.perl          | 4 ----
>  perl/Git/SVN.pm       | 9 +++++++--
>  t/Git-SVN/00compile.t | 3 ++-
>  3 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 4c77f69..ef10f6f 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -20,10 +20,7 @@ my $cmd_dir_prefix = eval {
>  
>  my $git_dir_user_set = 1 if defined $ENV{GIT_DIR};
>  $ENV{GIT_DIR} ||= '.git';
> -$Git::SVN::default_repo_id = 'svn';
> -$Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn';
>  $Git::SVN::Ra::_log_window_size = 100;
> -$Git::SVN::_minimize_url = 'unset';
>  
>  if (! exists $ENV{SVN_SSH} && exists $ENV{GIT_SSH}) {
>  	$ENV{SVN_SSH} = $ENV{GIT_SSH};
> @@ -114,7 +111,6 @@ my ($_stdin, $_help, $_edit,
>  # This is a refactoring artifact so Git::SVN can get at this git-svn switch.
>  sub opt_prefix { return $_prefix || '' }
>  
> -$Git::SVN::_follow_parent = 1;
>  $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
>  $_q ||= 0;
>  my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
> diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
> index c71c041..2e0d7f0 100644
> --- a/perl/Git/SVN.pm
> +++ b/perl/Git/SVN.pm
> @@ -3,9 +3,9 @@ use strict;
>  use warnings;
>  use Fcntl qw/:DEFAULT :seek/;
>  use constant rev_map_fmt => 'NH40';
> -use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
> +use vars qw/$_no_metadata
>              $_repack $_repack_flags $_use_svm_props $_head
> -            $_use_svnsync_props $no_reuse_existing $_minimize_url
> +            $_use_svnsync_props $no_reuse_existing
>  	    $_use_log_author $_add_author_from $_localtime/;
>  use Carp qw/croak/;
>  use File::Path qw/mkpath/;
> @@ -30,6 +30,11 @@ BEGIN {
>  	$can_use_yaml = eval { require Git::SVN::Memoize::YAML; 1};
>  }
>  
> +our $_follow_parent  = 1;
> +our $_minimize_url   = 'unset';
> +our $default_repo_id = 'svn';
> +our $default_ref_id  = $ENV{GIT_SVN_ID} || 'git-svn';
> +
>  my ($_gc_nr, $_gc_period);
>  
>  # properties that we do not log:
> diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t
> index a7aa85a..97475d9 100644
> --- a/t/Git-SVN/00compile.t
> +++ b/t/Git-SVN/00compile.t
> @@ -3,6 +3,7 @@
>  use strict;
>  use warnings;
>  
> -use Test::More tests => 1;
> +use Test::More tests => 2;
>  
>  require_ok 'Git::SVN::Utils';
> +require_ok 'Git::SVN';

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/4] Prepare Git::SVN for extraction into its own file.
  2012-07-27  5:18   ` Junio C Hamano
@ 2012-07-27  5:23     ` Junio C Hamano
  2012-07-27  8:16     ` Michael G Schwern
  1 sibling, 0 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  5:23 UTC (permalink / raw)
  To: Michael G. Schwern; +Cc: git, robbat2, bwalton, normalperson, jrnieder

Junio C Hamano <gitster@pobox.com> writes:

> "Michael G. Schwern" <schwern@pobox.com> writes:
>
>> From: "Michael G. Schwern" <schwern@pobox.com>
>>
>> This means it should be able to load without git-svn being loaded.
>>
>> * Load Git.pm on its own and all the needed command functions.
>>
>> * It needs to grab at a git-svn lexical $_prefix representing the --prefix
>>   option.  Provide opt_prefix() for that.  This is a refactoring artifact.
>>   The prefix should really be passed into Git::SVN->new.
>
> I agree that the prefix is part of SVN->new arguments in the final

s/is/should be/; sorry for the noise.

> state after applying the whole series (not just these four but also
> with the follow-up patches).
> ...
> Again, I agree with you that passing $prefix as one of the arguments
> to ->new is the right thing to do in the final state after applying
> the whole series.  I don't know if later steps in your patch series
> will do so, but it _might_ make more sense to update ->new and its
> callers to do so without doing anything else first, so that you do
> not have to call out to the ::opt_prefix() when you split things
> out.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  5:18   ` Junio C Hamano
@ 2012-07-27  5:38     ` Jonathan Nieder
  2012-07-27  6:07       ` Junio C Hamano
  2012-07-27  8:41     ` Michael G Schwern
  1 sibling, 1 reply; 31+ messages in thread
From: Jonathan Nieder @ 2012-07-27  5:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael G. Schwern, git, robbat2, bwalton, normalperson

Junio C Hamano wrote:
> "Michael G. Schwern" <schwern@pobox.com> writes:

>> Also it can compile on its own now, yay!
>
> Hmmm.

I agree with Michael's "yay" and also think it's fine that after
patch 3 it isn't there yet.

That's because git-svn.perl doesn't use Git::SVN on its own but helps
it out a little.  So even if we only applied patches 1-3, git-svn
would still work (maybe it's worth testing "perl -MGit::SVN" by hand
to avoid the "it's doubtful" about whether Git::SVN is self-contained
and replace it with a more certain statement?), and patch 4 just makes
it even better.

[...]
> In short:
>
>  - I didn't see anything questionable in 1/4;
>
>  - Calling up ::opt_prefix() from module in 2/4 looked ugly to me
>    but I suspect it should be easy to fix;
>
>  - 3/4 was a straight move and I didn't see anything questionable in
>    it, but I think it would be nicer if intermediate steps can be
>    made to still work by making 4/4 come first or something
>    similarly simple.
>
> If the issues in 2/4 and 3/4 are easily fixable by going the route I
> handwaved above, the result of doing so based on this round is ready
> to be applied, I think.
>
> Eric, Jonathan, what do you think?

I think this is pretty good already, though I also like your
suggestion re 2/4.

I haven't reviewed the tests these introduce and assume Eric has that
covered.

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  5:38     ` Jonathan Nieder
@ 2012-07-27  6:07       ` Junio C Hamano
  2012-07-27  6:46         ` Junio C Hamano
  2012-07-27 11:59         ` Eric Wong
  0 siblings, 2 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  6:07 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Michael G. Schwern, git, robbat2, bwalton, normalperson

Jonathan Nieder <jrnieder@gmail.com> writes:

>> In short:
>>
>>  - I didn't see anything questionable in 1/4;
>>
>>  - Calling up ::opt_prefix() from module in 2/4 looked ugly to me
>>    but I suspect it should be easy to fix;
>>
>>  - 3/4 was a straight move and I didn't see anything questionable in
>>    it, but I think it would be nicer if intermediate steps can be
>>    made to still work by making 4/4 come first or something
>>    similarly simple.
>>
>> If the issues in 2/4 and 3/4 are easily fixable by going the route I
>> handwaved above, the result of doing so based on this round is ready
>> to be applied, I think.
>>
>> Eric, Jonathan, what do you think?
>
> I think this is pretty good already, though I also like your
> suggestion re 2/4.
>
> I haven't reviewed the tests these introduce and assume Eric has that
> covered.

I didn't mean to say "Unless you prove that the two suggestions are
not easy to implement, I will veto the series until they are fixed."
Especially, I consider that the ordering between 3 and 4 falls into
the "it would be nicer if this wart weren't there" category.

The result will be queued tentatively near the tip of 'pu', but as
this is primarily about git-svn, I would prefer a copy that is
vetted by Eric to be fed from him.

Thanks.

P.S.

t91XX series seem to fail in 'pu' with "Can't locate Git/SVN.pm in
@INC" for me.  I see perl/blib/lib/Git/SVN/ directory and files
under it, but there is no perl/blib/lib/Git/SVN.pm installed.  I see
Git/I18N.pm and Git/SVN/Ra.pm (and friends) mentioned in
perl/perl.mak generated by MakeMaker, but Git/SVN.pm does not appear
anywhere.

I think it is some interaction with other topics, as the tip of
ms/git-svn-pm topic that parks this series does not exhibit the
symptom, but it is getting late for me already, so I won't dig into
this further.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  6:07       ` Junio C Hamano
@ 2012-07-27  6:46         ` Junio C Hamano
  2012-07-27  7:09           ` Junio C Hamano
  2012-07-27 11:59         ` Eric Wong
  1 sibling, 1 reply; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  6:46 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Michael G. Schwern, git, robbat2, bwalton, normalperson

Junio C Hamano <gitster@pobox.com> writes:

> t91XX series seem to fail in 'pu' with "Can't locate Git/SVN.pm in
> @INC" for me.  I see perl/blib/lib/Git/SVN/ directory and files
> under it, but there is no perl/blib/lib/Git/SVN.pm installed.  I see
> Git/I18N.pm and Git/SVN/Ra.pm (and friends) mentioned in
> perl/perl.mak generated by MakeMaker, but Git/SVN.pm does not appear
> anywhere.
>
> I think it is some interaction with other topics, as the tip of
> ms/git-svn-pm topic that parks this series does not exhibit the
> symptom, but it is getting late for me already, so I won't dig into
> this further.

Actually there is no difference between ms/git-svn-pm and pu in perl/
directory. I _think_ there is some dependency missing that makes
this sequence break:

	(in one repository)
	git checkout pu ;# older pu without ms/git-svn-pm
        make ; make test

	(in another repository that shares the refs)
	git checkout pu
        git merge ms/git-svn-pm

	(in the first repository)
        git reset --hard ;# update the working tree
        make ; make test

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  6:46         ` Junio C Hamano
@ 2012-07-27  7:09           ` Junio C Hamano
  2012-07-27 20:07             ` Eric Wong
  0 siblings, 1 reply; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27  7:09 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Michael G. Schwern, git, robbat2, bwalton, normalperson

Junio C Hamano <gitster@pobox.com> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> t91XX series seem to fail in 'pu' with "Can't locate Git/SVN.pm in
>> @INC" for me.  I see perl/blib/lib/Git/SVN/ directory and files
>> under it, but there is no perl/blib/lib/Git/SVN.pm installed.  I see
>> Git/I18N.pm and Git/SVN/Ra.pm (and friends) mentioned in
>> perl/perl.mak generated by MakeMaker, but Git/SVN.pm does not appear
>> anywhere.
>> 
>> I think it is some interaction with other topics, as the tip of
>> ms/git-svn-pm topic that parks this series does not exhibit the
>> symptom, but it is getting late for me already, so I won't dig into
>> this further.
>
> Actually there is no difference between ms/git-svn-pm and pu in perl/
> directory. I _think_ there is some dependency missing that makes
> this sequence break:
>
> 	(in one repository)
> 	git checkout pu ;# older pu without ms/git-svn-pm
>         make ; make test
>
> 	(in another repository that shares the refs)
> 	git checkout pu
>         git merge ms/git-svn-pm
>
> 	(in the first repository)
>         git reset --hard ;# update the working tree
>         make ; make test

What was happening was that originally, pu had ms/makefile-pl but
not ms/git-svn-pm.  Hence, perl/Git/SVN.pm did not exist.  I ran
"make" and it created perl/perl.mak that does not know about
Git/SVN.pm;

Then ms/git-svn-pm is merged to pu and now we have perl/Git/SVN.pm.
But there is nothing in ms/makefile-pl that says on what files
perl.mak depends on.

I think there needs to be a dependency in to recreate perl/perl.mak
when any of the *.pm files are changed, perhaps like this.

I am not sure why perl/perl.mak is built by the top-level Makefile,
instead of just using "$(MAKE) -C perl/", though...

 Makefile      | 7 +++++++
 perl/Makefile | 1 +
 2 files changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index b0b3493..e2a4ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -2090,6 +2090,13 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 ifndef NO_PERL
 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
 
+perl/perl.mak: perl/PM.stamp
+
+perl/PM.stamp: FORCE
+	$(QUIET_GEN)find perl -type f -name '*.pm' | sort >$@+ && \
+	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
+	$(RM) $@+
+
 perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
diff --git a/perl/Makefile b/perl/Makefile
index 6ca7d47..d6f8478 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -20,6 +20,7 @@ clean:
 	$(RM) ppport.h
 	$(RM) $(makfile)
 	$(RM) $(makfile).old
+	$(RM) PM.stamp
 
 ifdef NO_PERL_MAKEMAKER
 instdir_SQ = $(subst ','\'',$(prefix)/lib)

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/4] Prepare Git::SVN for extraction into its own file.
  2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  5:23     ` Junio C Hamano
@ 2012-07-27  8:16     ` Michael G Schwern
  2012-07-27 11:53       ` Eric Wong
  1 sibling, 1 reply; 31+ messages in thread
From: Michael G Schwern @ 2012-07-27  8:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, robbat2, bwalton, normalperson, jrnieder

On 2012.7.26 10:18 PM, Junio C Hamano wrote:
> Forgot to sign-off, or are you still unsure about this step?

I just never think to do it.  It's just a line in the commit message, right?
There's no crypto involved like tag -s.  Is it a blocker?  I guess I can write
a msg-filter if it's important.


> Again, I agree with you that passing $prefix as one of the arguments
> to ->new is the right thing to do in the final state after applying
> the whole series.  I don't know if later steps in your patch series
> will do so, but it _might_ make more sense to update ->new and its
> callers to do so without doing anything else first, so that you do
> not have to call out to the ::opt_prefix() when you split things
> out.

I don't personally plan on doing any more about it, no.  It isn't needed for
SVN 1.7, there's very little real code change (which you could see by looking
at my remote instead of waiting to be fed patches...) and its a very, very
minor problem in the grand scheme.

How git-svn structures its switches needs a ton of work, and there are far
deeper problems with Git::SVN.  For one, it's completely undocumented.  For
another, Git::SVN can't instantiate an object without git-svn being loaded and
so is very difficult to unit test.  I wouldn't want to change the constructor
interface until I could construct an object.

The first step toward that would be to change git-svn so it can be loaded as a
library using the standard "main() unless caller" trick.  Then Git::SVN unit
tests can require git-svn as a library without executing it and get some tests
written with a minimum of Git::SVN code change.

Step zero would be to allow Perl unit tests to either use or emulate the work
done in lib-git-svn.sh.  The major problem being how to communicate the
location of the trash directory, currently done by environment variables.  A
simple trick would be for the Perl tests to execute a shell wrapper that
outputs the relevant information.

None of which I plan to get into just now.


-- 
emacs -- THAT'S NO EDITOR... IT'S AN OPERATING SYSTEM!

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.
  2012-07-27  5:18   ` Junio C Hamano
@ 2012-07-27  8:19     ` Michael G Schwern
  2012-07-27 11:34     ` Eric Wong
  1 sibling, 0 replies; 31+ messages in thread
From: Michael G Schwern @ 2012-07-27  8:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, robbat2, bwalton, normalperson, jrnieder

On 2012.7.26 10:18 PM, Junio C Hamano wrote:
>> +# Note: not certain why this is in use instead of die.  Probably because
>> +# the exit code of die is 255?  Doesn't appear to be used consistently.
>> +sub fatal (@) { print STDERR "@_\n"; exit 1 }
> 
> Very true.  Also I do not think the line-noise prototype buys us
> anything (other than making the code look mysterious to non Perl
> programmers); we are not emulating any Perl's builtin with this
> function, and I do not see a reason why we want to force list
> context to its arguments, either.  But removal of it is not part of
> this step anyway, so I wouldn't complain.

The prototype does absolutely nothing since @ is the default prototype.  But
yes, I'm doing a very rote refactoring here.


>> +sub can_compress {
>> +    return $can_compress if defined $can_compress;
>> +
>> +    return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
>> +}
> 
> The original said "eval { require Compress::Zlib; 1; }"; presumably,
> when require does succeed, the value inside is the "1;" that has to
> be at the end of Compress::Zlib, so the difference should not matter.

Yes.  In other situations where you cannot guarantee that the statement in the
eval will return true it makes sense, but here it's redundant.


-- 
Being faith-based doesn't trump reality.
	-- Bruce Sterling

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  5:38     ` Jonathan Nieder
@ 2012-07-27  8:41     ` Michael G Schwern
  1 sibling, 0 replies; 31+ messages in thread
From: Michael G Schwern @ 2012-07-27  8:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, robbat2, bwalton, normalperson, jrnieder

On 2012.7.26 10:18 PM, Junio C Hamano wrote:
> If you swap the order of steps 3/4 and 4/4 by creating Git/SVN.pm
> that only has these variable definitions (i.e. "our $X" and "use
> vars $X") and make git-svn.perl use them from Git::SVN in the first
> step, and then do the bulk-moving (equivalent of your 3/4) in the
> second step, would it free you from having to say "it's doubtful it
> will compile by itself"?

If it wasn't clear, all tests pass with every patch using SVN 1.6.

"Compile on its own" wasn't entirely clear.  I meant that Git::SVN doesn't
depend on git-svn to set its defaults.  Git::SVN still depends on it for A LOT
of other things, and will likely remain that way for a long time, so it's
kinda splitting hairs to worry about it.

4/4 was done last to ensure the phase of git-svn when the Git::SVN globals are
initialized remains basically the same.  If they were moved into Git::SVN
before it was split out they'd be getting initialized *after* the git-svn
command has been executed.  I didn't want to expend the energy or risk the
bugs to get around that.


> In short:
> 
>  - I didn't see anything questionable in 1/4;
> 
>  - Calling up ::opt_prefix() from module in 2/4 looked ugly to me
>    but I suspect it should be easy to fix;

Originally I tried to refactor new().  It rapidly turned into a lot of work on
undocumented code with no unit tests for no use to the SVN 1.7 issue for one
variable.  This is a very cheap way to let far more important work move
forward and it has a very narrow effect.  It could be made a Git::SVN global
that git-svn grabs at, but that's not really any better.  I'd rather leave it be.


-- 
91. I am not authorized to initiate Jihad.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN.
  2012-07-27  5:18   ` Junio C Hamano
  2012-07-27  8:19     ` Michael G Schwern
@ 2012-07-27 11:34     ` Eric Wong
  1 sibling, 0 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 11:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael G. Schwern, git, robbat2, bwalton, jrnieder

Junio C Hamano <gitster@pobox.com> wrote:
> "Michael G. Schwern" <schwern@pobox.com> writes:
> > +# Note: not certain why this is in use instead of die.  Probably because
> > +# the exit code of die is 255?  Doesn't appear to be used consistently.

Yes, 255 caused problems for the test suite:

commit d25c26e771fdf771f264dc85be348719886d354f
Author: Eric Wong <normalperson@yhbt.net>
Date:   Fri Nov 24 22:38:18 2006 -0800

    git-svn: exit with status 1 for test failures
    
    Some versions of the SVN libraries cause die() to exit with 255,
    and 40cf043389ef4cdf3e56e7c4268d6f302e387fa0 tightened up
    test_expect_failure to reject return values >128.

> > +sub fatal (@) { print STDERR "@_\n"; exit 1 }
> 
> Very true.  Also I do not think the line-noise prototype buys us
> anything (other than making the code look mysterious to non Perl
> programmers); we are not emulating any Perl's builtin with this
> function, and I do not see a reason why we want to force list
> context to its arguments, either.  But removal of it is not part of
> this step anyway, so I wouldn't complain.

I think I just learned Perl prototypes around that time :x
We can certainly remove it later.

> > +my $can_compress;
> > +sub can_compress {
> > +    return $can_compress if defined $can_compress;
> > +
> > +    return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
> > +}
> 
> The original said "eval { require Compress::Zlib; 1; }"; presumably,
> when require does succeed, the value inside is the "1;" that has to
> be at the end of Compress::Zlib, so the difference should not matter.

I just squashed in the simplification and made the indentation
consistent with other .pm files:

	return $can_compress = eval { require Compress::Zlib; };

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/4] Prepare Git::SVN for extraction into its own file.
  2012-07-27  8:16     ` Michael G Schwern
@ 2012-07-27 11:53       ` Eric Wong
  0 siblings, 0 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 11:53 UTC (permalink / raw)
  To: Michael G Schwern; +Cc: Junio C Hamano, git, robbat2, bwalton, jrnieder

Michael G Schwern <schwern@pobox.com> wrote:
> On 2012.7.26 10:18 PM, Junio C Hamano wrote:
> > Again, I agree with you that passing $prefix as one of the arguments
> > to ->new is the right thing to do in the final state after applying
> > the whole series.  I don't know if later steps in your patch series
> > will do so, but it _might_ make more sense to update ->new and its
> > callers to do so without doing anything else first, so that you do
> > not have to call out to the ::opt_prefix() when you split things
> > out.
> 
> I don't personally plan on doing any more about it, no.  It isn't needed for
> SVN 1.7, there's very little real code change (which you could see by looking
> at my remote instead of waiting to be fed patches...) and its a very, very
> minor problem in the grand scheme.

I agree, its not worth it right now.

> The first step toward that would be to change git-svn so it can be loaded as a
> library using the standard "main() unless caller" trick.  Then Git::SVN unit
> tests can require git-svn as a library without executing it and get some tests
> written with a minimum of Git::SVN code change.

> None of which I plan to get into just now.

That's fine.  The modules were an afterthought and not intended at the
time for standalone use, so it'd take a bit of work.  I doubt the
modules will be useful elsewhere, but will make code easier to
maintain in the future.

I also value functional/integration tests far more than unit tests.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  6:07       ` Junio C Hamano
  2012-07-27  6:46         ` Junio C Hamano
@ 2012-07-27 11:59         ` Eric Wong
  1 sibling, 0 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 11:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Junio C Hamano <gitster@pobox.com> wrote:
> The result will be queued tentatively near the tip of 'pu', but as
> this is primarily about git-svn, I would prefer a copy that is
> vetted by Eric to be fed from him.

OK.  I've signed-off on the 7 patches you have in pu.  Will look at the
other series in a few hours.

The following changes since commit cdd159b2f56c9e69e37bbb8f5af301abd93e5407:

  Merge branch 'jc/test-lib-source-build-options-early' (2012-07-25 15:47:08 -0700)

are available in the git repository at:

  git://bogomips.org/git-svn master

for you to fetch changes up to 8d1ddbdc877cf1f430ea8e79bf800ce806875565:

  Move initialization of Git::SVN variables into Git::SVN. (2012-07-27 11:29:21 +0000)

----------------------------------------------------------------
Michael G. Schwern (7):
      Quiet warning if Makefile.PL is run with -w and no --localedir
      Don't lose Error.pm if $@ gets clobbered.
      The Makefile.PL will now find .pm files itself.
      Extract some utilities from git-svn to allow extracting Git::SVN.
      Prepare Git::SVN for extraction into its own file.
      Extract Git::SVN from git-svn into its own .pm file.
      Move initialization of Git::SVN variables into Git::SVN.

 git-svn.perl                   | 2340 +---------------------------------------
 perl/Git/SVN.pm                | 2324 +++++++++++++++++++++++++++++++++++++++
 perl/Git/SVN/Utils.pm          |   59 +
 perl/Makefile                  |    2 +
 perl/Makefile.PL               |   35 +-
 t/Git-SVN/00compile.t          |    9 +
 t/Git-SVN/Utils/can_compress.t |   11 +
 t/Git-SVN/Utils/fatal.t        |   34 +
 8 files changed, 2476 insertions(+), 2338 deletions(-)
 create mode 100644 perl/Git/SVN.pm
 create mode 100644 perl/Git/SVN/Utils.pm
 create mode 100644 t/Git-SVN/00compile.t
 create mode 100644 t/Git-SVN/Utils/can_compress.t
 create mode 100644 t/Git-SVN/Utils/fatal.t

> Thanks.
> 
> P.S.
> 
> t91XX series seem to fail in 'pu' with "Can't locate Git/SVN.pm in
> @INC" for me.  I see perl/blib/lib/Git/SVN/ directory and files
> under it, but there is no perl/blib/lib/Git/SVN.pm installed.  I see
> Git/I18N.pm and Git/SVN/Ra.pm (and friends) mentioned in
> perl/perl.mak generated by MakeMaker, but Git/SVN.pm does not appear
> anywhere.
> 
> I think it is some interaction with other topics, as the tip of
> ms/git-svn-pm topic that parks this series does not exhibit the
> symptom, but it is getting late for me already, so I won't dig into
> this further.

I think your proposed patch in the followup should work.  We should
probably squash that into this series avoid breaking bisect in the
future.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27  7:09           ` Junio C Hamano
@ 2012-07-27 20:07             ` Eric Wong
  2012-07-27 20:56               ` Michael G Schwern
  2012-07-27 21:49               ` Junio C Hamano
  0 siblings, 2 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 20:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Junio C Hamano <gitster@pobox.com> wrote:
> What was happening was that originally, pu had ms/makefile-pl but
> not ms/git-svn-pm.  Hence, perl/Git/SVN.pm did not exist.  I ran
> "make" and it created perl/perl.mak that does not know about
> Git/SVN.pm;
> 
> Then ms/git-svn-pm is merged to pu and now we have perl/Git/SVN.pm.
> But there is nothing in ms/makefile-pl that says on what files
> perl.mak depends on.
> 
> I think there needs to be a dependency in to recreate perl/perl.mak
> when any of the *.pm files are changed, perhaps like this.
> 
> I am not sure why perl/perl.mak is built by the top-level Makefile,
> instead of just using "$(MAKE) -C perl/", though...

I'm not sure why perl/perl.mak is built by the top-level Makefile,
either.

I'll put the following after ms/makefile-pl but before ms/git-svn-pm:

>From a6ea2301d1bb6fd7c7415fed3aa7673542a563bd Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Fri, 27 Jul 2012 20:04:20 +0000
Subject: [PATCH] perl: detect new files in MakeMaker builds

While Makefile.PL now finds .pm files on its own, it does not
detect new files after it generates perl/perl.mak.

[ew: commit message]

ref: http://mid.gmane.org/7vlii51xz4.fsf@alter.siamese.dyndns.org

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 Makefile      | 7 +++++++
 perl/Makefile | 1 +
 2 files changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index b0b3493..e2a4ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -2090,6 +2090,13 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 ifndef NO_PERL
 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
 
+perl/perl.mak: perl/PM.stamp
+
+perl/PM.stamp: FORCE
+	$(QUIET_GEN)find perl -type f -name '*.pm' | sort >$@+ && \
+	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
+	$(RM) $@+
+
 perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
diff --git a/perl/Makefile b/perl/Makefile
index 8493d76..4969ef8 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -20,6 +20,7 @@ clean:
 	$(RM) ppport.h
 	$(RM) $(makfile)
 	$(RM) $(makfile).old
+	$(RM) PM.stamp
 
 ifdef NO_PERL_MAKEMAKER
 instdir_SQ = $(subst ','\'',$(prefix)/lib)
-- 
Eric Wong

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 20:07             ` Eric Wong
@ 2012-07-27 20:56               ` Michael G Schwern
  2012-07-27 20:59                 ` Eric Wong
  2012-07-27 21:31                 ` Junio C Hamano
  2012-07-27 21:49               ` Junio C Hamano
  1 sibling, 2 replies; 31+ messages in thread
From: Michael G Schwern @ 2012-07-27 20:56 UTC (permalink / raw)
  To: Eric Wong; +Cc: Junio C Hamano, Jonathan Nieder, git, robbat2, bwalton

On 2012.7.27 1:07 PM, Eric Wong wrote:
> While Makefile.PL now finds .pm files on its own, it does not
> detect new files after it generates perl/perl.mak.

Are you saying this doesn't work?

perl Makefile.PL
make -f perl.mak
touch Git/Foo.pm
perl Makefile.PL
make -f perl.mak

or this?

perl Makefile.PL
make -f perl.mak
touch Git/Foo.pm
make -f perl.mak

The former should work.  The latter is a MakeMaker limitation.  Makefile.PL
hard codes the list of .pm files into the Makefile.


-- 
Who invented the eponym?

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 20:56               ` Michael G Schwern
@ 2012-07-27 20:59                 ` Eric Wong
  2012-07-27 21:31                 ` Junio C Hamano
  1 sibling, 0 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 20:59 UTC (permalink / raw)
  To: Michael G Schwern; +Cc: Junio C Hamano, Jonathan Nieder, git, robbat2, bwalton

Michael G Schwern <schwern@pobox.com> wrote:
> On 2012.7.27 1:07 PM, Eric Wong wrote:
> > While Makefile.PL now finds .pm files on its own, it does not
> > detect new files after it generates perl/perl.mak.
> 
> Are you saying this doesn't work?
> 
> perl Makefile.PL
> make -f perl.mak
> touch Git/Foo.pm
> perl Makefile.PL
> make -f perl.mak

This works.

> or this?
> 
> perl Makefile.PL
> make -f perl.mak
> touch Git/Foo.pm
> make -f perl.mak
> 
> The former should work.  The latter is a MakeMaker limitation.  Makefile.PL
> hard codes the list of .pm files into the Makefile.

Yup, Junio's patch works around the MM limitation so the latter works.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 20:56               ` Michael G Schwern
  2012-07-27 20:59                 ` Eric Wong
@ 2012-07-27 21:31                 ` Junio C Hamano
  1 sibling, 0 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27 21:31 UTC (permalink / raw)
  To: Michael G Schwern; +Cc: Eric Wong, Jonathan Nieder, git, robbat2, bwalton

Michael G Schwern <schwern@pobox.com> writes:

> On 2012.7.27 1:07 PM, Eric Wong wrote:
>> While Makefile.PL now finds .pm files on its own, it does not
>> detect new files after it generates perl/perl.mak.
>
> Are you saying this doesn't work?
>
> perl Makefile.PL
> make -f perl.mak
> touch Git/Foo.pm
> perl Makefile.PL
> make -f perl.mak
>
> or this?
>
> perl Makefile.PL
> make -f perl.mak
> touch Git/Foo.pm
> make -f perl.mak

Neither of the above.  Nobody should be typing "perl Makefile.PL"
inside our source tree unless he is trying to debug our Makefiles
anyway.

What does not work is this sequence:

	make
        >perl/Git/Foo.pm
        make

Makefile at the top-level, which builds perl/perl.mak by running
"perl Makefile.PL" in perl/ subdirectory, doesn't have dependencies
[*1*], so in the above sequence, the second invocation of "make"
fails to rebuild perl/perl.mak, which causes Git/Foo.pm forgotten
from the build/installation step.

And that is what happened to Git/SVN.pm.


[Footnote]

*1* I also suspect perl/Makefile lacks this dependency even though
it has its own rule to build perl/perl.mak---don't they need to be
cleaned-up and merged???

	

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 20:07             ` Eric Wong
  2012-07-27 20:56               ` Michael G Schwern
@ 2012-07-27 21:49               ` Junio C Hamano
  2012-07-27 22:07                 ` Eric Wong
  1 sibling, 1 reply; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27 21:49 UTC (permalink / raw)
  To: Eric Wong; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Eric Wong <normalperson@yhbt.net> writes:

> I'll put the following after ms/makefile-pl but before ms/git-svn-pm:

OK, it seems that you haven't pushed out the result yet (which is
fine); how do we want to proceed?

I generally prefer pulling from maintainer trees directly to my
'master' without staging them in 'next', so when the above is done
and you feel the tip of your tree is good for 1.7.12-rc1 without
regression, please throw me a "pull, now!".

Thanks.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 21:49               ` Junio C Hamano
@ 2012-07-27 22:07                 ` Eric Wong
  2012-07-27 22:19                   ` Eric Wong
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Wong @ 2012-07-27 22:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Junio C Hamano <gitster@pobox.com> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > I'll put the following after ms/makefile-pl but before ms/git-svn-pm:
> 
> OK, it seems that you haven't pushed out the result yet (which is
> fine); how do we want to proceed?

Oops, got sidetracked into something else.  Before I got sidetracked,
my application of another patch in Michael's 3rd series failed
(even with your updated Makefile patch):

  [PATCH 7/8] Extract Git::SVN::GlobSpec from git-svn

GlobSpec.pm did not get picked up and placed into blib/ and some tests
(t9118-git-svn-funky-branch-names.sh) failed as a result

So I'll hold off until we can fix the build regressions (working on it
now)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:07                 ` Eric Wong
@ 2012-07-27 22:19                   ` Eric Wong
  2012-07-27 22:37                     ` Junio C Hamano
  2012-07-27 22:52                     ` Junio C Hamano
  0 siblings, 2 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 22:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Eric Wong <normalperson@yhbt.net> wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > Eric Wong <normalperson@yhbt.net> writes:
> > 
> > > I'll put the following after ms/makefile-pl but before ms/git-svn-pm:
> > 
> > OK, it seems that you haven't pushed out the result yet (which is
> > fine); how do we want to proceed?

> So I'll hold off until we can fix the build regressions (working on it
> now)

OK, all fixed, all I needed was this (squashed in):

--- a/perl/Makefile
+++ b/perl/Makefile
@@ -22,6 +22,8 @@ clean:
 	$(RM) $(makfile).old
 	$(RM) PM.stamp
 
+$(makfile): PM.stamp
+
 ifdef NO_PERL_MAKEMAKER
 instdir_SQ = $(subst ','\'',$(prefix)/lib)

-------------
The redundant dependencies are biting us :<  I agree there presence in
the top-level Makefile needs to be reviewed.

Anyways, you can pull this now from my master:

The following changes since commit cdd159b2f56c9e69e37bbb8f5af301abd93e5407:

  Merge branch 'jc/test-lib-source-build-options-early' (2012-07-25 15:47:08 -0700)

are available in the git repository at:

  git://bogomips.org/git-svn master

for you to fetch changes up to 5c71028fced46d03bf81b8625680d9ac87c8f4f0:

  Move initialization of Git::SVN variables into Git::SVN. (2012-07-27 22:14:54 +0000)

----------------------------------------------------------------
Junio C Hamano (1):
      perl: detect new files in MakeMaker builds

Michael G. Schwern (7):
      Quiet warning if Makefile.PL is run with -w and no --localedir
      Don't lose Error.pm if $@ gets clobbered.
      The Makefile.PL will now find .pm files itself.
      Extract some utilities from git-svn to allow extracting Git::SVN.
      Prepare Git::SVN for extraction into its own file.
      Extract Git::SVN from git-svn into its own .pm file.
      Move initialization of Git::SVN variables into Git::SVN.

 Makefile                       |    7 +
 git-svn.perl                   | 2340 +---------------------------------------
 perl/.gitignore                |    1 +
 perl/Git/SVN.pm                | 2324 +++++++++++++++++++++++++++++++++++++++
 perl/Git/SVN/Utils.pm          |   59 +
 perl/Makefile                  |    5 +
 perl/Makefile.PL               |   35 +-
 t/Git-SVN/00compile.t          |    9 +
 t/Git-SVN/Utils/can_compress.t |   11 +
 t/Git-SVN/Utils/fatal.t        |   34 +
 10 files changed, 2487 insertions(+), 2338 deletions(-)
 create mode 100644 perl/Git/SVN.pm
 create mode 100644 perl/Git/SVN/Utils.pm
 create mode 100644 t/Git-SVN/00compile.t
 create mode 100644 t/Git-SVN/Utils/can_compress.t
 create mode 100644 t/Git-SVN/Utils/fatal.t

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:19                   ` Eric Wong
@ 2012-07-27 22:37                     ` Junio C Hamano
  2012-07-27 22:45                       ` Eric Wong
  2012-07-27 22:52                     ` Junio C Hamano
  1 sibling, 1 reply; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27 22:37 UTC (permalink / raw)
  To: Eric Wong; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Eric Wong <normalperson@yhbt.net> writes:

> OK, all fixed, all I needed was this (squashed in):
>
> --- a/perl/Makefile
> +++ b/perl/Makefile
> @@ -22,6 +22,8 @@ clean:
>  	$(RM) $(makfile).old
>  	$(RM) PM.stamp
>  
> +$(makfile): PM.stamp
> +
>  ifdef NO_PERL_MAKEMAKER
>  instdir_SQ = $(subst ','\'',$(prefix)/lib)
>
> -------------
> The redundant dependencies are biting us :<  I agree there presence in
> the top-level Makefile needs to be reviewed.

Do you feel confident enough that we can leave that question hanging
around and still merge this before 1.7.12 safely?

I do not think it is a regression at the Makefile level per-se---we
didn't have right dependencies to keep perl.mak up to date, which
was the root cause of what we observed.

But the lack of dependencies did not matter before this series
because the list of *.pm files never changed, so in that sense the
series is what introduced the build regression, and I do not have a
solid feeling that we squashed it.

> Anyways, you can pull this now from my master:
>
> The following changes since commit cdd159b2f56c9e69e37bbb8f5af301abd93e5407:
>
>   Merge branch 'jc/test-lib-source-build-options-early' (2012-07-25 15:47:08 -0700)
>
> are available in the git repository at:
>
>   git://bogomips.org/git-svn master
>
> for you to fetch changes up to 5c71028fced46d03bf81b8625680d9ac87c8f4f0:
>
>   Move initialization of Git::SVN variables into Git::SVN. (2012-07-27 22:14:54 +0000)
>
> ----------------------------------------------------------------
> Junio C Hamano (1):
>       perl: detect new files in MakeMaker builds
>
> Michael G. Schwern (7):
>       Quiet warning if Makefile.PL is run with -w and no --localedir
>       Don't lose Error.pm if $@ gets clobbered.
>       The Makefile.PL will now find .pm files itself.
>       Extract some utilities from git-svn to allow extracting Git::SVN.
>       Prepare Git::SVN for extraction into its own file.
>       Extract Git::SVN from git-svn into its own .pm file.
>       Move initialization of Git::SVN variables into Git::SVN.
>
>  Makefile                       |    7 +
>  git-svn.perl                   | 2340 +---------------------------------------
>  perl/.gitignore                |    1 +
>  perl/Git/SVN.pm                | 2324 +++++++++++++++++++++++++++++++++++++++
>  perl/Git/SVN/Utils.pm          |   59 +
>  perl/Makefile                  |    5 +
>  perl/Makefile.PL               |   35 +-
>  t/Git-SVN/00compile.t          |    9 +
>  t/Git-SVN/Utils/can_compress.t |   11 +
>  t/Git-SVN/Utils/fatal.t        |   34 +
>  10 files changed, 2487 insertions(+), 2338 deletions(-)
>  create mode 100644 perl/Git/SVN.pm
>  create mode 100644 perl/Git/SVN/Utils.pm
>  create mode 100644 t/Git-SVN/00compile.t
>  create mode 100644 t/Git-SVN/Utils/can_compress.t
>  create mode 100644 t/Git-SVN/Utils/fatal.t

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:37                     ` Junio C Hamano
@ 2012-07-27 22:45                       ` Eric Wong
  2012-07-27 22:59                         ` Junio C Hamano
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Wong @ 2012-07-27 22:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Junio C Hamano <gitster@pobox.com> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> > The redundant dependencies are biting us :<  I agree there presence in
> > the top-level Makefile needs to be reviewed.
> 
> Do you feel confident enough that we can leave that question hanging
> around and still merge this before 1.7.12 safely?

Yes.

> I do not think it is a regression at the Makefile level per-se---we
> didn't have right dependencies to keep perl.mak up to date, which
> was the root cause of what we observed.
> 
> But the lack of dependencies did not matter before this series
> because the list of *.pm files never changed, so in that sense the
> series is what introduced the build regression, and I do not have a
> solid feeling that we squashed it.

Right, I agree the original dependencies are not good and it's not
a recent regression in the Makefile level.

I do feel our patch deals with the problem for now.  I've been going
between commits in Michael's 3rd series and haven't noticed new issues
when running the tests.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:19                   ` Eric Wong
  2012-07-27 22:37                     ` Junio C Hamano
@ 2012-07-27 22:52                     ` Junio C Hamano
  1 sibling, 0 replies; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27 22:52 UTC (permalink / raw)
  To: Eric Wong; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Eric Wong <normalperson@yhbt.net> writes:

> Eric Wong <normalperson@yhbt.net> wrote:
>> So I'll hold off until we can fix the build regressions (working on it
>> now)
>
> OK, all fixed, all I needed was this (squashed in):
>
> --- a/perl/Makefile
> +++ b/perl/Makefile
> @@ -22,6 +22,8 @@ clean:
>  	$(RM) $(makfile).old
>  	$(RM) PM.stamp
>  
> +$(makfile): PM.stamp
> +
>  ifdef NO_PERL_MAKEMAKER
>  instdir_SQ = $(subst ','\'',$(prefix)/lib)

Another thing I noticed but didn't say was that the top-level
Makefile seems to think without NO_PERL the way to regenerate
perl/perl.mak is to run perl/Makefile.PL, which is not true if the
build is done with NO_PERL_MAKEMAKER.

I do not offhand know why we even need to have dependency on
perl/perl.mak in the toplevel Makefile (other than "otherwise nobody
descends into perl/ and run make in it", which is a bogus
reason---there should be a rule to run "$(MAKE) -C perl/ $@" when
doing "make all" at the top-level if that is the case), but I think
at least the duplicated rule in the toplevel Makefile should read
something like:

	perl/perl.mak: ... (the dependencies) ...
		$(QUIET_SUBDIR0)perl ... (make variables) ... perl.mak

so that the real knowledge of how to rebuild it (with or without
NO_PERL_MAKEMAKER) should be in perl/Makefile.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:45                       ` Eric Wong
@ 2012-07-27 22:59                         ` Junio C Hamano
  2012-07-27 23:01                           ` Eric Wong
  0 siblings, 1 reply; 31+ messages in thread
From: Junio C Hamano @ 2012-07-27 22:59 UTC (permalink / raw)
  To: Eric Wong; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Eric Wong <normalperson@yhbt.net> writes:

> Junio C Hamano <gitster@pobox.com> wrote:
>> Eric Wong <normalperson@yhbt.net> writes:
>> > The redundant dependencies are biting us :<  I agree there presence in
>> > the top-level Makefile needs to be reviewed.
>> 
>> Do you feel confident enough that we can leave that question hanging
>> around and still merge this before 1.7.12 safely?
>
> Yes.
>
>> I do not think it is a regression at the Makefile level per-se---we
>> didn't have right dependencies to keep perl.mak up to date, which
>> was the root cause of what we observed.
>> 
>> But the lack of dependencies did not matter before this series
>> because the list of *.pm files never changed, so in that sense the
>> series is what introduced the build regression, and I do not have a
>> solid feeling that we squashed it.
>
> Right, I agree the original dependencies are not good and it's not
> a recent regression in the Makefile level.
>
> I do feel our patch deals with the problem for now.  I've been going
> between commits in Michael's 3rd series and haven't noticed new issues
> when running the tests.

Ok, please don't forget to add necessary .gitignore rule for the new
stamp file.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN.
  2012-07-27 22:59                         ` Junio C Hamano
@ 2012-07-27 23:01                           ` Eric Wong
  0 siblings, 0 replies; 31+ messages in thread
From: Eric Wong @ 2012-07-27 23:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Michael G. Schwern, git, robbat2, bwalton

Junio C Hamano <gitster@pobox.com> wrote:
> Ok, please don't forget to add necessary .gitignore rule for the new
> stamp file.

I noticed/remembered that, but I forgot to mention I squashed that in,
too :)

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2012-07-27 23:01 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 23:22 Extract Git::SVN from git-svn, take 2 Michael G. Schwern
2012-07-26 23:22 ` [PATCH 1/4] Extract some utilities from git-svn to allow extracting Git::SVN Michael G. Schwern
2012-07-27  5:18   ` Junio C Hamano
2012-07-27  8:19     ` Michael G Schwern
2012-07-27 11:34     ` Eric Wong
2012-07-26 23:22 ` [PATCH 2/4] Prepare Git::SVN for extraction into its own file Michael G. Schwern
2012-07-27  5:18   ` Junio C Hamano
2012-07-27  5:23     ` Junio C Hamano
2012-07-27  8:16     ` Michael G Schwern
2012-07-27 11:53       ` Eric Wong
2012-07-26 23:22 ` [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN Michael G. Schwern
2012-07-27  5:18   ` Junio C Hamano
2012-07-27  5:38     ` Jonathan Nieder
2012-07-27  6:07       ` Junio C Hamano
2012-07-27  6:46         ` Junio C Hamano
2012-07-27  7:09           ` Junio C Hamano
2012-07-27 20:07             ` Eric Wong
2012-07-27 20:56               ` Michael G Schwern
2012-07-27 20:59                 ` Eric Wong
2012-07-27 21:31                 ` Junio C Hamano
2012-07-27 21:49               ` Junio C Hamano
2012-07-27 22:07                 ` Eric Wong
2012-07-27 22:19                   ` Eric Wong
2012-07-27 22:37                     ` Junio C Hamano
2012-07-27 22:45                       ` Eric Wong
2012-07-27 22:59                         ` Junio C Hamano
2012-07-27 23:01                           ` Eric Wong
2012-07-27 22:52                     ` Junio C Hamano
2012-07-27 11:59         ` Eric Wong
2012-07-27  8:41     ` Michael G Schwern
  -- strict thread matches above, loose matches on Subject: below --
2012-07-25  6:01 Move Git::SVN into its own .pm file Michael G. Schwern
2012-07-25  6:01 ` [PATCH 4/4] Move initialization of Git::SVN variables into Git::SVN Michael G. Schwern

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).