git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	David Barr <davidbarr@google.com>,
	Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper
Date: Tue,  5 Jul 2011 22:45:47 +0600	[thread overview]
Message-ID: <1309884350-13415-3-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <1309884350-13415-1-git-send-email-divanorama@gmail.com>

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

  parent reply	other threads:[~2011-07-05 16:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-07-06 10:12   ` [PATCH 2/5] svn-fe: allow svnadmin instead of svnrdump in svn helper 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=1309884350-13415-3-git-send-email-divanorama@gmail.com \
    --to=divanorama@gmail.com \
    --cc=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).