git-svn: Add a svn-remote.<name>.pushurl config key
Similar to the 'remote.<name>.pushurl' config key for git remotes, 'pushurl' is designed to be used in cases where 'url' points to an SVN repository via a read-only transport, to provide an alternate read/write transport. It is assumed that both keys point to the same repository. The 'pushurl' key is distinct from the 'commiturl' key in that 'commiturl' is a full svn path while 'pushurl' (like 'url') is a base path. 'commiturl' takes precendece over 'pushurl' in cases where either might be used. The 'pushurl' is used by git-svn's dcommit and branch commands. Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu> Reviewed-by: James Y Knight <jknight@itasoftware.com> Acked-by: Eric Wong <normalperson@yhbt.net>
Alejandro R. Sedeño committed
Apr 8, 2011 at 10:57 UTC
12a296bca3d07875d4c3db0e8e24fbaa86ca97b3
2 files changed
+26
-3
Documentation/git-svn.txt
+10
@@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::
648
where the original UUID is not available via either useSvmProps
649
or useSvnsyncProps.
650
651
+svn-remote.<name>.pushurl::
652
+
653
+ Similar to git's 'remote.<name>.pushurl', this key is designed
654
+ to be used in cases where 'url' points to an SVN repository
655
+ via a read-only transport, to provide an alternate read/write
656
+ transport. It is assumed that both keys point to the same
657
+ repository. Unlike 'commiturl', 'pushurl' is a base path. If
658
+ either 'commiturl' or 'pushurl' could be used, 'commiturl'
659
+ takes precedence.
660
+
661
svn.brokenSymlinkWorkaround::
662
This disables potentially expensive checks to workaround
663
broken symlinks checked into SVN by broken clients. Set this
git-svn.perl
+16
-3
@@ -528,7 +528,7 @@ sub cmd_dcommit {
528
$url = eval { command_oneline('config', '--get',
529
"svn-remote.$gs->{repo_id}.commiturl") };
530
if (!$url) {
531
- $url = $gs->full_url
531
+ $url = $gs->full_pushurl
532
}
533
}
534
@@ -676,7 +676,7 @@ sub cmd_branch {
676
$head ||= 'HEAD';
677
678
my (undef, $rev, undef, $gs) = working_head_info($head);
679
- my $src = $gs->full_url;
679
+ my $src = $gs->full_pushurl;
680
681
my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
682
my $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };
@@ -727,7 +727,7 @@ sub cmd_branch {
727
$url = eval { command_oneline('config', '--get',
728
"svn-remote.$gs->{repo_id}.commiturl") };
729
if (!$url) {
730
- $url = $remote->{url};
730
+ $url = $remote->{pushurl} || $remote->{url};
731
}
732
}
733
my $dst = join '/', $url, $lft, $branch_name, ($rgt || ());
@@ -1831,6 +1831,8 @@ sub read_all_remotes {
1831
$r->{$1}->{svm} = {};
1832
} elsif (m!^(.+)\.url=\s*(.*)\s*$!) {
1833
$r->{$1}->{url} = $2;
1834
+ } elsif (m!^(.+)\.pushurl=\s*(.*)\s*$!) {
1835
+ $r->{$1}->{pushurl} = $2;
1836
} elsif (m!^(.+)\.(branches|tags)=$svn_refspec$!) {
1837
my ($remote, $t, $local_ref, $remote_ref) =
1838
($1, $2, $3, $4);
@@ -2068,6 +2070,8 @@ sub new {
2070
$self->{url} = command_oneline('config', '--get',
2071
"svn-remote.$repo_id.url") or
2072
die "Failed to read \"svn-remote.$repo_id.url\" in config\n";
2073
+ $self->{pushurl} = eval { command_oneline('config', '--get',
2074
+ "svn-remote.$repo_id.pushurl") };
2075
$self->rebuild;
2076
$self;
2077
}
@@ -2545,6 +2549,15 @@ sub full_url {
2549
$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
2550
}
2551
2552
+sub full_pushurl {
2553
+ my ($self) = @_;
2554
+ if ($self->{pushurl}) {
2555
+ return $self->{pushurl} . (length $self->{path} ? '/' .
2556
+ $self->{path} : '');
2557
+ } else {
2558
+ return $self->full_url;
2559
+ }
2560
+}
2561
2562
sub set_commit_header_env {
2563
my ($log_entry) = @_;