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>
This commit is contained in:
parent
c3f6163b0b
commit
12a296bca3
@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::
|
||||
where the original UUID is not available via either useSvmProps
|
||||
or useSvnsyncProps.
|
||||
|
||||
svn-remote.<name>.pushurl::
|
||||
|
||||
Similar to git's 'remote.<name>.pushurl', this key 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. Unlike 'commiturl', 'pushurl' is a base path. If
|
||||
either 'commiturl' or 'pushurl' could be used, 'commiturl'
|
||||
takes precedence.
|
||||
|
||||
svn.brokenSymlinkWorkaround::
|
||||
This disables potentially expensive checks to workaround
|
||||
broken symlinks checked into SVN by broken clients. Set this
|
||||
|
19
git-svn.perl
19
git-svn.perl
@ -528,7 +528,7 @@ sub cmd_dcommit {
|
||||
$url = eval { command_oneline('config', '--get',
|
||||
"svn-remote.$gs->{repo_id}.commiturl") };
|
||||
if (!$url) {
|
||||
$url = $gs->full_url
|
||||
$url = $gs->full_pushurl
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,7 +676,7 @@ sub cmd_branch {
|
||||
$head ||= 'HEAD';
|
||||
|
||||
my (undef, $rev, undef, $gs) = working_head_info($head);
|
||||
my $src = $gs->full_url;
|
||||
my $src = $gs->full_pushurl;
|
||||
|
||||
my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
|
||||
my $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };
|
||||
@ -727,7 +727,7 @@ sub cmd_branch {
|
||||
$url = eval { command_oneline('config', '--get',
|
||||
"svn-remote.$gs->{repo_id}.commiturl") };
|
||||
if (!$url) {
|
||||
$url = $remote->{url};
|
||||
$url = $remote->{pushurl} || $remote->{url};
|
||||
}
|
||||
}
|
||||
my $dst = join '/', $url, $lft, $branch_name, ($rgt || ());
|
||||
@ -1831,6 +1831,8 @@ sub read_all_remotes {
|
||||
$r->{$1}->{svm} = {};
|
||||
} elsif (m!^(.+)\.url=\s*(.*)\s*$!) {
|
||||
$r->{$1}->{url} = $2;
|
||||
} elsif (m!^(.+)\.pushurl=\s*(.*)\s*$!) {
|
||||
$r->{$1}->{pushurl} = $2;
|
||||
} elsif (m!^(.+)\.(branches|tags)=$svn_refspec$!) {
|
||||
my ($remote, $t, $local_ref, $remote_ref) =
|
||||
($1, $2, $3, $4);
|
||||
@ -2068,6 +2070,8 @@ sub new {
|
||||
$self->{url} = command_oneline('config', '--get',
|
||||
"svn-remote.$repo_id.url") or
|
||||
die "Failed to read \"svn-remote.$repo_id.url\" in config\n";
|
||||
$self->{pushurl} = eval { command_oneline('config', '--get',
|
||||
"svn-remote.$repo_id.pushurl") };
|
||||
$self->rebuild;
|
||||
$self;
|
||||
}
|
||||
@ -2545,6 +2549,15 @@ sub full_url {
|
||||
$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
|
||||
}
|
||||
|
||||
sub full_pushurl {
|
||||
my ($self) = @_;
|
||||
if ($self->{pushurl}) {
|
||||
return $self->{pushurl} . (length $self->{path} ? '/' .
|
||||
$self->{path} : '');
|
||||
} else {
|
||||
return $self->full_url;
|
||||
}
|
||||
}
|
||||
|
||||
sub set_commit_header_env {
|
||||
my ($log_entry) = @_;
|
||||
|
Loading…
Reference in New Issue
Block a user