[Bps-public-commit] git-mailer branch, master, updated. 2240abe78a40b2d6333e369361b9e9fec3f9db2b

Alex M Vandiver alexmv at bestpractical.com
Tue Mar 16 16:30:03 EDT 2010


The branch, master has been updated
       via  2240abe78a40b2d6333e369361b9e9fec3f9db2b (commit)
       via  3aaf8dd56ab56ee1933abde93a5b7a317f9d0700 (commit)
       via  61abd68ea69126728555b4c339b319093f929c1b (commit)
      from  201366e88ecae7ff82c32fb165c927e43e2190c5 (commit)

Summary of changes:
 create-private-repo |    2 +-
 create-repo         |    2 +-
 migrate-private     |    4 ++++
 svn-to-git          |   42 ++++++++++++++++++++++++++++--------------
 4 files changed, 34 insertions(+), 16 deletions(-)
 create mode 100755 migrate-private

- Log -----------------------------------------------------------------
commit 61abd68ea69126728555b4c339b319093f929c1b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 16 16:22:21 2010 -0400

    Allow cloning at not-toplevel

diff --git a/create-private-repo b/create-private-repo
index f9cdc3a..a842b02 100755
--- a/create-private-repo
+++ b/create-private-repo
@@ -7,7 +7,7 @@ if [ "foo$RAW_REPO" == "foo" ]; then
     exit;
 fi
 
-REPO=`perl -e"print lc '$RAW_REPO'"`
+REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$RAW_REPO"`
 
 echo $REPO
 
diff --git a/create-repo b/create-repo
index d751743..6108097 100755
--- a/create-repo
+++ b/create-repo
@@ -7,7 +7,7 @@ if [ "foo$RAW_REPO" == "foo" ]; then
     exit;
 fi
 
-REPO=`perl -e"print lc '$RAW_REPO'"`
+REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$RAW_REPO"`
 
 echo $REPO
 
diff --git a/svn-to-git b/svn-to-git
index fad0a6d..ccc8970 100755
--- a/svn-to-git
+++ b/svn-to-git
@@ -7,7 +7,7 @@ if [ "foo$REPO" == "foo" ]; then
     exit;
 fi
 
-GIT_REPO=`perl -e"print lc '$REPO'"`
+GIT_REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$REPO"`
 PWD=`pwd`
 
 echo "Migrating svn repo $REPO to git repo  $GIT_REPO with $PWD/authors.txt"
@@ -21,11 +21,9 @@ else
     CLEANUP_CMD="git svn-abandon-fix-refs"
 fi
 
-
-
 git svn clone $OPTS --prefix svn/ --authors-file=${PWD}/authors.txt  \
-    svn://svn.bestpractical.com/${REPO} /tmp/svn-${REPO} && \
-cd /tmp/svn-${REPO} && \
+    svn://svn.bestpractical.com/${REPO} /tmp/svn-${GIT_REPO} && \
+cd /tmp/svn-${GIT_REPO} && \
 sh -c "$CLEANUP_CMD" && \
 git svn-abandon-cleanup  && \
 ssh fsck.com "cd /git/${GIT_REPO}.git; git config receive.denyNonFastforwards false" && \

commit 3aaf8dd56ab56ee1933abde93a5b7a317f9d0700
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 16 16:24:23 2010 -0400

    Fix fast and dirty ref removal

diff --git a/svn-to-git b/svn-to-git
index ccc8970..75f1d7b 100755
--- a/svn-to-git
+++ b/svn-to-git
@@ -16,7 +16,7 @@ svn ls svn://svn.bestpractical.com/${REPO}/trunk 2>/dev/null && OPTS="--stdlayou
 
 if [ "x$OPTS" = "x" ] ; then
     echo "Doing the cheap and easy ref removal"
-    CLEANUP_CMD="for ref in \$( git for-each-ref 'refs/remotes/*' --format='%(refname)' ); do git update-ref -d "\$ref"; done"
+    CLEANUP_CMD="for ref in \$( git for-each-ref --format='%(refname)' refs/remotes ); do git update-ref -d "\$ref"; done"
 else
     CLEANUP_CMD="git svn-abandon-fix-refs"
 fi

commit 2240abe78a40b2d6333e369361b9e9fec3f9db2b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 16 16:24:56 2010 -0400

    Code to migrate private repos as well

diff --git a/migrate-private b/migrate-private
new file mode 100755
index 0000000..60e6eaa
--- /dev/null
+++ b/migrate-private
@@ -0,0 +1,4 @@
+#!/bin/sh
+P=$1
+sh create-private-repo $P && \
+sh svn-to-git --private $P
diff --git a/svn-to-git b/svn-to-git
index 75f1d7b..bd92a40 100755
--- a/svn-to-git
+++ b/svn-to-git
@@ -7,28 +7,44 @@ if [ "foo$REPO" == "foo" ]; then
     exit;
 fi
 
-GIT_REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$REPO"`
 PWD=`pwd`
+if [ "foo$REPO" == "foo--private" ]; then
+    REPO=$2
+    GIT_REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$REPO"`
+    REPOPATH="svn+ssh://svn.bestpractical.com/svn/bps-private/${REPO}"
+    INTOPATH="/git-private/${GIT_REPO}.git"
+    PRIVATE=1
+else
+    GIT_REPO=`perl -e"\\$_=shift @ARGV;s{.*/}{}; print lc" "$REPO"`
+    REPOPATH="svn://svn.bestpractical.com/${REPO}"
+    INTOPATH="/git/${GIT_REPO}.git"
+    PRIVATE=0
+fi
 
-echo "Migrating svn repo $REPO to git repo  $GIT_REPO with $PWD/authors.txt"
+echo "Migrating svn repo $REPOPATH to git repo $INTOPATH"
 
-svn ls svn://svn.bestpractical.com/${REPO}/trunk 2>/dev/null && OPTS="--stdlayout"
+svn ls ${REPOPATH}/trunk 2>/dev/null && OPTS="--stdlayout"
 
-if [ "x$OPTS" = "x" ] ; then
+if [ "x$OPTS" == "x" ] ; then
     echo "Doing the cheap and easy ref removal"
     CLEANUP_CMD="for ref in \$( git for-each-ref --format='%(refname)' refs/remotes ); do git update-ref -d "\$ref"; done"
 else
     CLEANUP_CMD="git svn-abandon-fix-refs"
 fi
 
-git svn clone $OPTS --prefix svn/ --authors-file=${PWD}/authors.txt  \
-    svn://svn.bestpractical.com/${REPO} /tmp/svn-${GIT_REPO} && \
+git svn clone $OPTS --prefix svn/ --authors-file=${PWD}/authors.txt ${REPOPATH} /tmp/svn-${GIT_REPO} && \
 cd /tmp/svn-${GIT_REPO} && \
 sh -c "$CLEANUP_CMD" && \
 git svn-abandon-cleanup  && \
-ssh fsck.com "cd /git/${GIT_REPO}.git; git config receive.denyNonFastforwards false" && \
-git push --mirror git+ssh://diesel.bestpractical.com/git/${GIT_REPO}.git &&
-ssh fsck.com "cd /git/${GIT_REPO}.git; git config receive.denyNonFastforwards true" 
+ssh fsck.com "cd ${INTOPATH}; git config receive.denyNonFastforwards false" && \
+git push --mirror git+ssh://diesel.bestpractical.com${INTOPATH} && \
+ssh fsck.com "cd ${INTOPATH}; git config receive.denyNonFastforwards true"
+
+
 echo "Please check the conversion."
 echo "If you're happy, run:"
-echo "svn rm -m 'Moved to git: git+ssh://diesel.bestpractical.com/git/${GIT_REPO}.git OR http://github.com/bestpractical/${GIT_REPO}' svn+ssh://svn.bestpractical.com/svn/bps-public/$REPO"
+if [ "x$PRIVATE" = "x1" ]; then
+    echo "svn rm -m 'Moved to git: git+ssh://diesel.bestpractical.com${INTOPATH}' ${REPOPATH}"
+else
+    echo "svn rm -m 'Moved to git: git+ssh://diesel.bestpractical.com${INTOPATH} OR http://github.com/bestpractical/${GIT_REPO}' svn+ssh://svn.bestpractical.com/svn/bps-public/${REPO}"
+fi

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list