git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Alejandro R. Sedeño" <asedeno@mit.edu>
To: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Cc: James Y Knight <jknight@itasoftware.com>,
	Junio C Hamano <gitster@pobox.com>,
	Michael J Gruber <git@drmicha.warpmail.net>
Subject: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key
Date: Fri,  8 Apr 2011 10:57:54 -0400	[thread overview]
Message-ID: <1302274674-4231-1-git-send-email-asedeno@mit.edu> (raw)
In-Reply-To: <1302102336-8800-1-git-send-email-asedeno@mit.edu>

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>
---
 Documentation/git-svn.txt |   10 ++++++++++
 git-svn.perl              |   18 +++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index ea8fafd..4aa6404 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -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
diff --git a/git-svn.perl b/git-svn.perl
index fa8cd07..184442a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -531,7 +531,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
 		}
 	}
 
@@ -679,7 +679,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' };
@@ -730,7 +730,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 || ());
@@ -1834,6 +1834,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);
@@ -2071,6 +2073,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;
 }
@@ -2548,6 +2552,14 @@ 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) = @_;
-- 
1.7.4.2.1.gd6f1f

  parent reply	other threads:[~2011-04-08 14:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 19:09 [PATCHv2 0/2] a couple of git-svn patches Alejandro R. Sedeño
2011-04-04 19:09 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
2011-04-04 21:52   ` Eric Wong
2011-04-04 22:16     ` James Y Knight
2011-04-04 22:54       ` Eric Wong
2011-04-05 15:11         ` "Alejandro R. Sedeño"
2011-04-05 20:15           ` [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key Alejandro R. Sedeño
2011-04-05 20:25             ` "Alejandro R. Sedeño"
2011-04-05 21:09               ` Eric Wong
2011-04-06 12:53               ` Michael J Gruber
2011-04-06 13:04                 ` "Alejandro R. Sedeño"
2011-04-06 13:12                   ` Michael J Gruber
2011-04-06 15:05               ` Alejandro R. Sedeño
2011-04-06 15:22                 ` Michael J Gruber
2011-04-06 15:34                   ` "Alejandro R. Sedeño"
2011-04-06 15:38                     ` Michael J Gruber
2011-04-08 14:57                 ` Alejandro R. Sedeño [this message]
2011-04-08 20:13                   ` Junio C Hamano
2011-04-08 20:25                     ` Michael J Gruber
2011-04-08 20:54                     ` Jeff King
     [not found]                       ` <7v4o6830cc.fsf@alter.siamese.dyndns.org>
2011-04-08 21:32                         ` Jeff King
2011-04-08 22:25                           ` Junio C Hamano
2011-04-08 22:40                             ` Jeff King
2011-04-08 22:43                               ` Jeff King
2011-04-22 19:11                               ` "Alejandro R. Sedeño"
2011-04-22 19:36                                 ` Jeff King
2011-04-22 19:40                                   ` "Alejandro R. Sedeño"
2011-04-09 22:47                   ` Eric Wong
2011-04-06 12:44             ` Michael J Gruber
2011-04-06 12:56               ` "Alejandro R. Sedeño"
2011-04-04 19:09 ` [PATCH 2/2] git-svn: Cache results of running the executable "git config" Alejandro R. Sedeño
2011-04-04 21:53   ` Eric Wong
     [not found]     ` <7voc4l5hm5.fsf@alter.siamese.dyndns.org>
2011-04-05  8:15       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302274674-4231-1-git-send-email-asedeno@mit.edu \
    --to=asedeno@mit.edu \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jknight@itasoftware.com \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).