Skip to content

Commit 12a296b

Browse files
asedenoEric Wong
authored andcommitted
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 <[email protected]> Reviewed-by: James Y Knight <[email protected]> Acked-by: Eric Wong <[email protected]>
1 parent c3f6163 commit 12a296b

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

Documentation/git-svn.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::
648648
where the original UUID is not available via either useSvmProps
649649
or useSvnsyncProps.
650650

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+
651661
svn.brokenSymlinkWorkaround::
652662
This disables potentially expensive checks to workaround
653663
broken symlinks checked into SVN by broken clients. Set this

git-svn.perl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ sub cmd_dcommit {
528528
$url = eval { command_oneline('config', '--get',
529529
"svn-remote.$gs->{repo_id}.commiturl") };
530530
if (!$url) {
531-
$url = $gs->full_url
531+
$url = $gs->full_pushurl
532532
}
533533
}
534534

@@ -676,7 +676,7 @@ sub cmd_branch {
676676
$head ||= 'HEAD';
677677

678678
my (undef, $rev, undef, $gs) = working_head_info($head);
679-
my $src = $gs->full_url;
679+
my $src = $gs->full_pushurl;
680680

681681
my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
682682
my $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };
@@ -727,7 +727,7 @@ sub cmd_branch {
727727
$url = eval { command_oneline('config', '--get',
728728
"svn-remote.$gs->{repo_id}.commiturl") };
729729
if (!$url) {
730-
$url = $remote->{url};
730+
$url = $remote->{pushurl} || $remote->{url};
731731
}
732732
}
733733
my $dst = join '/', $url, $lft, $branch_name, ($rgt || ());
@@ -1831,6 +1831,8 @@ sub read_all_remotes {
18311831
$r->{$1}->{svm} = {};
18321832
} elsif (m!^(.+)\.url=\s*(.*)\s*$!) {
18331833
$r->{$1}->{url} = $2;
1834+
} elsif (m!^(.+)\.pushurl=\s*(.*)\s*$!) {
1835+
$r->{$1}->{pushurl} = $2;
18341836
} elsif (m!^(.+)\.(branches|tags)=$svn_refspec$!) {
18351837
my ($remote, $t, $local_ref, $remote_ref) =
18361838
($1, $2, $3, $4);
@@ -2068,6 +2070,8 @@ sub new {
20682070
$self->{url} = command_oneline('config', '--get',
20692071
"svn-remote.$repo_id.url") or
20702072
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") };
20712075
$self->rebuild;
20722076
$self;
20732077
}
@@ -2545,6 +2549,15 @@ sub full_url {
25452549
$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
25462550
}
25472551

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+
}
25482561

25492562
sub set_commit_header_env {
25502563
my ($log_entry) = @_;

0 commit comments

Comments
 (0)