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

[PATCH v2 7/9] svn-fe: write svnrev notes in remote-svn-alpha

From
Dmitry Ivankov <divanorama@gmail.com>
Date
Jul 13, 2011, 15:26 UTC
Message-ID
<1310570813-16648-8-git-send-email-divanorama@gmail.com>
In-Reply-To
<1310570813-16648-1-git-send-email-divanorama@gmail.com>

For each imported svn commit write "rN" note in a private namespace. These can be viewed with somewhat ugly $ git log --show-notes=refs/svn-alpha/<reponame>/SVNR But also these notes can be used to import svn history incrementally. Add a simple test for these notes.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/git-remote-svn-alpha        |    9 ++++++---
 contrib/svn-fe/t/t9010-remote-svn-alpha.sh |   11 +++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index b410302..c2af393 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -58,8 +58,8 @@ SVNDUMP=${SVNDUMP:-`try_svnadmin`}
 test -n "$SVNDUMP" || die "neither svnrdump nor svnadmin & svnlook was found"
 
 do_import () {
-	revs=$1 url=$2 dst=$3
-	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --ref="$dst" --no-progress) 3<&0 || die "FAILURE"
+	revs=$1 url=$2 dst=$3 notes=$4
+	(eval "$SVNDUMP \"$url\" -r\"$revs\"" |	svn-fe --ref="$dst" --notes_ref="$notes" --no-progress) 3<&0 || die "FAILURE"
 	exec 1>&-
 }
 
@@ -70,6 +70,8 @@ url=$2
 need_import=""
 remote_ref="refs/heads/master"
 private_ref="refs/svn-alpha/$repo/SVNHEAD"
+remote_notes="refs/notes/svnr"
+private_notes="refs/svn-alpha/$repo/SVNR"
 
 while read -r cmd args
 do
@@ -78,6 +80,7 @@ do
 		echo import
 		echo "refspec HEAD:$private_ref"
 		echo "refspec $remote_ref:$private_ref"
+		echo "refspec $remote_notes:$private_notes"
 		echo
 		;;
 	list)
@@ -92,7 +95,7 @@ do
 		;;
 	'')
 		test "$need_import" = "yes" || exit 0
-		do_import 0:HEAD "$url" "$private_ref"
+		do_import 0:HEAD "$url" "$private_ref" "$private_notes"
 		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 b0f41cb..5102428 100755
--- a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
+++ b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
@@ -265,4 +265,15 @@ test_expect_success TINY_SVN 'fetch TINY does not write to refs/heads/master' '
 	test_must_fail git show-ref --verify refs/heads/master
 '
 
+test_expect_success SMALL_SVN 'fetch SMALL writes revnum notes' '
+	reinit_git &&
+	url=$(svnurl small.svn) &&
+	git remote add svn "$url" &&
+	git fetch svn &&
+	git log --show-notes=refs/svn-alpha/svn/SVNR --format=%N -1 refs/remotes/svn/master^ >actual.note &&
+	echo r9 >expect.note &&
+	echo >>expect.note &&
+	test_cmp expect.note actual.note
+'
+
 test_done
-- 
1.7.3.4
Previous: Dmitry IvankovNext: Dmitry Ivankov
Message 8 of 10 in “remote-svn-alpha updates”
  1. Dmitry IvankovJul 13, 2011
  2. 1/9 svn-fe: use svnrdump --quiet in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  3. 2/9 svn-fe: avoid error on no-op imports in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  4. 3/9 svn-fe: allow svnadmin instead of svnrdump in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  5. 4/9 svn-fe: add a test for remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  6. 5/9 svn-fe: use svn-fe --no-progress in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  7. 6/9 svn-fe: use proper refspec in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  8. 7/9 svn-fe: write svnrev notes in remote-svn-alphaDmitry Ivankov, Jul 13, 2011
  9. 8/9 svn-fe: import incrementally in svn-remote-alphaDmitry Ivankov, Jul 13, 2011
  10. 9/9 svn-fe: reuse import-marks in remote-svn-alphaDmitry Ivankov, Jul 13, 2011

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

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