login
Header Space

 
 

Re: git-svn help for authorsfile

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Dongsheng Song <dongsheng.song@...>
Cc: <git@...>
Date: Thursday, October 18, 2007 - 6:53 pm

Dongsheng Song wrote:

Dongsheng,

If you come up with a patch that allows this, then I'm sure it can be
considered; below is what I imagine it would minimally require.  However,
I haven't tested this at all so please treat with caution.

Subject: [PATCH] git-svn: allow per-remote authors map

Allow the authors map to be overridden on a per-remote basis.
---
 git-svn.perl |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index c015ea8..47f524d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -5,7 +5,7 @@ use warnings;
 use strict;
 use vars qw/	$AUTHOR $VERSION
 		$sha1 $sha1_short $_revision
-		$_q $_authors %users/;
+		$_q %users/;
 $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
 $VERSION = '@@GIT_VERSION@@';
 
@@ -65,7 +65,7 @@ my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
                     'config-dir=s' => \$Git::SVN::Ra::config_dir,
                     'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache );
 my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
-		'authors-file|A=s' => \$_authors,
+		'authors-file|A=s' => \$Git::SVN::_authors,
 		'repack:i' => \$Git::SVN::_repack,
 		'noMetadata' => \$Git::SVN::_no_metadata,
 		'useSvmProps' => \$Git::SVN::_use_svm_props,
@@ -142,7 +142,7 @@ my %cmd = (
 			  'oneline' => \$Git::SVN::Log::oneline,
 			  'show-commit' => \$Git::SVN::Log::show_commit,
 			  'non-recursive' => \$Git::SVN::Log::non_recursive,
-			  'authors-file|A=s' => \$_authors,
+			  'authors-file|A=s' => \$Git::SVN::authors,
 			  'color' => \$Git::SVN::Log::color,
 			  'pager=s' => \$Git::SVN::Log::pager,
 			} ],
@@ -187,7 +187,6 @@ exit 1 if (!$rv && $cmd && $cmd ne 'log');
 usage(0) if $_help;
 version() if $_version;
 usage(1) unless defined $cmd;
-load_authors() if $_authors;
 
 # make sure we're always running
 unless ($cmd =~ /(?:clone|init|multi-init)$/) {
@@ -748,6 +747,7 @@ sub file_to_s {
 
 # '<svn username> = real-name <email address>' mapping based on git-svnimport:
 sub load_authors {
+	my $_authors = shift;
 	open my $authors, '<', $_authors or die "Can't open $_authors $!\n";
 	my $log = $cmd eq 'log';
 	while (<$authors>) {
@@ -891,7 +891,7 @@ package Git::SVN;
 use strict;
 use warnings;
 use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
-            $_repack $_repack_flags $_use_svm_props $_head
+            $_repack $_repack_flags $_use_svm_props $_head $_authors
             $_use_svnsync_props $no_reuse_existing $_minimize_url/;
 use Carp qw/croak/;
 use File::Path qw/mkpath/;
@@ -993,6 +993,8 @@ sub fetch_all {
 	$remotes ||= read_all_remotes();
 	my $remote = $remotes->{$repo_id} or
 	             die "[svn-remote \"$repo_id\"] unknown\n";
+	my $authors = $remote->{authors} || $_authors;
+	load_authors($authors) if $authors;
 	my $fetch = $remote->{fetch};
 	my $url = $remote->{url} or die "svn-remote.$repo_id.url not defined\n";
 	my (@gs, @globs);
@@ -1050,6 +1052,8 @@ sub read_all_remotes {
 				die "The '*' glob character must be the last ",
 				    "character of '$g'\n";
 			}
+		} elsif (m!^(.+)\.authors=\s*(.*)\s*$!) {
+			$r->{$1}->{authors} = $2;
 		}
 	}
 	$r;
-- 
1.5.3.2.3.g2f2dcc-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-svn help for authorsfile, Dongsheng Song, (Thu Oct 18, 2:26 am)
Re: git-svn help for authorsfile, Sam Vilain, (Thu Oct 18, 6:53 pm)
speck-geostationary