From owner-svn-src-user@FreeBSD.ORG Thu Oct 18 08:11:15 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81D8CEBC; Thu, 18 Oct 2012 08:11:15 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 680988FC17; Thu, 18 Oct 2012 08:11:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9I8BFCX086235; Thu, 18 Oct 2012 08:11:15 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9I8BFsF086230; Thu, 18 Oct 2012 08:11:15 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201210180811.q9I8BFsF086230@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 18 Oct 2012 08:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r241674 - in user/uqs: . git_conv X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2012 08:11:15 -0000 Author: uqs Date: Thu Oct 18 08:11:14 2012 New Revision: 241674 URL: http://svn.freebsd.org/changeset/base/241674 Log: Add git_conv scripts and rules, as used on git.freebsd.org The modified svn2git sources are at https://gitorious.org/~uqs/svn2git/uqs-svn2git This should make it easier for other people to re-do the conversions and verify their authenticity. Added: user/uqs/ user/uqs/git_conv/ user/uqs/git_conv/freebsd-doc.rules user/uqs/git_conv/freebsd-ports.rules user/uqs/git_conv/freebsd.rules user/uqs/git_conv/git_conv (contents, props changed) user/uqs/git_conv/git_conv_cron (contents, props changed) Added: user/uqs/git_conv/freebsd-doc.rules ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/uqs/git_conv/freebsd-doc.rules Thu Oct 18 08:11:14 2012 (r241674) @@ -0,0 +1,49 @@ +# vi:ft=perl: +create repository freebsd-doc.git +end repository + +match /head/ + repository freebsd-doc.git + branch master +end match + +# ignore this stuff +match /svnadmin/.* +end match +match /doc-branch-policy.txt +end match + +# Used during cvs2svn conversion +match /(branches)/([A-Z0-9_]+)/ + repository freebsd-doc.git + branch \1/\2 +end match + +match /(stable|releng|release)/([A-Z0-9.]+)/ + repository freebsd-doc.git + branch \1/\2 +end match + +match /(www)/ + repository freebsd-doc.git + branch \1 +end match + +match /(projects|release)/([^/]+)/ + repository freebsd-doc.git + branch \1/\2 +end match + +match /(translations)/ + repository freebsd-doc.git + branch \1 +end match + +match /(user)/([^/]+)/([^/]+)/ + repository freebsd-doc.git + branch \1/\2/\3 +end match + +# ignore the rest, XXX temp only +#match .* +#end match Added: user/uqs/git_conv/freebsd-ports.rules ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/uqs/git_conv/freebsd-ports.rules Thu Oct 18 08:11:14 2012 (r241674) @@ -0,0 +1,21 @@ +# vi:ft=perl: +create repository freebsd-ports.git +end repository + +match /head/ + repository freebsd-ports.git + branch master +end match + +# ignore this stuff +match /svnadmin/.* +end match + +match /(branches|tags)/([A-Z0-9_]+)/ + repository freebsd-ports.git + branch \1/\2 +end match + +# ignore the rest, XXX temp only +#match .* +#end match Added: user/uqs/git_conv/freebsd.rules ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/uqs/git_conv/freebsd.rules Thu Oct 18 08:11:14 2012 (r241674) @@ -0,0 +1,104 @@ +# vi:ft=perl: +create repository freebsd.git +end repository + +match /head/ + repository freebsd.git + branch master +end match + +# ignore this stuff +match /ROADMAP.txt +end match +match /projects/GUIDELINES.txt +end match +match /user/GUIDELINES.txt +end match +match /vendor/atf/(README.txt|FREEBSD-Xlist) +end match + +match /svnadmin/.* +end match + +match /(cvs2svn)/([^/]+)/([^/]+)/ + repository freebsd.git + branch \1/\2/\3 +end match + +match /(stable|releng|release)/([0-9.]+)/ + repository freebsd.git + branch \1/\2 +end match + +match /(releng)/ALPHA_2_0/ + repository freebsd.git + branch \1/2.0a +end match + +match /(releng)/BETA_2_0/ + repository freebsd.git + branch \1/2.0b +end match + +# special nesting for these +match /(projects)/(graid|ofed)/([^/]+)/ + repository freebsd.git + branch \1/\2/\3 +end match + +match /(projects)/([^/]+)/ + repository freebsd.git + branch \1/\2 +end match + +# /user/piso was created wrong +match /(user)/(piso)/ + repository freebsd.git + branch \1/\2/ipfw_old + min revision 186541 + max revision 190858 +end match +match /(user)/(piso)/([^/]+)/ + repository freebsd.git + branch \1/\2/\3 + min revision 190859 +end match +# ignore stuff, no branch for these +match /user/gad/README.txt +end match +match /user/des/Makefile.inc +end match +match /user/simon/test.txt +end match +match /user/peter/foo.txt +end match +match /vendor/(bzip2|flex)/FREEBSD-(Xlist|upgrade) +end match +match /vendor/v4l/README +end match + +# fixup trailing dot +match /vendor/(clang|llvm)/(clang|llvm)-(r73070)\./ + repository freebsd.git + branch vendor/\1/\2-\3 +end match + +# wrong tag, ignore r210074 and r210075 +match /vendor/(clang|llvm)-(r108243)/ +end match + +# unknown vendor is one level short +match /(vendor)/(unknown)/ + repository freebsd.git + branch \1/\2 +end match + +# XXX drop the different vendor-* prefixes? +match /(user|vendor|vendor-sys|vendor-cddl|vendor-crypto)/([^/]+)/([^/]+)/ + repository freebsd.git + branch \1/\2/\3 +end match + +# ignore the rest, XXX temp only +#match .* +#end match Added: user/uqs/git_conv/git_conv ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/uqs/git_conv/git_conv Thu Oct 18 08:11:14 2012 (r241674) @@ -0,0 +1,94 @@ +#!/bin/sh +# +# Repository creation and setup +# +# Simple for svn2git repos, need to run against local paths, using rules files in ~uqs/svn2git +# - First svn2git run will create target git repo +# - git remote add github github.com:freebsd/freebsd.git +# - git config --add remote.github.push '+refs/heads/master:refs/heads/master' +# - git config --add remote.github.push '+refs/heads/stable/*:refs/heads/stable/*' +# - git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' +# - git config --add remote.github.push '+refs/notes/*:refs/notes/*' +# - etc. +# - touch freebsd.git/git-daemon-export-ok +# - ~uqs/svn2git/svn-all-fast-export --rules ~uqs/svn2git/freebsd.rules --add-metadata-notes --identity-domain FreeBSD.org /home/svn/base +# - git push github +# done. Analog steps needed for doc and ports. +# +# For git-svn it's a bit more involved. We use separate working dirs, but push to the same destination repo. +# - git svn init -Thead -rewrite-root=svn+ssh://svn.freebsd.org/base file:///home/svn/base src-head.git +# - cd src-head.git +# - git svn fetch -r 0:1000 +# - git remote add github github.com:freebsd/freebsd.git +# - git config --add remote.github.push '+refs/remotes/trunk:refs/heads/svn_head' +# - git svn rebase +# - git push github + +LOCK=/tmp/gitconv.lock +RULES=/home/uqs/svn2git +SVN2GIT=/home/uqs/svn2git/svn-all-fast-export +BASE=/home/git + +trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15 +if ! shlock -p $$ -f ${LOCK}; then + echo "Locked by `cat ${LOCK}`, running too long? Please fix ..." >&2 + exit 1 +fi + +svn2git() +{ + local rules source target dest + rules=$1; shift + source=$1; shift + dest="$@" + + # FIXME: error prone, yuck + target=${rules%.rules}.git + target=`basename $target` + + echo "Converting $source to $target using svn2git" + cd $BASE + $SVN2GIT --add-metadata-notes --identity-domain FreeBSD.org \ + --rules $rules $source + if [ $? != 0 ]; then + echo "Error in svn2git conversion of $source" >&2 + exit 1 + fi + + echo "Pushing $target to $dest" + cd $target && for d in $dest; do git push $d || break; done + if [ $? != 0 ]; then + echo "Error in pushing to $dest" >&2 + exit 1 + fi +} + +gitsvn() +{ + local target dest + target=$1; shift + dest="$@" + + echo "Converting $target using git-svn" + cd $BASE/$target + git svn rebase + if [ $? != 0 ]; then + echo "Error in git-svn conversion of $target" >&2 + exit 1 + fi + + echo "Pushing $target to $dest" + for d in $dest; do git push $d || break; done + if [ $? != 0 ]; then + echo "Error in pushing to $dest" >&2 + exit 1 + fi +} + +svn2git $RULES/freebsd.rules /home/svn/base github +svn2git $RULES/freebsd-doc.rules /home/svn/doc github +svn2git $RULES/freebsd-ports.rules /home/svn/ports github + +gitsvn src-head.git github +gitsvn doc-head.git github +gitsvn ports-head.git github Added: user/uqs/git_conv/git_conv_cron ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/uqs/git_conv/git_conv_cron Thu Oct 18 08:11:14 2012 (r241674) @@ -0,0 +1,17 @@ +#!/bin/sh + +today="`date +%Y-%m-%d`" +log="$today.log" + +cd /home/git + +# TODO cleanup old logs + +git_conv >> $log 2>&1 + +if [ $? != 0 ]; then + echo "Error during git_conv" >&2 + tail $log + exit 1 +fi +