[Pkg-ocaml-maint-commits] r5340 - /trunk/tools/svn2git/svn2git_alioth
zack at users.alioth.debian.org
zack at users.alioth.debian.org
Wed Mar 19 17:40:44 UTC 2008
Author: zack
Date: Wed Mar 19 17:40:44 2008
New Revision: 5340
URL: http://svn.debian.org/wsvn/?sc=1&rev=5340
Log:
add support for importing .orig.tar.gz in the upstream branch
Modified:
trunk/tools/svn2git/svn2git_alioth
Modified: trunk/tools/svn2git/svn2git_alioth
URL: http://svn.debian.org/wsvn/trunk/tools/svn2git/svn2git_alioth?rev=5340&op=diff
==============================================================================
--- trunk/tools/svn2git/svn2git_alioth (original)
+++ trunk/tools/svn2git/svn2git_alioth Wed Mar 19 17:40:44 2008
@@ -11,8 +11,10 @@
# $Id$
set -e
+set -x
TGZ_PATTERN="*.tar.gz" # find (-name) syntax
+WATCH="debian/watch"
usage () {
echo "Usage: svn2git_alioth -T TRUNK_URL -b BRANCHES_URL -t TAGS_URL -o DESTDIR"
@@ -41,12 +43,13 @@
-3) PHASES="$PHASES 3" ; shift ;;
-4) PHASES="$PHASES 4" ; shift ;;
-5) PHASES="$PHASES 5" ; shift ;;
+ -6) PHASES="$PHASES 6" ; shift ;;
--) shift ; break ;;
-*) usage ; exit 1
esac
done
if [ -z "$PHASES" ] ; then
- PHASES="1 2 3 4 5"
+ PHASES="1 2 3 4 5 6"
fi
if echo "$PHASES" | grep -q 1 ; then # phase 1 requires URLs info
if [ -z "$TRUNK" -o -z "$BRANCHES" -o -z "$TAGS" -o -z "$DESTDIR" ] ; then
@@ -57,6 +60,9 @@
}
parse_opts "$@"
+
+wdir=$(mktemp -t -d tmp.svn2git.XXXXXXXXXX)
+trap "rm -rf $wdir" EXIT # better safe than sorry
info () {
echo "**$1"
@@ -108,6 +114,29 @@
git reflog expire --all --expire-unreachable=0)
}
+import_orig () {
+ info " importing upstream sources"
+ info "* creating initial (fake) upstream repository"
+ (cd $DESTDIR
+ git-symbolic-ref HEAD refs/heads/upstream
+ git rm --cached -r .
+ git commit --allow-empty -m 'empty upstream branch'
+ git checkout -f master
+ git merge upstream
+ if [ -f "$WATCH" ] ; then
+ info "* downloading and checking-in latest upstream tarball"
+ fname=$(uscan --watchfile "$WATCH" --force-download --destdir $wdir/ | tail -n 1 | awk '{ print $3 }')
+ if [ -f "$wdir/$fname" ] ; then
+ git-import-orig --no-dch "$wdir/$fname"
+ rm -f "$wdir/*.tar.*" # no other tarball should be around
+ else
+ info "* can't download upstream tarball, aborting tarball check-in"
+ fi
+ else
+ info "* can't find debian/watch file, aborting tarball check-in"
+ fi)
+}
+
clean_repo () {
info " generic git repository clean up + making it bare"
(cd $DESTDIR
@@ -115,25 +144,24 @@
git config --unset core.logallrefupdates
git config receive.denynonfastforwards true
git config --remove-section svn-remote.svn)
- wdir=$(mktemp -t -d tmp.svn2git.XXXXXXXXXX)
- trap "rm -rf $wdir" EXIT # better safe than sorry
mv $DESTDIR/.git/ $wdir/
rm -rf $DESTDIR/
mv $wdir/.git/ $DESTDIR
- rm -rf $wdir
(cd "$DESTDIR"
git gc --prune --aggressive)
}
info " executing phases: $PHASES"
-info " (1-git_svn_init; 2-git_svn_fetch; 3-fix_branches; 4-rm_tarballs; 5-clean_repo)"
+info " (1-git_svn_init; 2-git_svn_fetch; 3-fix_branches;"
+info " 4-rm_tarballs; 5-import_orig; 6-clean_repo)"
for phase in $PHASES ; do
case $phase in
1) git_svn_init ;;
2) git_svn_fetch ;;
3) fix_branches ;;
4) rm_tarballs ;;
- 5) clean_repo ;;
+ 5) import_orig ;;
+ 6) clean_repo ;;
esac
done
info " all done, see ya."
More information about the Pkg-ocaml-maint-commits
mailing list