From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: git-svn sucks when it should not
Date: Mon, 7 Jul 2008 12:49:09 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.1.00.0807071242180.18205@racer> (raw)
In-Reply-To: <20080707094438.GA5964@untitled>
Hi,
On Mon, 7 Jul 2008, Eric Wong wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > [...] a shell script that uses curl to find out what refs are new, and
> > clones each ref individually, then pushes all the results together
> > into one repository.
>
> It might be helpful to publish your script so other people can see/use
> it.
-- snipsnap --
#!/bin/sh
# This script looks for the config variable svn-manual.url, and if it
# is set, will traverse the url and its subdirectories with curl, and
# install different svn-remotes for all found refs.
#
# It heavily relies on curl being able to screen-scrape the directories,
# in other words, it wants an HTTP on the other side that has directory
# listings enabled.
#
# The quick and dirty heuristics to find out what makes a ref is that
# a ref's subdirectory contains files, while a subdirectory containing
# only subdirectories is supposed to contain refs (or subdirectories
# of refs).
list_contains_files () {
while test $# -gt 0
do
case "$1" in
*/) ;;
*) echo "$1";;
esac
shift
done
}
svn_manually_fetch_one_dir () {
contents="$(curl --silent -k "$1"/ |
sed -n "s/.*a href=\"\([^\"]*\).*/\1/p" |
grep -ve '^\.\./$' -e '^http:' -e '^/')"
test -z "$contents" && return
test -z "$(list_contains_files $contents)" || {
test -z "$(git config svn-remote."$2".url)" && {
git config svn-remote."$2".url "$1" &&
git config svn-remote."$2".fetch :"$2" ||
return
}
git svn fetch -R "$2"
return
}
for dir in $contents
do
dir=${dir%%/}
svn_manually_fetch_one_dir "$1/$dir" "$2/$dir" || break
done
}
svn_fetch_semi_manually () {
url="$(git config svn-manual.url)"
test -z "$url" && return 1
svn_manually_fetch_one_dir "$url" refs/remotes
}
svn_fetch_semi_manually || git svn fetch
next prev parent reply other threads:[~2008-07-07 11:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-07 0:00 git-svn sucks when it should not Johannes Schindelin
2008-07-07 9:44 ` Eric Wong
2008-07-07 11:49 ` Johannes Schindelin [this message]
2008-07-07 16:29 ` Avery Pennarun
2008-07-07 17:18 ` Johannes Schindelin
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=alpine.DEB.1.00.0807071242180.18205@racer \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/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