git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David D. Kilzer" <ddkilzer@kilzer.net>
To: "Eric Wong" <normalperson@yhbt.net>
Cc: git@vger.kernel.org, "David D. Kilzer" <ddkilzer@kilzer.net>
Subject: [PATCH 3/3 v2] git-svn: info --url [path]
Date: Tue, 20 Nov 2007 22:49:28 -0800	[thread overview]
Message-ID: <1195627768-26689-1-git-send-email-ddkilzer@kilzer.net> (raw)
In-Reply-To: <1195627399-25209-4-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.

Added one test to t/t9117-git-svn-info.sh.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---

Added missing documentation change, and tweaked commit log.

 Documentation/git-svn.txt |    2 +-
 git-svn.perl              |    9 +++++++--
 t/t9117-git-svn-info.sh   |    4 ++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c3fc878..295b14b 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -196,7 +196,7 @@ Any other arguments are passed directly to `git log'
 'info'::
 	Shows information about a file or directory similar to what
 	`svn info' provides.  Does not currently support a -r/--revision
-	argument.
+	argument.  Use the --url option to output only the 'URL:' field.
 
 --
 
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

  reply	other threads:[~2007-11-21  6:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-12 16:19 [RFC PATCH] git-svn info: implement info command David D. Kilzer
2007-11-17 22:54 ` Eric Wong
2007-11-21  6:43   ` [PATCH 0/3] Implement git-svn: info David D. Kilzer
2007-11-21  6:43     ` [PATCH 1/3] git-svn: extract reusable code into utility functions David D. Kilzer
2007-11-21  6:43       ` [PATCH 2/3] git-svn info: implement info command David D. Kilzer
2007-11-21  6:43         ` [PATCH 3/3] git-svn: info --url [path] David D. Kilzer
2007-11-21  6:49           ` David D. Kilzer [this message]
2007-11-21  6:59     ` [PATCH 0/3] Implement git-svn: info David D. Kilzer
2007-11-21  9:18       ` Eric Wong
2007-11-21  9:20         ` Eric Wong

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

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

  git send-email \
    --in-reply-to=1195627768-26689-1-git-send-email-ddkilzer@kilzer.net \
    --to=ddkilzer@kilzer.net \
    --cc=git@vger.kernel.org \
    --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.
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 NNTP newsgroup(s).