[Pkg-ocaml-maint-commits] r5320 - in /trunk/tools/git2svn: ./ svn2git_alioth svn2git_pkg-ocaml-maint

zack at users.alioth.debian.org zack at users.alioth.debian.org
Thu Mar 13 13:54:35 UTC 2008


Author: zack
Date: Thu Mar 13 13:54:34 2008
New Revision: 5320

URL: http://svn.debian.org/wsvn/?sc=1&rev=5320
Log:
Initial checkin of helpers tools to convert svn repository subdirs to git
repository, on alioth.d.o and specifically for pkg-ocaml-maint.

This version seems to work properly with "normal" packages, but has some
glitches with packages with weird histories as ocaml itself in the first place.
Committing anyhow as a backup measure.

Added:
    trunk/tools/git2svn/
    trunk/tools/git2svn/svn2git_alioth   (with props)
    trunk/tools/git2svn/svn2git_pkg-ocaml-maint   (with props)

Added: trunk/tools/git2svn/svn2git_alioth
URL: http://svn.debian.org/wsvn/trunk/tools/git2svn/svn2git_alioth?rev=5320&op=file
==============================================================================
--- trunk/tools/git2svn/svn2git_alioth (added)
+++ trunk/tools/git2svn/svn2git_alioth Thu Mar 13 13:54:34 2008
@@ -1,0 +1,84 @@
+#!/bin/bash
+# svn2git_alioth - svn to git converter, handling some alioth.debian.org details
+#
+# Copyright (C) 2008  Stefano Zacchiroli <zack at debian.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# $Id$
+
+set -e
+
+usage () {
+  echo "Usage:   svn2git_alioth TRUNK_URL BRANCHES_URL TAGS_URL DESTDIR"
+  echo "Example: svn2git_alioth \\"
+  echo "           svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/pcre-ocaml/trunk \\"
+  echo "           svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/pcre-ocaml/branches \\"
+  echo "           svn+ssh://svn.debian.org/svn/pkg-ocaml-maint/tags/packages/pcre-ocaml \\"
+  echo "           /some/where/pcre-ocaml.git"
+}
+
+TRUNK="$1"
+BRANCHES="$2"
+TAGS="$3"
+DESTDIR="$4"
+
+if [ -z "$TRUNK" -o -z "$BRANCHES" -o -z "$TAGS" -o -z "$DESTDIR" ] ; then
+  usage
+  exit 1
+fi
+wdir=$(mktemp -d tmp.svn2git.XXXXXXXXXX)
+trap "rm -rf $wdir" EXIT
+
+info () {
+  echo "**$1"
+}
+
+git_svninit () {
+  info " initializing git repository"
+  (cd "$wdir"
+  git-svn init --shared=world --no-metadata \
+    -T "$TRUNK" -b "$BRANCHES" -t "$TAGS")
+}
+
+gitsvn_fetch () {
+  info " checking in svn history into git"
+  (cd "$wdir"
+  git-svn fetch)
+}
+
+fix_tags () {
+  info " converting tag \"branches\" to git tags"
+  (cd "$wdir"
+  tag_branches=$(git branch -r | awk '{ print $1 }' | grep "^tags/")
+  for branch in $tag_branches ; do
+    version=$(echo $branch | cut -f 2 -d /)
+    info "* (git-)tagging version $version"
+    git tag $version $branch^	# tag branch parent
+    git branch -r -d $branch	# delete branch
+  done)
+}
+
+clean_repo () {
+  info " generic git repository clean up + making it bare"
+  (cd $wdir
+  git config core.bare true
+  git config --unset core.logallrefupdates
+  git config receive.denynonfastforwards true
+  git config --remove-section svn-remote.svn)
+  mv $wdir/.git/ "$DESTDIR"
+  rm -rf $wdir
+  (cd "$DESTDIR"
+  git gc)
+}
+
+
+[ -z "$NO_INIT" ] && git_svninit
+[ -z "$NO_FETCH" ] && gitsvn_fetch
+[ -z "$NO_TAGFIX" ] && fix_tags
+[ -z "$NO_CLEAN" ] && clean_repo
+info " all done, see ya."
+

Propchange: trunk/tools/git2svn/svn2git_alioth
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/tools/git2svn/svn2git_alioth
------------------------------------------------------------------------------
    svn:keywords = Id

Added: trunk/tools/git2svn/svn2git_pkg-ocaml-maint
URL: http://svn.debian.org/wsvn/trunk/tools/git2svn/svn2git_pkg-ocaml-maint?rev=5320&op=file
==============================================================================
--- trunk/tools/git2svn/svn2git_pkg-ocaml-maint (added)
+++ trunk/tools/git2svn/svn2git_pkg-ocaml-maint Thu Mar 13 13:54:34 2008
@@ -1,0 +1,38 @@
+#!/bin/bash
+# svn2git_pkg-ocaml-maint - svn to git converter, for pkg-ocaml-maint.alioth.debian.org
+#
+# Copyright (C) 2008  Stefano Zacchiroli <zack at debian.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# $Id$
+
+set -e
+
+usage () {
+  echo "Usage:   svn2git_pkg-ocaml-maint SOURCE_PACKAGE [DESTDIR]"
+  echo "         DESTDIR defaults to CURDIR/SOURCE_PACKAGE.git"
+  echo "Example: svn2git_pkg-ocaml-maint pcre-ocaml /some/where/pcre-ocaml.git"
+}
+
+PKG="$1"
+BASEURL="svn+ssh://svn.debian.org/svn/pkg-ocaml-maint"
+
+if [ -z "$PKG" ] ; then
+  usage
+  exit 1
+fi
+DESTDIR="$(pwd)/$PKG.git"
+if [ -n "$2" ] ; then
+  DESTDIR="$2"
+fi
+
+trunk="$BASEURL/trunk/packages/$PKG/trunk"
+branches="$BASEURL/trunk/packages/$PKG/branches"
+tags="$BASEURL/tags/packages/$PKG"
+
+svn2git_alioth "$trunk" "$branches" "$tags" "$DESTDIR"
+

Propchange: trunk/tools/git2svn/svn2git_pkg-ocaml-maint
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/tools/git2svn/svn2git_pkg-ocaml-maint
------------------------------------------------------------------------------
    svn:keywords = Id




More information about the Pkg-ocaml-maint-commits mailing list