[GRASS-SVN] r74083 - grass-addons/tools/svn2git

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 12 09:39:25 PST 2019


Author: martinl
Date: 2019-02-12 09:39:25 -0800 (Tue, 12 Feb 2019)
New Revision: 74083

Added:
   grass-addons/tools/svn2git/1-migrate-core.sh
   grass-addons/tools/svn2git/2-migrate-addons-promo.sh
   grass-addons/tools/svn2git/3-rewrite-messages.sh
Removed:
   grass-addons/tools/svn2git/1-migrate-branches-tags.sh
Modified:
   grass-addons/tools/svn2git/0-migrate-fetch.sh
Log:
svn2git: tools major reorganization + tunning

Modified: grass-addons/tools/svn2git/0-migrate-fetch.sh
===================================================================
--- grass-addons/tools/svn2git/0-migrate-fetch.sh	2019-02-12 17:22:13 UTC (rev 74082)
+++ grass-addons/tools/svn2git/0-migrate-fetch.sh	2019-02-12 17:39:25 UTC (rev 74083)
@@ -3,20 +3,17 @@
 SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
 SCRIPTPATH=`dirname $SCRIPT`
 
-# core repo
-DIR=grass-fetch
-mkdir $DIR ; cd $DIR
-git svn init --stdlayout https://svn.osgeo.org/grass/grass
-git svn --authors-file=${SCRIPTPATH}/AUTHORS.txt fetch
+function fetch() {
+    DIR=$1
+    OPT=$2
+    
+    mkdir $DIR
+    cd $DIR
+    git svn init $OPT https://svn.osgeo.org/grass/grass
+    git svn --authors-file=${SCRIPTPATH}/AUTHORS.txt fetch
+    cd ..
+}
 
-# addons repo
-DIR=grass-addons-fetch
-mkdir $DIR ; cd $DIR
-git svn init https://svn.osgeo.org/grass/grass-addons
-git svn --authors-file=${SCRIPTPATH}/AUTHORS.txt fetch
-
-# promo
-DIR=grass-promo-fetch
-mkdir $DIR ; cd $DIR
-git svn init https://svn.osgeo.org/grass/grass-promo
-git svn --authors-file=${SCRIPTPATH}/AUTHORS.txt fetch
+fetch "grass-fetch" "--stdlayout"
+fetch "grass-addons-fetch"
+fetch "grass-promo-fetch"

Deleted: grass-addons/tools/svn2git/1-migrate-branches-tags.sh
===================================================================
--- grass-addons/tools/svn2git/1-migrate-branches-tags.sh	2019-02-12 17:22:13 UTC (rev 74082)
+++ grass-addons/tools/svn2git/1-migrate-branches-tags.sh	2019-02-12 17:39:25 UTC (rev 74083)
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
-SCRIPTPATH=`dirname $SCRIPT`
-
-# TO BE SET
-DIR=grass
-### DIR=grass-legacy
-
-rm -rf $DIR
-cp -r grass-fetch $DIR
-cd $DIR
-
-# Create local branches
-if [ $DIR = "grass" ] ; then
-    branch_filter="releasebranch_7"
-else
-    branch_filter="releasebranch_[0-6]"
-fi
-for branch in `git branch -r | grep $branch_filter | sed 's#  origin/##g'`; do
-    git branch $branch origin/$branch
-done
-if [ $DIR = "grass" ] ; then
-    git branch master origin/trunk
-    git checkout master
-fi
-
-# Rename tags
-if [ $DIR = "grass" ] ; then
-    tag_filter="grass_7"
-else
-    tag_filter="grass_[0-6]"
-fi
-for i in `git branch -r | grep tags | grep $tag_filter`; do
-    b=`echo $i | sed 's#origin/##'`
-    if [ `echo $i | grep -c release` -gt 0 ] ; then
-        j=`echo $i | sed 's#origin/tags/release_[0-9]\+_##g'`
-    else
-        j=`echo $i | sed 's#origin/tags/##g'`
-    fi
-    git branch $b $i
-    d=`git log -1 --format=%cd --date=iso $b`
-    h=`git log -1 --format=%h --date=iso $b`
-    GIT_COMMITTER_DATE="$d" git tag -a $j -m "Tagging release $j" $h
-done
-
-if [ $DIR = "grass" ] ; then
-    git checkout master
-fi
-for i in `git branch | grep tags`; do
-    git branch -D $i
-done
-
-# Remove remote branches
-for i in `git branch -r | grep origin`; do
-    git branch -dr $i
-done
-
-# Fix commit messages (#x -> https://trac.osgeo.org/...)
-git reset --hard HEAD
-for b in `git branch | cut -c 3-`; do
-    git checkout $b
-    git filter-branch --msg-filter "python  $SCRIPTPATH/rewrite.py" -- --all
-    # check out /tmp/log_touched.txt and /tmp/log_untoched.txt for changes overview ...
-    mv /tmp/log_touched.txt log_${b}_touched.txt
-    mv /tmp/log_untouched.txt log_${b}_untouched.txt
-done
-

Copied: grass-addons/tools/svn2git/1-migrate-core.sh (from rev 74082, grass-addons/tools/svn2git/1-migrate-branches-tags.sh)
===================================================================
--- grass-addons/tools/svn2git/1-migrate-core.sh	                        (rev 0)
+++ grass-addons/tools/svn2git/1-migrate-core.sh	2019-02-12 17:39:25 UTC (rev 74083)
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
+SCRIPTPATH=`dirname $SCRIPT`
+
+# TO BE SET
+DIR=grass
+### DIR=grass-legacy
+
+rm -rf $DIR
+cp -r grass-fetch $DIR
+cd $DIR
+
+# Create local branches
+if [ $DIR = "grass" ] ; then
+    branch_filter="releasebranch_7"
+else
+    branch_filter="releasebranch_[0-6]"
+fi
+for branch in `git branch -r | grep $branch_filter | sed 's#  origin/##g'`; do
+    git branch $branch origin/$branch
+done
+if [ $DIR = "grass" ] ; then
+    git branch master origin/trunk
+    git checkout master
+fi
+
+# Rename tags
+if [ $DIR = "grass" ] ; then
+    tag_filter="grass_7"
+else
+    tag_filter="grass_[0-6]"
+fi
+for i in `git branch -r | grep tags | grep $tag_filter`; do
+    b=`echo $i | sed 's#origin/##'`
+    if [ `echo $i | grep -c release` -gt 0 ] ; then
+        j=`echo $i | sed 's#origin/tags/release_[0-9]\+_##g'`
+    else
+        j=`echo $i | sed 's#origin/tags/##g'`
+    fi
+    git branch $b $i
+    d=`git log -1 --format=%cd --date=iso $b`
+    h=`git log -1 --format=%h --date=iso $b`
+    GIT_COMMITTER_DATE="$d" git tag -a $j -m "Tagging release $j" $h
+done
+
+if [ $DIR = "grass" ] ; then
+    git checkout master
+fi
+for i in `git branch | grep tags`; do
+    git branch -D $i
+done
+
+# Remove remote branches
+for i in `git branch -r | grep origin`; do
+    git branch -dr $i
+done
+
+# Fix commit messages (#x -> https://trac.osgeo.org/...)
+git reset --hard HEAD
+for b in `git branch | cut -c 3-`; do
+    git checkout $b
+    git filter-branch --msg-filter "python  $SCRIPTPATH/rewrite.py" -- --all
+    # check out /tmp/log_touched.txt and /tmp/log_untoched.txt for changes overview ...
+    mv /tmp/log_touched.txt log_${b}_touched.txt
+    mv /tmp/log_untouched.txt log_${b}_untouched.txt
+done
+

Added: grass-addons/tools/svn2git/2-migrate-addons-promo.sh
===================================================================
--- grass-addons/tools/svn2git/2-migrate-addons-promo.sh	                        (rev 0)
+++ grass-addons/tools/svn2git/2-migrate-addons-promo.sh	2019-02-12 17:39:25 UTC (rev 74083)
@@ -0,0 +1,17 @@
+#!/bin/sh -x
+
+migrate() {
+    DIR=$1
+    rm -rf $DIR
+    cp -r ${DIR}-fetch $DIR
+    cd $DIR
+
+    # Remove remote branches
+    for i in `git branch -r`; do
+        git branch -dr $i
+    done
+    cd ..
+}
+
+migrate "grass-addons"
+migrate "grass-promo"


Property changes on: grass-addons/tools/svn2git/2-migrate-addons-promo.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-sh
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/tools/svn2git/3-rewrite-messages.sh
===================================================================
--- grass-addons/tools/svn2git/3-rewrite-messages.sh	                        (rev 0)
+++ grass-addons/tools/svn2git/3-rewrite-messages.sh	2019-02-12 17:39:25 UTC (rev 74083)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
+SCRIPTPATH=`dirname $SCRIPT`
+
+rewrite_msg() {
+    repo=$1
+
+    cd $repo
+    
+    # Fix commit messages (#x -> https://trac.osgeo.org/...)
+    git reset --hard HEAD
+    for b in `git branch | cut -c 3-`; do
+        echo $b
+        git checkout $b
+        git filter-branch --msg-filter "python  $SCRIPTPATH/rewrite.py" -- --all
+        check out /tmp/log_touched.txt and /tmp/log_untoched.txt for changes overview ...
+        mv /tmp/log_touched.txt log_${repo}_${b}_touched.txt
+        mv /tmp/log_untouched.txt log_${repo}_${b}_untouched.txt
+    done
+}
+
+rewrite_msg "grass"
+rewrite_msg "grass-legacy"
+rewrite_msg "grass-addons"
+rewrite_msg "grass-promo"


Property changes on: grass-addons/tools/svn2git/3-rewrite-messages.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-sh
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the grass-commit mailing list