[PATCH] git-svn: Add a svn-remote.<name>.pushurl config key
- From
Alejandro R. Sedeño <asedeno@mit.edu>
- Date
- Apr 5, 2011, 20:15 UTC
- Message-ID
- <1302034509-8842-1-git-send-email-asedeno@mit.edu>
- In-Reply-To
- <4D9B310A.9020203@mit.edu>
Similar to the 'remote.<name>.pushurl' config key for git remotes, the 'pushurl' key is treated the same as the 'url' key. This is distinct from the 'commiturl' key, which is defined to be a full svn path.
This is necessary if you want to be able to commit to multiple branches.
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu> Reviewed-off-by: James Y Knight <jknight@itasoftware.com> --- Documentation/git-svn.txt | 6 ++++++ git-svn.perl | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index ea8fafd..94f7497 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -648,6 +648,12 @@ 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 is useful in + cases where the SVN repository url is read-only. Unlike + 'commiturl', 'pushurl' is a base path. This key is overridden + by the 'commiturl' config key. + svn.brokenSymlinkWorkaround:: This disables potentially expensive checks to workaround broken symlinks checked into SVN by broken clients. Set this diff --git a/git-svn.perl b/git-svn.perl index fa8cd07..8372606 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -531,7 +531,13 @@ sub cmd_dcommit { $url = eval { command_oneline('config', '--get', "svn-remote.$gs->{repo_id}.commiturl") }; if (!$url) { - $url = $gs->full_url + $url = eval { command_oneline('config', '--get', + "svn-remote.$gs->{repo_id}.pushurl") }; + if ($url) { + $url .= (length $gs->{path} ? '/' . $gs->{path} : ''); + } else { + $url = $gs->full_url + } } } @@ -730,7 +736,11 @@ sub cmd_branch { $url = eval { command_oneline('config', '--get', "svn-remote.$gs->{repo_id}.commiturl") }; if (!$url) { - $url = $remote->{url}; + $url = eval { command_oneline('config', '--get', + "svn-remote.$gs->{repo_id}.pushurl") }; + if (!$url) { + $url = $remote->{url}; + } } } my $dst = join '/', $url, $lft, $branch_name, ($rgt || ());
-- 1.7.4.2.1.gd6f1f