git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] 'git svn info' fixes
@ 2008-08-26 19:32 Thomas Rast
  2008-08-26 19:32 ` [PATCH 1/6] git svn info: tests: let 'init' test run with SVN 1.5 Thomas Rast
  2008-08-27  9:53 ` [PATCH 0/6] 'git svn info' fixes Eric Wong
  0 siblings, 2 replies; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Actually, I only wanted to do 5/6 (git svn info: make info relative to
the current directory).  This seemed like a fairly simple change, see
the corresponding mail.

However, I also wanted to provide tests, and that's where the fun
started.  Turns out t9119-git-svn-info.sh is currently quite broken.
1-4 just fix the tests; a brief summary:

[1/6] git svn info: tests: let 'init' test run with SVN 1.5

  The tests do not report any problems with 1.5.

[2/6] git svn info: tests: do not use set -e

  No idea how 'set -e' ever got in there; it completely breaks the
  test script in case of an error.

[3/6] git svn info: tests: use test_cmp instead of git-diff

  git-diff does not correctly report the exit status (IIRC that is
  caused by the pager setup code?), which used to hide a lot of
  errors.

[4/6] git svn info: tests: fix ptouch argument order in setup

  Swapped arguments caused ptouch to fail and tests to break.

Yes, I'm just whoring commit karma here, so feel free to squash these
four into one if you like it better that way.

After these, 22 of 37 tests (all except --url, plus all unknown files)
fail. Most of them are caused by 'git svn info' not URL-encoding the
URL and Repository fields in the output, as SVN does.  6/6 fixes
this.

However, the unknown files tests still fail, simply because 'svn info'
itself fails on untracked files.  It would be great if someone who is
still running SVN 1.4 could check whether that has been a bug in
git-svn all along, or is actually a behaviour change on the part of
SVN.

Oh, and let's hope I did the splitting right this time :-)


 git-svn.perl            |   30 +++++++++++--
 t/t9119-git-svn-info.sh |  102 ++++++++++++++++++++++++++---------------------
 2 files changed, 82 insertions(+), 50 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/6] git svn info: tests: let 'init' test run with SVN 1.5
  2008-08-26 19:32 [PATCH 0/6] 'git svn info' fixes Thomas Rast
@ 2008-08-26 19:32 ` Thomas Rast
  2008-08-26 19:32   ` [PATCH 2/6] git svn info: tests: do not use set -e Thomas Rast
  2008-08-27  9:53 ` [PATCH 0/6] 'git svn info' fixes Eric Wong
  1 sibling, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t9119-git-svn-info.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 5fd36a1..46676bc 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -9,9 +9,9 @@ test_description='git-svn info'
 set -e
 
 # Tested with: svn, version 1.4.4 (r25188)
-v=`svn --version | sed -n -e 's/^svn, version \(1\.4\.[0-9]\).*$/\1/p'`
+v=`svn --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'`
 case $v in
-1.4.*)
+1.[45].*)
 	;;
 *)
 	say "skipping svn-info test (SVN version: $v not supported)"
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/6] git svn info: tests: do not use set -e
  2008-08-26 19:32 ` [PATCH 1/6] git svn info: tests: let 'init' test run with SVN 1.5 Thomas Rast
@ 2008-08-26 19:32   ` Thomas Rast
  2008-08-26 19:32     ` [PATCH 3/6] git svn info: tests: use test_cmp instead of git-diff Thomas Rast
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Exiting in the middle of a test confuses the test suite, which will
just say "FATAL: Unexpected exit with code 1" in response to a failed
test, instead of actually diagnosing failure and continuing with the
next test.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t9119-git-svn-info.sh |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 46676bc..a70f2b9 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -6,8 +6,6 @@ test_description='git-svn info'
 
 . ./lib-git-svn.sh
 
-set -e
-
 # Tested with: svn, version 1.4.4 (r25188)
 v=`svn --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'`
 case $v in
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/6] git svn info: tests: use test_cmp instead of git-diff
  2008-08-26 19:32   ` [PATCH 2/6] git svn info: tests: do not use set -e Thomas Rast
@ 2008-08-26 19:32     ` Thomas Rast
  2008-08-26 19:32       ` [PATCH 4/6] git svn info: tests: fix ptouch argument order in setup Thomas Rast
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

git-diff does not appear to return the correct exit values, and gives
a false success for more than half (!) of the tests due to the space
in "trash directory" which git-svn fails to encode.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t9119-git-svn-info.sh |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index a70f2b9..7798dcc 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -60,7 +60,7 @@ test_expect_success 'setup repository and import' '
 test_expect_success 'info' "
 	(cd svnwc; svn info) > expected.info &&
 	(cd gitwc; git-svn info) > actual.info &&
-	git-diff expected.info actual.info
+	test_cmp expected.info actual.info
 	"
 
 test_expect_success 'info --url' '
@@ -70,7 +70,7 @@ test_expect_success 'info --url' '
 test_expect_success 'info .' "
 	(cd svnwc; svn info .) > expected.info-dot &&
 	(cd gitwc; git-svn info .) > actual.info-dot &&
-	git-diff expected.info-dot actual.info-dot
+	test_cmp expected.info-dot actual.info-dot
 	"
 
 test_expect_success 'info --url .' '
@@ -80,7 +80,7 @@ test_expect_success 'info --url .' '
 test_expect_success 'info file' "
 	(cd svnwc; svn info file) > expected.info-file &&
 	(cd gitwc; git-svn info file) > actual.info-file &&
-	git-diff expected.info-file actual.info-file
+	test_cmp expected.info-file actual.info-file
 	"
 
 test_expect_success 'info --url file' '
@@ -90,7 +90,7 @@ test_expect_success 'info --url file' '
 test_expect_success 'info directory' "
 	(cd svnwc; svn info directory) > expected.info-directory &&
 	(cd gitwc; git-svn info directory) > actual.info-directory &&
-	git-diff expected.info-directory actual.info-directory
+	test_cmp expected.info-directory actual.info-directory
 	"
 
 test_expect_success 'info --url directory' '
@@ -100,7 +100,7 @@ test_expect_success 'info --url directory' '
 test_expect_success 'info symlink-file' "
 	(cd svnwc; svn info symlink-file) > expected.info-symlink-file &&
 	(cd gitwc; git-svn info symlink-file) > actual.info-symlink-file &&
-	git-diff expected.info-symlink-file actual.info-symlink-file
+	test_cmp expected.info-symlink-file actual.info-symlink-file
 	"
 
 test_expect_success 'info --url symlink-file' '
@@ -113,7 +113,7 @@ test_expect_success 'info symlink-directory' "
 		> expected.info-symlink-directory &&
 	(cd gitwc; git-svn info symlink-directory) \
 		> actual.info-symlink-directory &&
-	git-diff expected.info-symlink-directory actual.info-symlink-directory
+	test_cmp expected.info-symlink-directory actual.info-symlink-directory
 	"
 
 test_expect_success 'info --url symlink-directory' '
@@ -133,7 +133,7 @@ test_expect_success 'info added-file' "
 	cd .. &&
 	(cd svnwc; svn info added-file) > expected.info-added-file &&
 	(cd gitwc; git-svn info added-file) > actual.info-added-file &&
-	git-diff expected.info-added-file actual.info-added-file
+	test_cmp expected.info-added-file actual.info-added-file
 	"
 
 test_expect_success 'info --url added-file' '
@@ -155,7 +155,7 @@ test_expect_success 'info added-directory' "
 		> expected.info-added-directory &&
 	(cd gitwc; git-svn info added-directory) \
 		> actual.info-added-directory &&
-	git-diff expected.info-added-directory actual.info-added-directory
+	test_cmp expected.info-added-directory actual.info-added-directory
 	"
 
 test_expect_success 'info --url added-directory' '
@@ -177,7 +177,7 @@ test_expect_success 'info added-symlink-file' "
 		> expected.info-added-symlink-file &&
 	(cd gitwc; git-svn info added-symlink-file) \
 		> actual.info-added-symlink-file &&
-	git-diff expected.info-added-symlink-file \
+	test_cmp expected.info-added-symlink-file \
 		 actual.info-added-symlink-file
 	"
 
@@ -200,7 +200,7 @@ test_expect_success 'info added-symlink-directory' "
 		> expected.info-added-symlink-directory &&
 	(cd gitwc; git-svn info added-symlink-directory) \
 		> actual.info-added-symlink-directory &&
-	git-diff expected.info-added-symlink-directory \
+	test_cmp expected.info-added-symlink-directory \
 		 actual.info-added-symlink-directory
 	"
 
@@ -227,7 +227,7 @@ test_expect_success 'info deleted-file' "
 	(cd gitwc; git-svn info file) |
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
 		> actual.info-deleted-file &&
-	git-diff expected.info-deleted-file actual.info-deleted-file
+	test_cmp expected.info-deleted-file actual.info-deleted-file
 	"
 
 test_expect_success 'info --url file (deleted)' '
@@ -248,7 +248,7 @@ test_expect_success 'info deleted-directory' "
 	(cd gitwc; git-svn info directory) |
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
 		> actual.info-deleted-directory &&
-	git-diff expected.info-deleted-directory actual.info-deleted-directory
+	test_cmp expected.info-deleted-directory actual.info-deleted-directory
 	"
 
 test_expect_success 'info --url directory (deleted)' '
@@ -269,7 +269,7 @@ test_expect_success 'info deleted-symlink-file' "
 	(cd gitwc; git-svn info symlink-file) |
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
 		> actual.info-deleted-symlink-file &&
-	git-diff expected.info-deleted-symlink-file \
+	test_cmp expected.info-deleted-symlink-file \
 		 actual.info-deleted-symlink-file
 	"
 
@@ -291,7 +291,7 @@ test_expect_success 'info deleted-symlink-directory' "
 	(cd gitwc; git-svn info symlink-directory) |
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
 		 > actual.info-deleted-symlink-directory &&
-	git-diff expected.info-deleted-symlink-directory \
+	test_cmp expected.info-deleted-symlink-directory \
 		 actual.info-deleted-symlink-directory
 	"
 
@@ -309,13 +309,13 @@ test_expect_success 'info unknown-file' "
 	ptouch gitwc/unknown-file svnwc/unknown-file &&
 	(cd svnwc; svn info unknown-file) 2> expected.info-unknown-file &&
 	(cd gitwc; git-svn info unknown-file) 2> actual.info-unknown-file &&
-	git-diff expected.info-unknown-file actual.info-unknown-file
+	test_cmp expected.info-unknown-file actual.info-unknown-file
 	"
 
 test_expect_success 'info --url unknown-file' '
 	test -z "$(cd gitwc; git-svn info --url unknown-file \
 			2> ../actual.info--url-unknown-file)" &&
-	git-diff expected.info-unknown-file actual.info--url-unknown-file
+	test_cmp expected.info-unknown-file actual.info--url-unknown-file
 	'
 
 test_expect_success 'info unknown-directory' "
@@ -326,13 +326,13 @@ test_expect_success 'info unknown-directory' "
 		2> expected.info-unknown-directory &&
 	(cd gitwc; git-svn info unknown-directory) \
 		2> actual.info-unknown-directory &&
-	git-diff expected.info-unknown-directory actual.info-unknown-directory
+	test_cmp expected.info-unknown-directory actual.info-unknown-directory
 	"
 
 test_expect_success 'info --url unknown-directory' '
 	test -z "$(cd gitwc; git-svn info --url unknown-directory \
 			2> ../actual.info--url-unknown-directory)" &&
-	git-diff expected.info-unknown-directory \
+	test_cmp expected.info-unknown-directory \
 		 actual.info--url-unknown-directory
 	'
 
@@ -348,14 +348,14 @@ test_expect_success 'info unknown-symlink-file' "
 		2> expected.info-unknown-symlink-file &&
 	(cd gitwc; git-svn info unknown-symlink-file) \
 		2> actual.info-unknown-symlink-file &&
-	git-diff expected.info-unknown-symlink-file \
+	test_cmp expected.info-unknown-symlink-file \
 		 actual.info-unknown-symlink-file
 	"
 
 test_expect_success 'info --url unknown-symlink-file' '
 	test -z "$(cd gitwc; git-svn info --url unknown-symlink-file \
 			2> ../actual.info--url-unknown-symlink-file)" &&
-	git-diff expected.info-unknown-symlink-file \
+	test_cmp expected.info-unknown-symlink-file \
 		 actual.info--url-unknown-symlink-file
 	'
 
@@ -372,14 +372,14 @@ test_expect_success 'info unknown-symlink-directory' "
 		2> expected.info-unknown-symlink-directory &&
 	(cd gitwc; git-svn info unknown-symlink-directory) \
 		2> actual.info-unknown-symlink-directory &&
-	git-diff expected.info-unknown-symlink-directory \
+	test_cmp expected.info-unknown-symlink-directory \
 		 actual.info-unknown-symlink-directory
 	"
 
 test_expect_success 'info --url unknown-symlink-directory' '
 	test -z "$(cd gitwc; git-svn info --url unknown-symlink-directory \
 			2> ../actual.info--url-unknown-symlink-directory)" &&
-	git-diff expected.info-unknown-symlink-directory \
+	test_cmp expected.info-unknown-symlink-directory \
 		 actual.info--url-unknown-symlink-directory
 	'
 
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/6] git svn info: tests: fix ptouch argument order in setup
  2008-08-26 19:32     ` [PATCH 3/6] git svn info: tests: use test_cmp instead of git-diff Thomas Rast
@ 2008-08-26 19:32       ` Thomas Rast
  2008-08-26 19:32         ` [PATCH 5/6] git svn info: make info relative to the current directory Thomas Rast
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

The arguments must be <gitwc-path> <svnwc-path>, otherwise it fails to
update the timestamps (without setting a failure exit code) and
results in bad test output later on.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t9119-git-svn-info.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 7798dcc..821507d 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -51,10 +51,10 @@ test_expect_success 'setup repository and import' '
 		git-svn fetch &&
 	cd .. &&
 	svn co "$svnrepo" svnwc &&
-	ptouch svnwc/file gitwc/file &&
-	ptouch svnwc/directory gitwc/directory &&
-	ptouch svnwc/symlink-file gitwc/symlink-file &&
-	ptouch svnwc/symlink-directory gitwc/symlink-directory
+	ptouch gitwc/file svnwc/file &&
+	ptouch gitwc/directory svnwc/directory &&
+	ptouch gitwc/symlink-file svnwc/symlink-file &&
+	ptouch gitwc/symlink-directory svnwc/symlink-directory
 	'
 
 test_expect_success 'info' "
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/6] git svn info: make info relative to the current directory
  2008-08-26 19:32       ` [PATCH 4/6] git svn info: tests: fix ptouch argument order in setup Thomas Rast
@ 2008-08-26 19:32         ` Thomas Rast
  2008-08-26 19:32           ` [PATCH 6/6] git svn info: always quote URLs in 'info' output Thomas Rast
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Previously 'git svn info <path>' would always treat the <path> as
relative to the working directory root, with a default of ".".  This
does not match the behaviour of 'svn info'.  Prepend $(git rev-parse
--show-prefix) to the path used inside cmd_info to make it relative to
the current working directory.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

I realise that this might break things for people who rely on the
current behaviour, but looking at the tests, the goal is to imitate
'svn info' as closely as possible.  This also matches my use case of
'svn info || git svn info', which is why I stumbled over the problem
in the first place.


 git-svn.perl            |    5 +++--
 t/t9119-git-svn-info.sh |   14 +++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 7a1d26d..46bc0b0 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -805,6 +805,7 @@ sub cmd_commit_diff {
 
 sub cmd_info {
 	my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
+	my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
 	if (exists $_[1]) {
 		die "Too many arguments specified\n";
 	}
@@ -825,7 +826,7 @@ sub cmd_info {
 	# canonicalize_path() will return "" to make libsvn 1.5.x happy,
 	$path = "." if $path eq "";
 
-	my $full_url = $url . ($path eq "." ? "" : "/$path");
+	my $full_url = $url . ($fullpath eq "" ? "" : "/$fullpath");
 
 	if ($_url) {
 		print $full_url, "\n";
@@ -861,7 +862,7 @@ sub cmd_info {
 	}
 
 	my ($lc_author, $lc_rev, $lc_date_utc);
-	my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $path);
+	my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $fullpath);
 	my $log = command_output_pipe(@args);
 	my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
 	while (<$log>) {
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 821507d..8709bcc 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -45,12 +45,18 @@ test_expect_success 'setup repository and import' '
 		ln -s directory symlink-directory &&
 		svn import -m "initial" . "$svnrepo" &&
 	cd .. &&
+	svn co "$svnrepo" svnwc &&
+	cd svnwc &&
+		echo foo > foo &&
+		svn add foo &&
+		svn commit -m "change outside directory" &&
+		svn update &&
+	cd .. &&
 	mkdir gitwc &&
 	cd gitwc &&
 		git-svn init "$svnrepo" &&
 		git-svn fetch &&
 	cd .. &&
-	svn co "$svnrepo" svnwc &&
 	ptouch gitwc/file svnwc/file &&
 	ptouch gitwc/directory svnwc/directory &&
 	ptouch gitwc/symlink-file svnwc/symlink-file &&
@@ -93,6 +99,12 @@ test_expect_success 'info directory' "
 	test_cmp expected.info-directory actual.info-directory
 	"
 
+test_expect_success 'info inside directory' "
+	(cd svnwc/directory; svn info) > expected.info-inside-directory &&
+	(cd gitwc/directory; git-svn info) > actual.info-inside-directory &&
+	test_cmp expected.info-inside-directory actual.info-inside-directory
+	"
+
 test_expect_success 'info --url directory' '
 	test "$(cd gitwc; git-svn info --url directory)" = "$svnrepo/directory"
 	'
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 6/6] git svn info: always quote URLs in 'info' output
  2008-08-26 19:32         ` [PATCH 5/6] git svn info: make info relative to the current directory Thomas Rast
@ 2008-08-26 19:32           ` Thomas Rast
  2008-08-27  9:43             ` Eric Wong
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-26 19:32 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Changes 'git svn info' to always URL-escape the 'URL' and 'Repository'
fields and --url output, like SVN (at least 1.5) does.

Note that reusing the escape_url() further down in Git::SVN::Ra is not
possible because it only triggers for http(s) URLs.  I did not know
whether extending it to all schemes would break SVN access anywhere,
so I made a new one that quotes in all schemes.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

I wasn't sure if I should quote --url too.  It is not an 'svn info'
feature, so we could do it either way.  Eventually I decided for the
change to be consistent with the 'URL:' field of normal output.  If
this breaks scripts for someone, I can change it back.

 git-svn.perl            |   25 ++++++++++++++++++++++---
 t/t9119-git-svn-info.sh |   30 ++++++++++++++++--------------
 2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 46bc0b0..11ff813 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -803,6 +803,25 @@ sub cmd_commit_diff {
 	}
 }
 
+sub escape_uri_only {
+	my ($uri) = @_;
+	my @tmp;
+	foreach (split m{/}, $uri) {
+		s/([^\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
+		push @tmp, $_;
+	}
+	join('/', @tmp);
+}
+
+sub escape_url {
+	my ($url) = @_;
+	if ($url =~ m#^([^:]+)://([^/]*)(.*)$#) {
+		my ($scheme, $domain, $uri) = ($1, $2, escape_uri_only($3));
+		$url = "$scheme://$domain$uri";
+	}
+	$url;
+}
+
 sub cmd_info {
 	my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
 	my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
@@ -829,18 +848,18 @@ sub cmd_info {
 	my $full_url = $url . ($fullpath eq "" ? "" : "/$fullpath");
 
 	if ($_url) {
-		print $full_url, "\n";
+		print escape_url($full_url), "\n";
 		return;
 	}
 
 	my $result = "Path: $path\n";
 	$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
-	$result .= "URL: " . $full_url . "\n";
+	$result .= "URL: " . escape_url($full_url) . "\n";
 
 	eval {
 		my $repos_root = $gs->repos_root;
 		Git::SVN::remove_username($repos_root);
-		$result .= "Repository Root: $repos_root\n";
+		$result .= "Repository Root: " . escape_url($repos_root) . "\n";
 	};
 	if ($@) {
 		$result .= "Repository Root: (offline)\n";
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 8709bcc..1811010 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -34,6 +34,8 @@ ptouch() {
 	' "`svn info $2 | grep '^Text Last Updated:'`" "$1"
 }
 
+quoted_svnrepo="$(echo $svnrepo | sed 's/ /%20/')"
+
 test_expect_success 'setup repository and import' '
 	mkdir info &&
 	cd info &&
@@ -70,7 +72,7 @@ test_expect_success 'info' "
 	"
 
 test_expect_success 'info --url' '
-	test "$(cd gitwc; git-svn info --url)" = "$svnrepo"
+	test "$(cd gitwc; git-svn info --url)" = "$quoted_svnrepo"
 	'
 
 test_expect_success 'info .' "
@@ -80,7 +82,7 @@ test_expect_success 'info .' "
 	"
 
 test_expect_success 'info --url .' '
-	test "$(cd gitwc; git-svn info --url .)" = "$svnrepo"
+	test "$(cd gitwc; git-svn info --url .)" = "$quoted_svnrepo"
 	'
 
 test_expect_success 'info file' "
@@ -90,7 +92,7 @@ test_expect_success 'info file' "
 	"
 
 test_expect_success 'info --url file' '
-	test "$(cd gitwc; git-svn info --url file)" = "$svnrepo/file"
+	test "$(cd gitwc; git-svn info --url file)" = "$quoted_svnrepo/file"
 	'
 
 test_expect_success 'info directory' "
@@ -106,7 +108,7 @@ test_expect_success 'info inside directory' "
 	"
 
 test_expect_success 'info --url directory' '
-	test "$(cd gitwc; git-svn info --url directory)" = "$svnrepo/directory"
+	test "$(cd gitwc; git-svn info --url directory)" = "$quoted_svnrepo/directory"
 	'
 
 test_expect_success 'info symlink-file' "
@@ -117,7 +119,7 @@ test_expect_success 'info symlink-file' "
 
 test_expect_success 'info --url symlink-file' '
 	test "$(cd gitwc; git-svn info --url symlink-file)" \
-	     = "$svnrepo/symlink-file"
+	     = "$quoted_svnrepo/symlink-file"
 	'
 
 test_expect_success 'info symlink-directory' "
@@ -130,7 +132,7 @@ test_expect_success 'info symlink-directory' "
 
 test_expect_success 'info --url symlink-directory' '
 	test "$(cd gitwc; git-svn info --url symlink-directory)" \
-	     = "$svnrepo/symlink-directory"
+	     = "$quoted_svnrepo/symlink-directory"
 	'
 
 test_expect_success 'info added-file' "
@@ -150,7 +152,7 @@ test_expect_success 'info added-file' "
 
 test_expect_success 'info --url added-file' '
 	test "$(cd gitwc; git-svn info --url added-file)" \
-	     = "$svnrepo/added-file"
+	     = "$quoted_svnrepo/added-file"
 	'
 
 test_expect_success 'info added-directory' "
@@ -172,7 +174,7 @@ test_expect_success 'info added-directory' "
 
 test_expect_success 'info --url added-directory' '
 	test "$(cd gitwc; git-svn info --url added-directory)" \
-	     = "$svnrepo/added-directory"
+	     = "$quoted_svnrepo/added-directory"
 	'
 
 test_expect_success 'info added-symlink-file' "
@@ -195,7 +197,7 @@ test_expect_success 'info added-symlink-file' "
 
 test_expect_success 'info --url added-symlink-file' '
 	test "$(cd gitwc; git-svn info --url added-symlink-file)" \
-	     = "$svnrepo/added-symlink-file"
+	     = "$quoted_svnrepo/added-symlink-file"
 	'
 
 test_expect_success 'info added-symlink-directory' "
@@ -218,7 +220,7 @@ test_expect_success 'info added-symlink-directory' "
 
 test_expect_success 'info --url added-symlink-directory' '
 	test "$(cd gitwc; git-svn info --url added-symlink-directory)" \
-	     = "$svnrepo/added-symlink-directory"
+	     = "$quoted_svnrepo/added-symlink-directory"
 	'
 
 # The next few tests replace the "Text Last Updated" value with a
@@ -244,7 +246,7 @@ test_expect_success 'info deleted-file' "
 
 test_expect_success 'info --url file (deleted)' '
 	test "$(cd gitwc; git-svn info --url file)" \
-	     = "$svnrepo/file"
+	     = "$quoted_svnrepo/file"
 	'
 
 test_expect_success 'info deleted-directory' "
@@ -265,7 +267,7 @@ test_expect_success 'info deleted-directory' "
 
 test_expect_success 'info --url directory (deleted)' '
 	test "$(cd gitwc; git-svn info --url directory)" \
-	     = "$svnrepo/directory"
+	     = "$quoted_svnrepo/directory"
 	'
 
 test_expect_success 'info deleted-symlink-file' "
@@ -287,7 +289,7 @@ test_expect_success 'info deleted-symlink-file' "
 
 test_expect_success 'info --url symlink-file (deleted)' '
 	test "$(cd gitwc; git-svn info --url symlink-file)" \
-	     = "$svnrepo/symlink-file"
+	     = "$quoted_svnrepo/symlink-file"
 	'
 
 test_expect_success 'info deleted-symlink-directory' "
@@ -309,7 +311,7 @@ test_expect_success 'info deleted-symlink-directory' "
 
 test_expect_success 'info --url symlink-directory (deleted)' '
 	test "$(cd gitwc; git-svn info --url symlink-directory)" \
-	     = "$svnrepo/symlink-directory"
+	     = "$quoted_svnrepo/symlink-directory"
 	'
 
 # NOTE: git does not have the concept of replaced objects,
-- 
1.6.0.1.96.g9307e.dirty

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 6/6] git svn info: always quote URLs in 'info' output
  2008-08-26 19:32           ` [PATCH 6/6] git svn info: always quote URLs in 'info' output Thomas Rast
@ 2008-08-27  9:43             ` Eric Wong
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Wong @ 2008-08-27  9:43 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano

Thomas Rast <trast@student.ethz.ch> wrote:
> Changes 'git svn info' to always URL-escape the 'URL' and 'Repository'
> fields and --url output, like SVN (at least 1.5) does.
> 
> Note that reusing the escape_url() further down in Git::SVN::Ra is not
> possible because it only triggers for http(s) URLs.  I did not know
> whether extending it to all schemes would break SVN access anywhere,
> so I made a new one that quotes in all schemes.

Thanks for keeping them separate. I seem to recall there being places
where paths must not be escaped in SVN.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/6] 'git svn info' fixes
  2008-08-26 19:32 [PATCH 0/6] 'git svn info' fixes Thomas Rast
  2008-08-26 19:32 ` [PATCH 1/6] git svn info: tests: let 'init' test run with SVN 1.5 Thomas Rast
@ 2008-08-27  9:53 ` Eric Wong
  2008-08-28  8:30   ` Thomas Rast
  1 sibling, 1 reply; 18+ messages in thread
From: Eric Wong @ 2008-08-27  9:53 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano

Thomas Rast <trast@student.ethz.ch> wrote:
> However, I also wanted to provide tests, and that's where the fun
> started.  Turns out t9119-git-svn-info.sh is currently quite broken.
> 1-4 just fix the tests; a brief summary:
> 
> [1/6] git svn info: tests: let 'init' test run with SVN 1.5
> 
>   The tests do not report any problems with 1.5.
> 
> [2/6] git svn info: tests: do not use set -e
> 
>   No idea how 'set -e' ever got in there; it completely breaks the
>   test script in case of an error.

I have a habit of using set -e in my scripts since I often
forget (or am too lazy) to check for errors when executing
a series of commands.

> [4/6] git svn info: tests: fix ptouch argument order in setup
> 
>   Swapped arguments caused ptouch to fail and tests to break.

Hm... I seem to remember explicitly setting the arguments one
way for one reason or another.

> Yes, I'm just whoring commit karma here, so feel free to squash these
> four into one if you like it better that way.
> 
> After these, 22 of 37 tests (all except --url, plus all unknown files)
> fail. Most of them are caused by 'git svn info' not URL-encoding the
> URL and Repository fields in the output, as SVN does.  6/6 fixes
> this.
> 
> However, the unknown files tests still fail, simply because 'svn info'
> itself fails on untracked files.  It would be great if someone who is
> still running SVN 1.4 could check whether that has been a bug in
> git-svn all along, or is actually a behaviour change on the part of
> SVN.

Oops, I upgraded to 1.5.x here already.  I should still have
another machine with 1.4 to check on tomorrow, though.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/6] 'git svn info' fixes
  2008-08-27  9:53 ` [PATCH 0/6] 'git svn info' fixes Eric Wong
@ 2008-08-28  8:30   ` Thomas Rast
  2008-08-29  8:16     ` Eric Wong
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-28  8:30 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 983 bytes --]

Eric Wong wrote:
> Thomas Rast <trast@student.ethz.ch> wrote:
> > However, the unknown files tests still fail, simply because 'svn info'
> > itself fails on untracked files.  It would be great if someone who is
> > still running SVN 1.4 could check whether that has been a bug in
> > git-svn all along, or is actually a behaviour change on the part of
> > SVN.
> 
> Oops, I upgraded to 1.5.x here already.  I should still have
> another machine with 1.4 to check on tomorrow, though.

I got a friend with 1.4 to test this, and it appears the error

  $ touch new
  $ svn info new
  new:  (Keine versionierte Ressource)

(literally "not a versioned resource") is already present in

  $ svn --version
  svn, Version 1.4.6 (r28521)

(He also says the error is the same if the file does not exist at
all.)

So should we just change all "unknown foo" tests to verify that 'git
svn info' errors out too?

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/6] 'git svn info' fixes
  2008-08-28  8:30   ` Thomas Rast
@ 2008-08-29  8:16     ` Eric Wong
  2008-08-29 13:42       ` [PATCH 0/2] *** SUBJECT HERE *** Thomas Rast
  0 siblings, 1 reply; 18+ messages in thread
From: Eric Wong @ 2008-08-29  8:16 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano

Thomas Rast <trast@student.ethz.ch> wrote:
> Eric Wong wrote:
> > Thomas Rast <trast@student.ethz.ch> wrote:
> > > However, the unknown files tests still fail, simply because 'svn info'
> > > itself fails on untracked files.  It would be great if someone who is
> > > still running SVN 1.4 could check whether that has been a bug in
> > > git-svn all along, or is actually a behaviour change on the part of
> > > SVN.
> > 
> > Oops, I upgraded to 1.5.x here already.  I should still have
> > another machine with 1.4 to check on tomorrow, though.
> 
> I got a friend with 1.4 to test this, and it appears the error
> 
>   $ touch new
>   $ svn info new
>   new:  (Keine versionierte Ressource)
> 
> (literally "not a versioned resource") is already present in
> 
>   $ svn --version
>   svn, Version 1.4.6 (r28521)
> 
> (He also says the error is the same if the file does not exist at
> all.)

Interesting.

> So should we just change all "unknown foo" tests to verify that 'git
> svn info' errors out too?

Yes, I see no reason to differ from plain svn here.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 0/2] *** SUBJECT HERE ***
  2008-08-29  8:16     ` Eric Wong
@ 2008-08-29 13:42       ` Thomas Rast
  2008-08-29 13:42         ` [PATCH 1/2] git-svn: match SVN 1.5 behaviour of info' on unknown item Thomas Rast
  2008-08-30  1:03         ` [PATCH 0/2] 'git svn info' fixes Eric Wong
  0 siblings, 2 replies; 18+ messages in thread
From: Thomas Rast @ 2008-08-29 13:42 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Eric Wong wrote.
> > So should we just change all "unknown foo" tests to verify that 'git
> > svn info' errors out too?
>
> Yes, I see no reason to differ from plain svn here.

This starts getting more complicated at every turn.  The included
mini-series (probably textually depends on the other 6 patches though)
"fixes" this.

HOWEVER: Subversion itself broke compatibility here.  In 1.4:

  $ svn info new; echo $?
  new:  (Not a versioned resource)

  0

Note the extra linebreak and successful exit.  Current git-svn
precisely matches this output.  In 1.5, it's different:

  $ svn info new; echo $?
  svn: 'new' is not under version control
  1

While it is of course up to you what you would like to do (and modulo
test_must_fail, 2/2 can still be used to fix the tests if you decide
to reject 1/2), I suggest changing to 1.5 behaviour.  exit(1) is the
sane thing to do in this case, and that is already breaking
bit-for-bit compatibility with SVN 1.4, so we might as well adopt the
new error message.  Of course this prevents us from comparing the
output literally in the tests, so I settled for a slightly weaker
check: failure status and mention of the filename.

Unfortunately this does raise the question whether the URL-encoding
issue treated in the other series is in fact a similar incompatibility
between 1.4 and 1.5, not a (minor but long-standing) bug in git-svn.

- Thomas


 git-svn.perl            |    4 +-
 t/t9119-git-svn-info.sh |   73 ++++++++++++++++-------------------------------
 2 files changed, 27 insertions(+), 50 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2] git-svn: match SVN 1.5 behaviour of info' on unknown item
  2008-08-29 13:42       ` [PATCH 0/2] *** SUBJECT HERE *** Thomas Rast
@ 2008-08-29 13:42         ` Thomas Rast
  2008-08-29 13:42           ` [PATCH 2/2] git-svn: fix 'info' tests for unknown items Thomas Rast
  2008-08-30  1:03         ` [PATCH 0/2] 'git svn info' fixes Eric Wong
  1 sibling, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-08-29 13:42 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

Previously 'git svn info unknown-file' only announced its failure (in
the SVN 1.4 style, "not a versioned resource"), and exited
successfully.

It is desirable to actually exit with failure, so change the code to
exit(1) under this condition.  Since that is already halfway SVN 1.5
compatibility, also change the error output to match 1.5.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 git-svn.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 11ff813..bc181e0 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -832,8 +832,8 @@ sub cmd_info {
 	my ($file_type, $diff_status) = find_file_type_and_diff_status($path);
 
 	if (!$file_type && !$diff_status) {
-		print STDERR "$path:  (Not a versioned resource)\n\n";
-		return;
+		print STDERR "svn: '$path' is not under version control\n";
+		exit 1;
 	}
 
 	my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
-- 
1.6.0.1.98.g76a24

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] git-svn: fix 'info' tests for unknown items
  2008-08-29 13:42         ` [PATCH 1/2] git-svn: match SVN 1.5 behaviour of info' on unknown item Thomas Rast
@ 2008-08-29 13:42           ` Thomas Rast
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Rast @ 2008-08-29 13:42 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Junio C Hamano

The previous tests all expected the results from SVN and Git to be
identical, and expected both to return success.  This cannot be
guaranteed: SVN changed the message style between 1.4 and 1.5, and
in 1.5, sets a failure exit code.

Change the tests to verify that 'git svn info <item>' sets a failure
exit code, and that its output contains the file name.  This should
hopefully catch all other errors.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t9119-git-svn-info.sh |   73 ++++++++++++++++-------------------------------
 1 files changed, 25 insertions(+), 48 deletions(-)

diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 1811010..3e48459 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -319,82 +319,59 @@ test_expect_success 'info --url symlink-directory (deleted)' '
 
 test_expect_success 'info unknown-file' "
 	echo two > gitwc/unknown-file &&
-	cp gitwc/unknown-file svnwc/unknown-file &&
-	ptouch gitwc/unknown-file svnwc/unknown-file &&
-	(cd svnwc; svn info unknown-file) 2> expected.info-unknown-file &&
-	(cd gitwc; git-svn info unknown-file) 2> actual.info-unknown-file &&
-	test_cmp expected.info-unknown-file actual.info-unknown-file
+	(cd gitwc; test_must_fail git-svn info unknown-file) \
+		 2> actual.info-unknown-file &&
+	grep unknown-file actual.info-unknown-file
 	"
 
 test_expect_success 'info --url unknown-file' '
-	test -z "$(cd gitwc; git-svn info --url unknown-file \
-			2> ../actual.info--url-unknown-file)" &&
-	test_cmp expected.info-unknown-file actual.info--url-unknown-file
+	echo two > gitwc/unknown-file &&
+	(cd gitwc; test_must_fail git-svn info --url unknown-file) \
+		 2> actual.info-url-unknown-file &&
+	grep unknown-file actual.info-url-unknown-file
 	'
 
 test_expect_success 'info unknown-directory' "
 	mkdir gitwc/unknown-directory svnwc/unknown-directory &&
-	ptouch gitwc/unknown-directory svnwc/unknown-directory &&
-	touch gitwc/unknown-directory/.placeholder &&
-	(cd svnwc; svn info unknown-directory) \
-		2> expected.info-unknown-directory &&
-	(cd gitwc; git-svn info unknown-directory) \
-		2> actual.info-unknown-directory &&
-	test_cmp expected.info-unknown-directory actual.info-unknown-directory
+	(cd gitwc; test_must_fail git-svn info unknown-directory) \
+		 2> actual.info-unknown-directory &&
+	grep unknown-directory actual.info-unknown-directory
 	"
 
 test_expect_success 'info --url unknown-directory' '
-	test -z "$(cd gitwc; git-svn info --url unknown-directory \
-			2> ../actual.info--url-unknown-directory)" &&
-	test_cmp expected.info-unknown-directory \
-		 actual.info--url-unknown-directory
+	(cd gitwc; test_must_fail git-svn info --url unknown-directory) \
+		 2> actual.info-url-unknown-directory &&
+	grep unknown-directory actual.info-url-unknown-directory
 	'
 
 test_expect_success 'info unknown-symlink-file' "
 	cd gitwc &&
 		ln -s unknown-file unknown-symlink-file &&
 	cd .. &&
-	cd svnwc &&
-		ln -s unknown-file unknown-symlink-file &&
-	cd .. &&
-	ptouch gitwc/unknown-symlink-file svnwc/unknown-symlink-file &&
-	(cd svnwc; svn info unknown-symlink-file) \
-		2> expected.info-unknown-symlink-file &&
-	(cd gitwc; git-svn info unknown-symlink-file) \
-		2> actual.info-unknown-symlink-file &&
-	test_cmp expected.info-unknown-symlink-file \
-		 actual.info-unknown-symlink-file
+	(cd gitwc; test_must_fail git-svn info unknown-symlink-file) \
+		 2> actual.info-unknown-symlink-file &&
+	grep unknown-symlink-file actual.info-unknown-symlink-file
 	"
 
 test_expect_success 'info --url unknown-symlink-file' '
-	test -z "$(cd gitwc; git-svn info --url unknown-symlink-file \
-			2> ../actual.info--url-unknown-symlink-file)" &&
-	test_cmp expected.info-unknown-symlink-file \
-		 actual.info--url-unknown-symlink-file
+	(cd gitwc; test_must_fail git-svn info --url unknown-symlink-file) \
+		 2> actual.info-url-unknown-symlink-file &&
+	grep unknown-symlink-file actual.info-url-unknown-symlink-file
 	'
 
 test_expect_success 'info unknown-symlink-directory' "
 	cd gitwc &&
 		ln -s unknown-directory unknown-symlink-directory &&
 	cd .. &&
-	cd svnwc &&
-		ln -s unknown-directory unknown-symlink-directory &&
-	cd .. &&
-	ptouch gitwc/unknown-symlink-directory \
-	       svnwc/unknown-symlink-directory &&
-	(cd svnwc; svn info unknown-symlink-directory) \
-		2> expected.info-unknown-symlink-directory &&
-	(cd gitwc; git-svn info unknown-symlink-directory) \
-		2> actual.info-unknown-symlink-directory &&
-	test_cmp expected.info-unknown-symlink-directory \
-		 actual.info-unknown-symlink-directory
+	(cd gitwc; test_must_fail git-svn info unknown-symlink-directory) \
+		 2> actual.info-unknown-symlink-directory &&
+	grep unknown-symlink-directory actual.info-unknown-symlink-directory
 	"
 
 test_expect_success 'info --url unknown-symlink-directory' '
-	test -z "$(cd gitwc; git-svn info --url unknown-symlink-directory \
-			2> ../actual.info--url-unknown-symlink-directory)" &&
-	test_cmp expected.info-unknown-symlink-directory \
-		 actual.info--url-unknown-symlink-directory
+	(cd gitwc; test_must_fail git-svn info --url unknown-symlink-directory) \
+		 2> actual.info-url-unknown-symlink-directory &&
+	grep unknown-symlink-directory actual.info-url-unknown-symlink-directory
 	'
 
 test_done
-- 
1.6.0.1.98.g76a24

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/2] 'git svn info' fixes
  2008-08-29 13:42       ` [PATCH 0/2] *** SUBJECT HERE *** Thomas Rast
  2008-08-29 13:42         ` [PATCH 1/2] git-svn: match SVN 1.5 behaviour of info' on unknown item Thomas Rast
@ 2008-08-30  1:03         ` Eric Wong
  2008-09-01  9:46           ` Thomas Rast
  1 sibling, 1 reply; 18+ messages in thread
From: Eric Wong @ 2008-08-30  1:03 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano

Thomas Rast <trast@student.ethz.ch> wrote:
> Eric Wong wrote.
> > > So should we just change all "unknown foo" tests to verify that 'git
> > > svn info' errors out too?
> >
> > Yes, I see no reason to differ from plain svn here.
> 
> This starts getting more complicated at every turn.  The included
> mini-series (probably textually depends on the other 6 patches though)
> "fixes" this.
> 
> HOWEVER: Subversion itself broke compatibility here.  In 1.4:
> 
>   $ svn info new; echo $?
>   new:  (Not a versioned resource)
> 
>   0
> 
> Note the extra linebreak and successful exit.  Current git-svn
> precisely matches this output.  In 1.5, it's different:
> 
>   $ svn info new; echo $?
>   svn: 'new' is not under version control
>   1
> 
> While it is of course up to you what you would like to do (and modulo
> test_must_fail, 2/2 can still be used to fix the tests if you decide
> to reject 1/2), I suggest changing to 1.5 behaviour.  exit(1) is the
> sane thing to do in this case, and that is already breaking
> bit-for-bit compatibility with SVN 1.4, so we might as well adopt the
> new error message.  Of course this prevents us from comparing the
> output literally in the tests, so I settled for a slightly weaker
> check: failure status and mention of the filename.

Yes.  Please maintain compatibility with svn 1.5.  The current version
of git-svn should strive to maintain compatibility with the current
version of svn whenever possible.

> Unfortunately this does raise the question whether the URL-encoding
> issue treated in the other series is in fact a similar incompatibility
> between 1.4 and 1.5, not a (minor but long-standing) bug in git-svn.

It should match svn 1.5 for "git svn info".

Since "git svn info --url" is a git-svn-only thing, whatever makes the
most sense from a command-line scripting perspective (I don't have time
to check against a real repo right now):

For git-svn info --url, just want things like:

	svn log -v `git svn info --url`

	svn cp `git svn info --url` \
               `git svn info --url | sed -e 's,/trunk,/tags/1.0,'`

	svn rm `git svn info --url`

to just work.

I seem to recall the rules being slightly different for http(s):// and
(file://|svn://) URLs with the command-line client; but my memory may
just be fuzzy...

Thanks for looking into this!

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/2] 'git svn info' fixes
  2008-08-30  1:03         ` [PATCH 0/2] 'git svn info' fixes Eric Wong
@ 2008-09-01  9:46           ` Thomas Rast
  2008-09-01 22:58             ` Eric Wong
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Rast @ 2008-09-01  9:46 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]

Eric Wong wrote:
> Yes.  Please maintain compatibility with svn 1.5.  The current version
> of git-svn should strive to maintain compatibility with the current
> version of svn whenever possible.

Ok, that certainly clarifies the goal.

> > Unfortunately this does raise the question whether the URL-encoding
> > issue treated in the other series is in fact a similar incompatibility
> > between 1.4 and 1.5, not a (minor but long-standing) bug in git-svn.
> 
> It should match svn 1.5 for "git svn info".
[...]
> 	svn log -v `git svn info --url`
> [should] just work.
> 
> I seem to recall the rules being slightly different for http(s):// and
> (file://|svn://) URLs with the command-line client; but my memory may
> just be fuzzy...

I've finally found a system with SVN 1.4 that I have access to, and
ran a few tests.  I don't have svn:// servers with weird directory
names at hand, but I could verify that even SVN 1.4 quotes output and
requires the input to be properly quoted:

  $ svn info
  Path: .
  URL: file:///home/thomas/test%20directory%3F
  Repository Root: file:///home/thomas/test%20directory%3F
  [...]

  $ svn info file:///home/thomas/test%20directory%3F
  Path: test directory?
  URL: file:///home/thomas/test%20directory%3F
  Repository Root: file:///home/thomas/test%20directory%3F
  [...]

  $ svn info file:///home/thomas/'test directory?'
  svn: URL 'file:///home/thomas/test directory?' is not properly URI-encoded

Variations with https:// and SVN 1.5 give the same results.  So unless
I'm missing something, the two patch series are needed to get the
correct output.

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/2] 'git svn info' fixes
  2008-09-01  9:46           ` Thomas Rast
@ 2008-09-01 22:58             ` Eric Wong
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Wong @ 2008-09-01 22:58 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano

Thomas Rast <trast@student.ethz.ch> wrote:
> Eric Wong wrote:
> > Yes.  Please maintain compatibility with svn 1.5.  The current version
> > of git-svn should strive to maintain compatibility with the current
> > version of svn whenever possible.
> 
> Ok, that certainly clarifies the goal.
> 
> > > Unfortunately this does raise the question whether the URL-encoding
> > > issue treated in the other series is in fact a similar incompatibility
> > > between 1.4 and 1.5, not a (minor but long-standing) bug in git-svn.
> > 
> > It should match svn 1.5 for "git svn info".
> [...]
> > 	svn log -v `git svn info --url`
> > [should] just work.
> > 
> > I seem to recall the rules being slightly different for http(s):// and
> > (file://|svn://) URLs with the command-line client; but my memory may
> > just be fuzzy...
> 
> I've finally found a system with SVN 1.4 that I have access to, and
> ran a few tests.  I don't have svn:// servers with weird directory
> names at hand, but I could verify that even SVN 1.4 quotes output and
> requires the input to be properly quoted:
> 
>   $ svn info
>   Path: .
>   URL: file:///home/thomas/test%20directory%3F
>   Repository Root: file:///home/thomas/test%20directory%3F
>   [...]
> 
>   $ svn info file:///home/thomas/test%20directory%3F
>   Path: test directory?
>   URL: file:///home/thomas/test%20directory%3F
>   Repository Root: file:///home/thomas/test%20directory%3F
>   [...]
> 
>   $ svn info file:///home/thomas/'test directory?'
>   svn: URL 'file:///home/thomas/test directory?' is not properly URI-encoded
> 
> Variations with https:// and SVN 1.5 give the same results.  So unless
> I'm missing something, the two patch series are needed to get the
> correct output.

Thank you very much for the fixes an analysis.  This series acked and
pushed out to git://git.bogomips.org/git-svn.git

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 0/2] *** SUBJECT HERE ***
@ 2009-06-08  4:31 Junio C Hamano
  0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-06-08  4:31 UTC (permalink / raw)
  To: git

*** BLURB HERE ***

Junio C Hamano (1):
  Makefile: test-parse-options depends on parse-options.h

Kjetil Barvik (1):
  symlinks.c: small style cleanup

 Makefile   |    2 ++
 symlinks.c |    6 ++----
 2 files changed, 4 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-06-08  4:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-26 19:32 [PATCH 0/6] 'git svn info' fixes Thomas Rast
2008-08-26 19:32 ` [PATCH 1/6] git svn info: tests: let 'init' test run with SVN 1.5 Thomas Rast
2008-08-26 19:32   ` [PATCH 2/6] git svn info: tests: do not use set -e Thomas Rast
2008-08-26 19:32     ` [PATCH 3/6] git svn info: tests: use test_cmp instead of git-diff Thomas Rast
2008-08-26 19:32       ` [PATCH 4/6] git svn info: tests: fix ptouch argument order in setup Thomas Rast
2008-08-26 19:32         ` [PATCH 5/6] git svn info: make info relative to the current directory Thomas Rast
2008-08-26 19:32           ` [PATCH 6/6] git svn info: always quote URLs in 'info' output Thomas Rast
2008-08-27  9:43             ` Eric Wong
2008-08-27  9:53 ` [PATCH 0/6] 'git svn info' fixes Eric Wong
2008-08-28  8:30   ` Thomas Rast
2008-08-29  8:16     ` Eric Wong
2008-08-29 13:42       ` [PATCH 0/2] *** SUBJECT HERE *** Thomas Rast
2008-08-29 13:42         ` [PATCH 1/2] git-svn: match SVN 1.5 behaviour of info' on unknown item Thomas Rast
2008-08-29 13:42           ` [PATCH 2/2] git-svn: fix 'info' tests for unknown items Thomas Rast
2008-08-30  1:03         ` [PATCH 0/2] 'git svn info' fixes Eric Wong
2008-09-01  9:46           ` Thomas Rast
2008-09-01 22:58             ` Eric Wong
2009-06-08  4:31 [PATCH 0/2] *** SUBJECT HERE *** Junio C Hamano

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).