[GRASS-SVN] r74060 - grass-addons/tools/svn2git
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 7 07:03:45 PST 2019
Author: martinl
Date: 2019-02-07 07:03:45 -0800 (Thu, 07 Feb 2019)
New Revision: 74060
Modified:
grass-addons/tools/svn2git/migrate.sh
grass-addons/tools/svn2git/rewrite.py
Log:
svn2git: modify only messages r25479+
Modified: grass-addons/tools/svn2git/migrate.sh
===================================================================
--- grass-addons/tools/svn2git/migrate.sh 2019-02-05 22:30:08 UTC (rev 74059)
+++ grass-addons/tools/svn2git/migrate.sh 2019-02-07 15:03:45 UTC (rev 74060)
@@ -2,10 +2,10 @@
# Initialize git repo (preferably use AUTHORS.txt from SVN)
-mkdir grass-gis-git
+#mkdir grass-gis-git
cd grass-gis-git
-git svn init --stdlayout https://svn.osgeo.org/grass/grass # --no-metadata
-git svn --authors-file=../AUTHORS.txt fetch
+# git svn init --stdlayout https://svn.osgeo.org/grass/grass # --no-metadata
+# git svn --authors-file=../AUTHORS.txt fetch
# Create local branches
git branch develbranch_6 origin/develbranch_6
@@ -39,8 +39,8 @@
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 && git checkout master
-### SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
-### SCRIPTPATH=`dirname $SCRIPT`
-### git filter-branch --msg-filter "python $SCRIPTPATH/rewrite.py" -- --all
-# check out /tmp/log.txt for changes overview ...
+git reset --hard HEAD && git checkout master
+SCRIPT=`realpath $0` # realpath is a separate package and doesn't need to be installed
+SCRIPTPATH=`dirname $SCRIPT`
+git filter-branch --msg-filter "python $SCRIPTPATH/../rewrite.py" -- --all
+# check out /tmp/log_touched.txt and /tmp/log_untoched.txt for changes overview ...
Modified: grass-addons/tools/svn2git/rewrite.py
===================================================================
--- grass-addons/tools/svn2git/rewrite.py 2019-02-05 22:30:08 UTC (rev 74059)
+++ grass-addons/tools/svn2git/rewrite.py 2019-02-07 15:03:45 UTC (rev 74060)
@@ -1,13 +1,26 @@
# Taken from https://lists.osgeo.org/pipermail/gdal-dev/2018-March/048246.html
+import os
import sys
import requests
+import re
msg = sys.stdin.read()
+def untouched(msg):
+ with open('/tmp/log_untouched.txt', 'a') as f:
+ f.write('Message is:\n' + msg + '\n')
+
# Don't touch messages that reference other databases
-if msg.find('RT bug ') >= 0:
+if msg.find('RT bug ') >= 0 or msg.find('RT #') >= 0 or msg.find('RT#') >= 0:
sys.stdout.write(msg)
+ untouched(msg)
sys.exit(0)
+# trac migration date set 2007-12-09 (25479)
+rev = 25479
+m = re.compile(r".*git-svn-id.*@([0-9]{1,5}).*", re.DOTALL)
+if int(m.match(msg).groups()[0]) <= rev:
+ untouched(msg)
+ sys.exit(0)
oldpos = 0
old_msg = msg
@@ -95,7 +108,9 @@
break
if msg != old_msg:
- with open('/tmp/log.txt', 'a') as f:
+ with open('/tmp/log_touched.txt', 'a') as f:
f.write('Old message was:\n' + old_msg + 'New message is:\n' + msg + '\n')
+else:
+ untouched(msg)
sys.stdout.write(msg)
More information about the grass-commit
mailing list