All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] remote-svn-alpha updates
@ 2011-07-05 16:45 Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 1/5] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

Most notable for this series is adding some tests for
remote-svn-alpha helper and not (over)writing refs/heads/master.

The helper is able to import whole svn repository root as the only
remote branch. But it doesn't reuse any previously imported data,
i.e. each time whole history is imported. Also it can't yet push,
and can't configure svn username other than Guest and password
other than empty.

Works both in git clone and git remote add & git fetch scenarios.
$ git clone -b master svn-alpha::http://some.org/svnrepo
"-b master" tells to use remote branch master as a local HEAD to
be checked out. This is necessary because the helper can't tell
git that HEAD is a "symlink" to refs/heads/master and even can't
tell it's sha1 (lists it as "? HEAD") before actually importing.
$ git remote add svn svn-alpha::http://some.org/svnrepo
$ git fetch svn

Known bugs are:
1) absolutely empty (no r1) svn repo import fails
2) git clone needs either --bare, -n or -b master

The patch base is svn-fe-pu at git://repo.or.cz/git/jrn.git
also a commit 7153183171de77d084a4c24ef19d23d6313ded2a can be used
as an earlier patch base.

For the last two commits some new svn-fe options[1] are required.

Whole git-remote-svn-alpha and a test script are cited at the bottom
of this letter as a quick reference for those who don't track svn-fe-pu.

[1] http://thread.gmane.org/gmane.comp.version-control.git/176578

Dmitry Ivankov (5):
  svn-fe: use svnrdump --quiet in remote-svn-alpha
  svn-fe: allow svnadmin instead of svnrdump in svn helper
  svn-fe: add a test for remote-svn-alpha
  svn-fe: use svn-fe --no-progress in remote-svn-alpha
  svn-fe: use proper refspec in remote-svn-alpha

 contrib/svn-fe/git-remote-svn-alpha        |   42 ++++-
 contrib/svn-fe/t/.gitignore                |    3 +
 contrib/svn-fe/t/t9010-remote-svn-alpha.sh |  238 ++++++++++++++++++++++++++++
 3 files changed, 274 insertions(+), 9 deletions(-)
 create mode 100644 contrib/svn-fe/t/.gitignore
 create mode 100755 contrib/svn-fe/t/t9010-remote-svn-alpha.sh

-- 
1.7.3.4

diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
new file mode 100755
index 0000000..d4b90ae
--- /dev/null
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -0,0 +1,79 @@
+#!/bin/bash
+set -o pipefail
+set -e
+
+die () {
+	printf >&2 'fatal: %s\n' "$*"
+	exit 128
+}
+
+usage () {
+	printf >&2 'usage: %s\n' "$*"
+	exit 129
+}
+
+try_svnrdump () {
+	command -v svnrdump >/dev/null &&
+	echo "svnrdump dump --non-interactive --username=Guest --password= \
+		--quiet --incremental" ||
+	true
+}
+
+svnadmin_wrap () {
+	path=${1##file://} &&
+	test "z$path" != "z$1" &&
+	svnadmin dump --incremental --deltas --quiet "$path" "$2"
+}
+
+try_svnadmin () {
+	command -v svnadmin >/dev/null &&
+	echo svnadmin_wrap ||
+	true
+}
+
+SVNDUMP=""
+SVNDUMP=${SVNDUMP:-`try_svnrdump`}
+SVNDUMP=${SVNDUMP:-`try_svnadmin`}
+
+do_import () {
+	revs=$1 url=$2 dst=$3
+	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --ref="$dst" --no-progress) 3<&0 || die "FAILURE"
+	exec 1>&-
+}
+
+test "${2+set}" ||
+usage 'git remote-svn-alpha <repository> <URL> < commandlist'
+repo=$1
+url=$2
+need_import=""
+remote_ref="refs/heads/master"
+private_ref="refs/svn-alpha/$repo/SVNHEAD"
+
+while read -r cmd args
+do
+	case $cmd in
+	capabilities)
+		echo import
+		echo "refspec HEAD:$private_ref"
+		echo "refspec $remote_ref:$private_ref"
+		echo
+		;;
+	list)
+		echo "? HEAD"
+		echo "? $remote_ref"
+		echo
+		;;
+	import)
+		test "$args" = "HEAD" || test "$args" = "$remote_ref" ||
+		die "remote-svn-alpha: unsupported import ref argument: $args"
+		need_import="yes"
+		;;
+	'')
+		test "$need_import" = "yes" || exit 0
+		do_import 0:HEAD "$url" "$private_ref"
+		need_import=""
+		;;
+	*)
+		die "remote-svn-alpha: unsupported command: $cmd $args"
+	esac
+done
diff --git a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
new file mode 100755
index 0000000..786cc1f
--- /dev/null
+++ b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
@@ -0,0 +1,238 @@
+#!/bin/sh
+
+test_description='check svn-alpha remote helper'
+
+PATH=$(pwd)/..:$PATH
+TEST_DIRECTORY=$(pwd)/../../../t
+. $TEST_DIRECTORY/test-lib.sh
+
+if command -v svnrdump >/dev/null; then
+	test_set_prereq SVNRDUMP
+fi
+
+deinit_git () {
+	rm -fr .git
+}
+
+reinit_git () {
+	deinit_git &&
+	git init
+}
+
+properties () {
+	while test "$#" -ne 0
+	do
+		property="$1" &&
+		value="$2" &&
+		printf "%s\n" "K ${#property}" &&
+		printf "%s\n" "$property" &&
+		printf "%s\n" "V ${#value}" &&
+		printf "%s\n" "$value" &&
+		shift 2 ||
+		return 1
+	done
+}
+
+text_no_props () {
+	text="$1
+" &&
+	printf "%s\n" "Prop-content-length: 10" &&
+	printf "%s\n" "Text-content-length: ${#text}" &&
+	printf "%s\n" "Content-length: $((${#text} + 10))" &&
+	printf "%s\n" "" "PROPS-END" &&
+	printf "%s\n" "$text"
+}
+
+dump_to_svnrepo_uuid () {
+	dump="$1" &&
+	path="$2" &&
+	uuid="$3" &&
+	svnadmin create "$path" &&
+	svnadmin load "$path" < "$dump" &&
+	eval "svnadmin setuuid \"$path\" $uuid"
+}
+
+dump_to_svnrepo () {
+	dump_to_svnrepo_uuid "$1" "$2" ""
+}
+
+svnurl () {
+	printf "svn-alpha::file://%s/%s" "$(pwd)" "$1"
+}
+
+test_expect_success 'svnadmin is present' '
+	command -v svnadmin &&
+	test_set_prereq SVNADMIN
+'
+
+test_expect_success SVNADMIN 'create empty svnrepo' '
+	echo "SVN-fs-dump-format-version: 2" > empty.dump &&
+	dump_to_svnrepo empty.dump empty.svn &&
+	test_set_prereq EMPTY_SVN
+'
+
+test_expect_success SVNADMIN 'create tiny svnrepo' '
+	{
+		properties \
+			svn:author author@example.com \
+			svn:date "1999-02-01T00:01:002.000000Z" \
+			svn:log "add directory with some files in it" &&
+		echo PROPS-END
+	} >props &&
+	{
+		cat <<-EOF &&
+		SVN-fs-dump-format-version: 3
+
+		Revision-number: 1
+		EOF
+		echo Prop-content-length: $(wc -c <props) &&
+		echo Content-length: $(wc -c <props) &&
+		echo &&
+		cat props &&
+		cat <<-\EOF &&
+
+		Node-path: directory
+		Node-kind: dir
+		Node-action: add
+		Prop-content-length: 10
+		Content-length: 10
+
+		PROPS-END
+		Node-path: directory/somefile
+		Node-kind: file
+		Node-action: add
+		EOF
+		text_no_props hi
+	} >tiny.dump &&
+	dump_to_svnrepo tiny.dump tiny.svn &&
+	test_set_prereq TINY_SVN
+'
+
+test_expect_success SVNADMIN 'create small svndump' '
+	{
+		properties \
+			svn:author author@example.com \
+			svn:date "1999-02-01T00:01:002.000000Z" \
+			svn:log "add directory with some files in it" &&
+		echo PROPS-END
+	} >props &&
+	cat >small.dump.r0 <<-EOF &&
+	SVN-fs-dump-format-version: 3
+	EOF
+	for x in `seq 1 1 10`; do
+		{
+			echo &&
+			echo "Revision-number: $x" &&
+			echo Prop-content-length: $(wc -c <props) &&
+			echo Content-length: $(wc -c <props) &&
+			echo &&
+			cat props &&
+			if test "$x" -eq "1"; then
+				cat <<-\EOF
+
+				Node-path: directory
+				Node-kind: dir
+				Node-action: add
+				Prop-content-length: 10
+				Content-length: 10
+
+				PROPS-END
+
+				EOF
+			fi
+			echo "Node-path: directory/somefile$x" &&
+			echo "Node-kind: file" &&
+			echo "Node-action: add" &&
+			text_no_props hi
+		} >small.dump.r$x
+	done &&
+	test_set_prereq SMALL_SVNDUMP
+'
+
+test_expect_success SMALL_SVNDUMP 'create small svnrepo' '
+	uuid="19fe5d53-e0aa-44a8-8179-255e62a5445c" &&
+	cat small.dump.r0 >small.dump &&
+	for x in `seq 1 1 10`; do
+		cat small.dump.r$x >>small.dump &&
+		dump_to_svnrepo_uuid small.dump small.svn.r0-$x "$uuid"
+	done &&
+	dump_to_svnrepo_uuid small.dump small.svn "$uuid" &&
+	test_set_prereq SMALL_SVN
+'
+
+test_expect_failure EMPTY_SVN 'fetch empty' '
+	reinit_git &&
+	url=$(svnurl empty.svn) &&
+	git remote add svn "$url" &&
+	git fetch svn
+'
+
+test_expect_failure TINY_SVN 'clone tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone "$url" tiny1.git
+'
+
+test_expect_success TINY_SVN 'clone --mirror tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone --mirror "$url" tiny2.git
+'
+
+test_expect_success TINY_SVN 'clone --bare tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone --mirror "$url" tiny3.git
+'
+
+test_expect_success TINY_SVN 'clone -b master tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone -b master "$url" tiny4.git
+'
+
+test_expect_success SMALL_SVN 'clone -b master small' '
+	deinit_git &&
+	url=$(svnurl small.svn) &&
+	git clone -b master "$url" small.git
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path' '
+	deinit_git &&
+	url=$(svnurl small.svn)/directory &&
+	git clone -b master "$url" small_dir.git
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path/file' '
+	deinit_git &&
+	url=$(svnurl small.svn)/directory/somefile3 &&
+	git clone -b master "$url" small_dir_file.git
+'
+
+test_expect_success SMALL_SVN 'fetch each rev of SMALL separately' '
+	reinit_git &&
+	url=$(svnurl small.svn) &&
+
+	for x in `seq 1 1 10`; do
+		git remote add svn_$x "$url.r0-$x"
+	done &&
+	git remote update &&
+
+	git remote add svn "$url" &&
+	git fetch svn &&
+
+	git rev-parse -s remotes/svn_7/master~5 >ref7_2 &&
+	git rev-parse -s remotes/svn/master~8 >ref_2 &&
+	test_cmp ref7_2 ref_2
+'
+
+test_expect_success TINY_SVN 'fetch TINY does not write to refs/heads/master' '
+	reinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git remote add svn "$url" &&
+	git fetch svn &&
+	git show-ref --verify refs/remotes/svn/master &&
+	test_must_fail git show-ref --verify refs/heads/master
+'
+
+test_done

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

* [PATCH 1/5] svn-fe: use svnrdump --quiet in remote-svn-alpha
  2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
@ 2011-07-05 16:45 ` Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper Dmitry Ivankov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

svnrdump by default shows "Dumped revision #n" lines on stderr.
svn-fe does it too on each imported revision, so pass --quiet to
svnrdump. Once process indication is really needed it will be
custom formatted in either svn-fe or remote-svn-alpha.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/git-remote-svn-alpha |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index b2cca9f..61c9b07 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -15,7 +15,7 @@ usage () {
 do_import () {
 	revs=$1 url=$2
 	(svnrdump dump --non-interactive --username=Guest --password= \
-		-r"$revs" "$url" | svn-fe) 3<&0 || die "FAILURE"
+		-r"$revs" "$url" --quiet | svn-fe) 3<&0 || die "FAILURE"
 	exec 1>&-
 }
 
-- 
1.7.3.4

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

* [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
  2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 1/5] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
@ 2011-07-05 16:45 ` Dmitry Ivankov
  2011-07-06 10:12   ` Ramkumar Ramachandra
  2011-07-05 16:45 ` [PATCH 3/5] svn-fe: add a test for remote-svn-alpha Dmitry Ivankov
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

svnrdump produces the same stream as svnadmin dump. svnrdump is able
to do it via any svn remote protocol while svnadmin needs access to
the repository filesystem and can't produce subdirectory dumps.
But svnrdump is a newer tool and may be unavailable on some systems.

Try to use svnadmin dump for file:// repository urls if there is no
svnrdump in the PATH. First of all this is to be used in tests, where
the repository is indeed local most of the time.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/git-remote-svn-alpha |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index 61c9b07..84d841e 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -12,10 +12,32 @@ usage () {
 	exit 129
 }
 
+try_svnrdump () {
+	command -v svnrdump >/dev/null &&
+	echo "svnrdump dump --non-interactive --username=Guest --password= \
+		--quiet --incremental" ||
+	true
+}
+
+svnadmin_wrap () {
+	path=${1##file://} &&
+	test "z$path" != "z$1" &&
+	svnadmin dump --incremental --deltas --quiet "$path" "$2"
+}
+
+try_svnadmin () {
+	command -v svnadmin >/dev/null &&
+	echo svnadmin_wrap ||
+	true
+}
+
+SVNDUMP=""
+SVNDUMP=${SVNDUMP:-`try_svnrdump`}
+SVNDUMP=${SVNDUMP:-`try_svnadmin`}
+
 do_import () {
 	revs=$1 url=$2
-	(svnrdump dump --non-interactive --username=Guest --password= \
-		-r"$revs" "$url" --quiet | svn-fe) 3<&0 || die "FAILURE"
+	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe) 3<&0 || die "FAILURE"
 	exec 1>&-
 }
 
-- 
1.7.3.4

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

* [PATCH 3/5] svn-fe: add a test for remote-svn-alpha
  2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 1/5] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper Dmitry Ivankov
@ 2011-07-05 16:45 ` Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha Dmitry Ivankov
  2011-07-05 16:45 ` [PATCH 5/5] svn-fe: use proper refspec " Dmitry Ivankov
  4 siblings, 0 replies; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

The test creates a few svn repositories from fixed dumps using svnadmin.
Currently it checks for crashes on first time import mostly.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/t/.gitignore                |    3 +
 contrib/svn-fe/t/t9010-remote-svn-alpha.sh |  229 ++++++++++++++++++++++++++++
 2 files changed, 232 insertions(+), 0 deletions(-)
 create mode 100644 contrib/svn-fe/t/.gitignore
 create mode 100755 contrib/svn-fe/t/t9010-remote-svn-alpha.sh

diff --git a/contrib/svn-fe/t/.gitignore b/contrib/svn-fe/t/.gitignore
new file mode 100644
index 0000000..4e731dc
--- /dev/null
+++ b/contrib/svn-fe/t/.gitignore
@@ -0,0 +1,3 @@
+/trash directory*
+/test-results
+/.prove
diff --git a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
new file mode 100755
index 0000000..30dc726
--- /dev/null
+++ b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
@@ -0,0 +1,229 @@
+#!/bin/sh
+
+test_description='check svn-alpha remote helper'
+
+PATH=$(pwd)/..:$PATH
+TEST_DIRECTORY=$(pwd)/../../../t
+. $TEST_DIRECTORY/test-lib.sh
+
+if command -v svnrdump >/dev/null; then
+	test_set_prereq SVNRDUMP
+fi
+
+deinit_git () {
+	rm -fr .git
+}
+
+reinit_git () {
+	deinit_git &&
+	git init
+}
+
+properties () {
+	while test "$#" -ne 0
+	do
+		property="$1" &&
+		value="$2" &&
+		printf "%s\n" "K ${#property}" &&
+		printf "%s\n" "$property" &&
+		printf "%s\n" "V ${#value}" &&
+		printf "%s\n" "$value" &&
+		shift 2 ||
+		return 1
+	done
+}
+
+text_no_props () {
+	text="$1
+" &&
+	printf "%s\n" "Prop-content-length: 10" &&
+	printf "%s\n" "Text-content-length: ${#text}" &&
+	printf "%s\n" "Content-length: $((${#text} + 10))" &&
+	printf "%s\n" "" "PROPS-END" &&
+	printf "%s\n" "$text"
+}
+
+dump_to_svnrepo_uuid () {
+	dump="$1" &&
+	path="$2" &&
+	uuid="$3" &&
+	svnadmin create "$path" &&
+	svnadmin load "$path" < "$dump" &&
+	eval "svnadmin setuuid \"$path\" $uuid"
+}
+
+dump_to_svnrepo () {
+	dump_to_svnrepo_uuid "$1" "$2" ""
+}
+
+svnurl () {
+	printf "svn-alpha::file://%s/%s" "$(pwd)" "$1"
+}
+
+test_expect_success 'svnadmin is present' '
+	command -v svnadmin &&
+	test_set_prereq SVNADMIN
+'
+
+test_expect_success SVNADMIN 'create empty svnrepo' '
+	echo "SVN-fs-dump-format-version: 2" > empty.dump &&
+	dump_to_svnrepo empty.dump empty.svn &&
+	test_set_prereq EMPTY_SVN
+'
+
+test_expect_success SVNADMIN 'create tiny svnrepo' '
+	{
+		properties \
+			svn:author author@example.com \
+			svn:date "1999-02-01T00:01:002.000000Z" \
+			svn:log "add directory with some files in it" &&
+		echo PROPS-END
+	} >props &&
+	{
+		cat <<-EOF &&
+		SVN-fs-dump-format-version: 3
+
+		Revision-number: 1
+		EOF
+		echo Prop-content-length: $(wc -c <props) &&
+		echo Content-length: $(wc -c <props) &&
+		echo &&
+		cat props &&
+		cat <<-\EOF &&
+
+		Node-path: directory
+		Node-kind: dir
+		Node-action: add
+		Prop-content-length: 10
+		Content-length: 10
+
+		PROPS-END
+		Node-path: directory/somefile
+		Node-kind: file
+		Node-action: add
+		EOF
+		text_no_props hi
+	} >tiny.dump &&
+	dump_to_svnrepo tiny.dump tiny.svn &&
+	test_set_prereq TINY_SVN
+'
+
+test_expect_success SVNADMIN 'create small svndump' '
+	{
+		properties \
+			svn:author author@example.com \
+			svn:date "1999-02-01T00:01:002.000000Z" \
+			svn:log "add directory with some files in it" &&
+		echo PROPS-END
+	} >props &&
+	cat >small.dump.r0 <<-EOF &&
+	SVN-fs-dump-format-version: 3
+	EOF
+	for x in `seq 1 1 10`; do
+		{
+			echo &&
+			echo "Revision-number: $x" &&
+			echo Prop-content-length: $(wc -c <props) &&
+			echo Content-length: $(wc -c <props) &&
+			echo &&
+			cat props &&
+			if test "$x" -eq "1"; then
+				cat <<-\EOF
+
+				Node-path: directory
+				Node-kind: dir
+				Node-action: add
+				Prop-content-length: 10
+				Content-length: 10
+
+				PROPS-END
+
+				EOF
+			fi
+			echo "Node-path: directory/somefile$x" &&
+			echo "Node-kind: file" &&
+			echo "Node-action: add" &&
+			text_no_props hi
+		} >small.dump.r$x
+	done &&
+	test_set_prereq SMALL_SVNDUMP
+'
+
+test_expect_success SMALL_SVNDUMP 'create small svnrepo' '
+	uuid="19fe5d53-e0aa-44a8-8179-255e62a5445c" &&
+	cat small.dump.r0 >small.dump &&
+	for x in `seq 1 1 10`; do
+		cat small.dump.r$x >>small.dump &&
+		dump_to_svnrepo_uuid small.dump small.svn.r0-$x "$uuid"
+	done &&
+	dump_to_svnrepo_uuid small.dump small.svn "$uuid" &&
+	test_set_prereq SMALL_SVN
+'
+
+test_expect_failure EMPTY_SVN 'fetch empty' '
+	reinit_git &&
+	url=$(svnurl empty.svn) &&
+	git remote add svn "$url" &&
+	git fetch svn
+'
+
+test_expect_failure TINY_SVN 'clone tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone "$url" tiny1.git
+'
+
+test_expect_success TINY_SVN 'clone --mirror tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone --mirror "$url" tiny2.git
+'
+
+test_expect_success TINY_SVN 'clone --bare tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone --mirror "$url" tiny3.git
+'
+
+test_expect_success TINY_SVN 'clone -b master tiny' '
+	deinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git clone -b master "$url" tiny4.git
+'
+
+test_expect_success SMALL_SVN 'clone -b master small' '
+	deinit_git &&
+	url=$(svnurl small.svn) &&
+	git clone -b master "$url" small.git
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path' '
+	deinit_git &&
+	url=$(svnurl small.svn)/directory &&
+	git clone -b master "$url" small_dir.git
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path/file' '
+	deinit_git &&
+	url=$(svnurl small.svn)/directory/somefile3 &&
+	git clone -b master "$url" small_dir_file.git
+'
+
+test_expect_success SMALL_SVN 'fetch each rev of SMALL separately' '
+	reinit_git &&
+	url=$(svnurl small.svn) &&
+
+	for x in `seq 1 1 10`; do
+		git remote add svn_$x "$url.r0-$x"
+	done &&
+	git remote update &&
+
+	git remote add svn "$url" &&
+	git fetch svn &&
+
+	git rev-parse -s remotes/svn_7/master~5 >ref7_2 &&
+	git rev-parse -s remotes/svn/master~8 >ref_2 &&
+	test_cmp ref7_2 ref_2
+'
+
+test_done
-- 
1.7.3.4

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

* [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha
  2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
                   ` (2 preceding siblings ...)
  2011-07-05 16:45 ` [PATCH 3/5] svn-fe: add a test for remote-svn-alpha Dmitry Ivankov
@ 2011-07-05 16:45 ` Dmitry Ivankov
  2011-07-06  9:56   ` Ramkumar Ramachandra
  2011-07-05 16:45 ` [PATCH 5/5] svn-fe: use proper refspec " Dmitry Ivankov
  4 siblings, 1 reply; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

svn-fe by default  produces a progress line for each imported revision.
For large repos it stresses the terminal and a user, possibly scrolls
away error messages.

Just disable progress lines for now.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/git-remote-svn-alpha |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index 84d841e..d75bc2a 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -37,7 +37,7 @@ SVNDUMP=${SVNDUMP:-`try_svnadmin`}
 
 do_import () {
 	revs=$1 url=$2
-	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe) 3<&0 || die "FAILURE"
+	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --no-progress) 3<&0 || die "FAILURE"
 	exec 1>&-
 }
 
-- 
1.7.3.4

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

* [PATCH 5/5] svn-fe: use proper refspec in remote-svn-alpha
  2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
                   ` (3 preceding siblings ...)
  2011-07-05 16:45 ` [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha Dmitry Ivankov
@ 2011-07-05 16:45 ` Dmitry Ivankov
  4 siblings, 0 replies; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-05 16:45 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

Create a per repository name private refs namespace as suggested by
the remote helpers documentation. This allows to have several svn
remotes at the same time. And also this way we don't overwrite the
local branch master.

The refpec is:
HEAD:refs/svn-alpha/$reponame/SVNHEAD
refs/heads/master:refs/svn-alpha/$reponame/SVNHEAD

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/git-remote-svn-alpha        |   18 ++++++++++--------
 contrib/svn-fe/t/t9010-remote-svn-alpha.sh |    9 +++++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index d75bc2a..d4b90ae 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -36,8 +36,8 @@ SVNDUMP=${SVNDUMP:-`try_svnrdump`}
 SVNDUMP=${SVNDUMP:-`try_svnadmin`}
 
 do_import () {
-	revs=$1 url=$2
-	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --no-progress) 3<&0 || die "FAILURE"
+	revs=$1 url=$2 dst=$3
+	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --ref="$dst" --no-progress) 3<&0 || die "FAILURE"
 	exec 1>&-
 }
 
@@ -46,29 +46,31 @@ usage 'git remote-svn-alpha <repository> <URL> < commandlist'
 repo=$1
 url=$2
 need_import=""
+remote_ref="refs/heads/master"
+private_ref="refs/svn-alpha/$repo/SVNHEAD"
 
 while read -r cmd args
 do
 	case $cmd in
 	capabilities)
 		echo import
-		echo "refspec HEAD:refs/heads/master"
-		echo "refspec refs/heads/master:refs/heads/master"
+		echo "refspec HEAD:$private_ref"
+		echo "refspec $remote_ref:$private_ref"
 		echo
 		;;
 	list)
-		echo '? HEAD'
-		echo '? refs/heads/master'
+		echo "? HEAD"
+		echo "? $remote_ref"
 		echo
 		;;
 	import)
-		test "$args" = "HEAD" || test "$args" = "refs/heads/master" ||
+		test "$args" = "HEAD" || test "$args" = "$remote_ref" ||
 		die "remote-svn-alpha: unsupported import ref argument: $args"
 		need_import="yes"
 		;;
 	'')
 		test "$need_import" = "yes" || exit 0
-		do_import 0:HEAD "$url"
+		do_import 0:HEAD "$url" "$private_ref"
 		need_import=""
 		;;
 	*)
diff --git a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
index 30dc726..786cc1f 100755
--- a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
+++ b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
@@ -226,4 +226,13 @@ test_expect_success SMALL_SVN 'fetch each rev of SMALL separately' '
 	test_cmp ref7_2 ref_2
 '
 
+test_expect_success TINY_SVN 'fetch TINY does not write to refs/heads/master' '
+	reinit_git &&
+	url=$(svnurl tiny.svn) &&
+	git remote add svn "$url" &&
+	git fetch svn &&
+	git show-ref --verify refs/remotes/svn/master &&
+	test_must_fail git show-ref --verify refs/heads/master
+'
+
 test_done
-- 
1.7.3.4

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

* Re: [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha
  2011-07-05 16:45 ` [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha Dmitry Ivankov
@ 2011-07-06  9:56   ` Ramkumar Ramachandra
  2011-07-06 12:30     ` Jonathan Nieder
  0 siblings, 1 reply; 12+ messages in thread
From: Ramkumar Ramachandra @ 2011-07-06  9:56 UTC (permalink / raw)
  To: Dmitry Ivankov; +Cc: git, Jonathan Nieder, David Barr

Hi again,

Dmitry Ivankov writes:
> svn-fe by default  produces a progress line for each imported revision.
> For large repos it stresses the terminal and a user, possibly scrolls
> away error messages.
>
> Just disable progress lines for now.
>
> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
> ---
>  contrib/svn-fe/git-remote-svn-alpha |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Perhaps squash this into the patch that introduces --[no]-progress in svn-fe?

-- Ram

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

* Re: [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
  2011-07-05 16:45 ` [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper Dmitry Ivankov
@ 2011-07-06 10:12   ` Ramkumar Ramachandra
  2011-07-06 11:02     ` Dmitry Ivankov
  0 siblings, 1 reply; 12+ messages in thread
From: Ramkumar Ramachandra @ 2011-07-06 10:12 UTC (permalink / raw)
  To: Dmitry Ivankov; +Cc: git, Jonathan Nieder, David Barr

Hi,

Dmitry Ivankov writes:
> svnrdump produces the same stream as svnadmin dump. svnrdump is able
> to do it via any svn remote protocol while svnadmin needs access to
> the repository filesystem and can't produce subdirectory dumps.
> But svnrdump is a newer tool and may be unavailable on some systems.
>
> Try to use svnadmin dump for file:// repository urls if there is no
> svnrdump in the PATH. First of all this is to be used in tests, where
> the repository is indeed local most of the time.

svnrdump's output is not identical to svnadmin's output.  You'd
perhaps want to document the differences, and the impact they might
have?

> diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
> index 61c9b07..84d841e 100755
> --- a/contrib/svn-fe/git-remote-svn-alpha
> +++ b/contrib/svn-fe/git-remote-svn-alpha
> @@ -12,10 +12,32 @@ usage () {
>        exit 129
>  }
>
> +try_svnrdump () {
> +       command -v svnrdump >/dev/null &&
> +       echo "svnrdump dump --non-interactive --username=Guest --password= \
> +               --quiet --incremental" ||
> +       true
> +}

I saw this '--username', '--password' in other patches too.  I'm
probably missing context, but I'm curious to know why this is required
and what you're planning to do to fix it in the future.

Thanks.

-- Ram

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

* Re: [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
  2011-07-06 10:12   ` Ramkumar Ramachandra
@ 2011-07-06 11:02     ` Dmitry Ivankov
  2011-07-06 11:11       ` Ramkumar Ramachandra
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Ivankov @ 2011-07-06 11:02 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: git, Jonathan Nieder, David Barr

On Wed, Jul 6, 2011 at 4:12 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> Hi,
>
> Dmitry Ivankov writes:
>> svnrdump produces the same stream as svnadmin dump. svnrdump is able
>> to do it via any svn remote protocol while svnadmin needs access to
>> the repository filesystem and can't produce subdirectory dumps.
>> But svnrdump is a newer tool and may be unavailable on some systems.
>>
>> Try to use svnadmin dump for file:// repository urls if there is no
>> svnrdump in the PATH. First of all this is to be used in tests, where
>> the repository is indeed local most of the time.
>
> svnrdump's output is not identical to svnadmin's output.  You'd
> perhaps want to document the differences, and the impact they might
> have?
Hm, I don't see much differences.
Data format is the same SVN-fs-dump-format-version: 3. In my case I
observe following differences:
- svnadmin writes sha1 checksums along with md5 ones
- hashtable dumps can have different elements dump order
- svnrdump sets Prop-delta: true for empty props
- text deltas can be encoded differently (does it affect svn:ann?)
My svnadmin is version 1.6.16 (r1073529)
svnrdump is from r1135490

Anything else I'm missing in a simple dump of a repository root?

>
>> diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
>> index 61c9b07..84d841e 100755
>> --- a/contrib/svn-fe/git-remote-svn-alpha
>> +++ b/contrib/svn-fe/git-remote-svn-alpha
>> @@ -12,10 +12,32 @@ usage () {
>>        exit 129
>>  }
>>
>> +try_svnrdump () {
>> +       command -v svnrdump >/dev/null &&
>> +       echo "svnrdump dump --non-interactive --username=Guest --password= \
>> +               --quiet --incremental" ||
>> +       true
>> +}
>
> I saw this '--username', '--password' in other patches too.  I'm
> probably missing context, but I'm curious to know why this is required
> and what you're planning to do to fix it in the future.
For repos with no read restrictions this isn't necessary, like those
in the test script supplied.
It's a placeholder for quick local patch if anyone wants to test a
repo with permissions.
In future it should be allowed to configure credentials in
corresponding remote section of git.config and
pass all these options to helpers. Using ~/.subversion/ configuration
is a valid option too.

>
> Thanks.
>
> -- Ram
>

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

* Re: [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
  2011-07-06 11:02     ` Dmitry Ivankov
@ 2011-07-06 11:11       ` Ramkumar Ramachandra
  2011-07-06 11:28         ` Jonathan Nieder
  0 siblings, 1 reply; 12+ messages in thread
From: Ramkumar Ramachandra @ 2011-07-06 11:11 UTC (permalink / raw)
  To: Dmitry Ivankov; +Cc: git, Jonathan Nieder, David Barr

Hi again,

Dmitry Ivankov writes:
> On Wed, Jul 6, 2011 at 4:12 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>> svnrdump's output is not identical to svnadmin's output.  You'd
>> perhaps want to document the differences, and the impact they might
>> have?
> Hm, I don't see much differences.
> Data format is the same SVN-fs-dump-format-version: 3. In my case I
> observe following differences:
> - svnadmin writes sha1 checksums along with md5 ones
> - hashtable dumps can have different elements dump order
> - svnrdump sets Prop-delta: true for empty props
> - text deltas can be encoded differently (does it affect svn:ann?)
> My svnadmin is version 1.6.16 (r1073529)
> svnrdump is from r1135490
>
> Anything else I'm missing in a simple dump of a repository root?

Yes, those are the differences.  Both of us know this, but an new
reader might naively assume that they are exactly the same -- that's
why I suggested that you document the fact somewhere.  Once you've
documented it, it's clear that these subtle differences have no impact
on how svn-fe deals with the streams.

>> I saw this '--username', '--password' in other patches too.  I'm
>> probably missing context, but I'm curious to know why this is required
>> and what you're planning to do to fix it in the future.
> For repos with no read restrictions this isn't necessary, like those
> in the test script supplied.
> It's a placeholder for quick local patch if anyone wants to test a
> repo with permissions.
> In future it should be allowed to configure credentials in
> corresponding remote section of git.config and
> pass all these options to helpers. Using ~/.subversion/ configuration
> is a valid option too.

I see.  However, I think you should just have one dedicated test for
testing credentials -- once that passes, you don't need to complicate
the other tests with information about credentials.  Try to test only
one aspect in each test; the report summarizing failed tests will make
more sense then.

Thanks.

-- Ram

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

* Re: [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
  2011-07-06 11:11       ` Ramkumar Ramachandra
@ 2011-07-06 11:28         ` Jonathan Nieder
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Nieder @ 2011-07-06 11:28 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Dmitry Ivankov, git, David Barr

Ramkumar Ramachandra wrote:
> Dmitry Ivankov writes:

>> Hm, I don't see much differences.
>> Data format is the same SVN-fs-dump-format-version: 3. In my case I
>> observe following differences:
>> - svnadmin writes sha1 checksums along with md5 ones
>> - hashtable dumps can have different elements dump order
>> - svnrdump sets Prop-delta: true for empty props
>> - text deltas can be encoded differently (does it affect svn:ann?)
>> My svnadmin is version 1.6.16 (r1073529)
>> svnrdump is from r1135490
>>
>> Anything else I'm missing in a simple dump of a repository root?
>
> Yes, those are the differences.

Are the differences documented somewhere (e.g., the svnbook)?

>>> I saw this '--username', '--password' in other patches too.  I'm
>>> probably missing context, but I'm curious to know why this is required
>>> and what you're planning to do to fix it in the future.
[...]
>> It's a placeholder for quick local patch if anyone wants to test a
>> repo with permissions.

I suspect it snuck in from tests with the cvs2svn repository. :)

Do you know another small repository that's entertaining to test with?

>> In future it should be allowed to configure credentials in
>> corresponding remote section of git.config

Yep, something along those lines sounds sensible.  In the short term,
I think there's been some talk of a configuration option to override
the svnrdump command; that could be used to pass credentials.

Inspired by the old HTTP convention, I tried

	svn log http://Guest:@cvs2svn.tigris.org/svn/cvs2svn

and

	svn log http://Guest:pass@cvs2svn.tigris.org/svn/cvs2svn

but alas, neither works.

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

* Re: [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha
  2011-07-06  9:56   ` Ramkumar Ramachandra
@ 2011-07-06 12:30     ` Jonathan Nieder
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Nieder @ 2011-07-06 12:30 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Dmitry Ivankov, git, David Barr

Ramkumar Ramachandra wrote:
> Dmitry Ivankov writes:

>> Just disable progress lines for now.
>>
>> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
>> ---
>>  contrib/svn-fe/git-remote-svn-alpha |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> Perhaps squash this into the patch that introduces --[no]-progress in svn-fe?

Since git-remote-svn-alpha is a slushy codebase and svn-fe is a little
more stable, it seems best to keep patches to the two separate for
now.  Even so, mentioning remote-svn's needs can still be a useful way
to make svn-fe changes easier to understand (which is what I think you
are getting at here); thanks for the hint.

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

end of thread, other threads:[~2011-07-06 12:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-05 16:45 [PATCH 0/5] remote-svn-alpha updates Dmitry Ivankov
2011-07-05 16:45 ` [PATCH 1/5] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
2011-07-05 16:45 ` [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper Dmitry Ivankov
2011-07-06 10:12   ` Ramkumar Ramachandra
2011-07-06 11:02     ` Dmitry Ivankov
2011-07-06 11:11       ` Ramkumar Ramachandra
2011-07-06 11:28         ` Jonathan Nieder
2011-07-05 16:45 ` [PATCH 3/5] svn-fe: add a test for remote-svn-alpha Dmitry Ivankov
2011-07-05 16:45 ` [PATCH 4/5] svn-fe: use svn-fe --no-progress in remote-svn-alpha Dmitry Ivankov
2011-07-06  9:56   ` Ramkumar Ramachandra
2011-07-06 12:30     ` Jonathan Nieder
2011-07-05 16:45 ` [PATCH 5/5] svn-fe: use proper refspec " Dmitry Ivankov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.