git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] git-svn: info --url [path]

From
David D. Kilzer <ddkilzer@kilzer.net>
Date
Nov 21, 2007, 06:43 UTC
Message-ID
<1195627399-25209-4-git-send-email-ddkilzer@kilzer.net>
In-Reply-To
<1195627399-25209-3-git-send-email-ddkilzer@kilzer.net>

Return the svn URL for the given path, or return the svn repository URL if no path is given.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---
 git-svn.perl            |    9 +++++++--
 t/t9117-git-svn-info.sh |    4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 406ee6f..eaf2187 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -65,7 +65,7 @@ my ($_stdin, $_help, $_edit,
 	$_template, $_shared,
 	$_version, $_fetch_all, $_no_rebase,
 	$_merge, $_strategy, $_dry_run, $_local,
-	$_prefix, $_no_checkout, $_verbose);
+	$_prefix, $_no_checkout, $_url, $_verbose);
 $Git::SVN::_follow_parent = 1;
 my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
                     'config-dir=s' => \$Git::SVN::Ra::config_dir,
@@ -181,7 +181,7 @@ my %cmd = (
 	'info' => [ \&cmd_info,
 		    "Show info about the latest SVN revision
 		     on the current branch",
-		    { } ],
+		    { 'url' => \$_url, } ],
 );
 
 my $cmd;
@@ -770,6 +770,11 @@ sub cmd_info {
 	}
 	my $full_url = $url . ($path eq "." ? "" : "/$path");
 
+	if ($_url) {
+		print $full_url, "\n";
+		return;
+	}
+
 	my $result = "Path: $path\n";
 	$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
 	$result .= "URL: " . $full_url . "\n";
diff --git a/t/t9117-git-svn-info.sh b/t/t9117-git-svn-info.sh
index c7ca006..800d1c4 100644
--- a/t/t9117-git-svn-info.sh
+++ b/t/t9117-git-svn-info.sh
@@ -183,4 +183,8 @@ test_expect_success 'info unknown-symlink-directory' "
 	git-diff ../t9117/expected.info-unknown-symlink-directory -
 	"
 
+test_expect_success 'info --url' '
+	test $(cd gitwc; git-svn info --url) = $svnrepo
+	'
+
 test_done
-- 
1.5.3.4
Previous: David D. KilzerNext: David D. Kilzer
Message 6 of 10 in “git-svn info: implement info command”
  1. git-svn info: implement info commandDavid D. Kilzer, Nov 12, 2007
  2. Eric WongNov 17, 2007
  3. 0/3 Implement git-svn: infoDavid D. Kilzer, Nov 21, 2007
  4. 1/3 git-svn: extract reusable code into utility functionsDavid D. Kilzer, Nov 21, 2007
  5. 2/3 git-svn info: implement info commandDavid D. Kilzer, Nov 21, 2007
  6. 3/3 git-svn: info --url [path]David D. Kilzer, Nov 21, 2007
  7. 3/3 git-svn: info --url [path]David D. Kilzer, Nov 21, 2007
  8. David D. KilzerNov 21, 2007
  9. Eric WongNov 21, 2007
  10. Eric WongNov 21, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.