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 5/5] svn-fe: use proper refspec in remote-svn-alpha
Date: Tue, 5 Jul 2011 22:45:50 +0600 [thread overview]
Message-ID: <1309884350-13415-6-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <1309884350-13415-1-git-send-email-divanorama@gmail.com>
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
prev 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 ` [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 ` Dmitry Ivankov [this message]
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-6-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).