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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 4 14:03:06 PST 2019


Author: martinl
Date: 2019-03-04 14:03:06 -0800 (Mon, 04 Mar 2019)
New Revision: 74154

Modified:
   grass-addons/tools/svn2git/3-rewrite-messages.sh
   grass-addons/tools/svn2git/rewrite.py
Log:
svn2git: rewrite script tuning

Modified: grass-addons/tools/svn2git/3-rewrite-messages.sh
===================================================================
--- grass-addons/tools/svn2git/3-rewrite-messages.sh	2019-03-04 20:37:45 UTC (rev 74153)
+++ grass-addons/tools/svn2git/3-rewrite-messages.sh	2019-03-04 22:03:06 UTC (rev 74154)
@@ -7,15 +7,19 @@
 # ... -- 244063d26e4d541039e4af7ab7191801591ebce8..HEAD
 
 rewrite_msg() {
-    repo=$1
+    src=$1
+    repo=${src}-rewrite
 
+    # create clean copy
+    rm -rf $repo
+    git clone $src $repo
     cd $repo
     
     # Fix commit messages (#x -> https://trac.osgeo.org/...)
     git reset --hard HEAD
     git filter-branch --msg-filter "python  $SCRIPTPATH/rewrite.py" -- --all
-    mv /tmp/log_touched.txt ../log_${repo}_touched.txt
-    mv /tmp/log_untouched.txt ../log_${repo}_untouched.txt
+    mv /tmp/log_touched.txt ../log_${src}_touched.txt
+    mv /tmp/log_untouched.txt ../log_${src}_untouched.txt
 
     cd ..
 }

Modified: grass-addons/tools/svn2git/rewrite.py
===================================================================
--- grass-addons/tools/svn2git/rewrite.py	2019-03-04 20:37:45 UTC (rev 74153)
+++ grass-addons/tools/svn2git/rewrite.py	2019-03-04 22:03:06 UTC (rev 74154)
@@ -5,6 +5,7 @@
 import requests
 import re
 msg = sys.stdin.read()
+msg = msg.replace('file:///opt/osgeo/svn/repos', 'https://svn.osgeo.org')
 
 def untouched(msg):
      with open('/tmp/log_untouched.txt', 'a') as f:
@@ -15,7 +16,8 @@
    msg.find('RT #') >= 0 or \
    msg.find('RT#') >= 0 or \
    msg.find('r3 bug') >= 0 or \
-   msg.find('r2 calc') >= 0:     
+   msg.find('r2 calc') >= 0 or \
+   msg.find('Debian bug') >= 0:
      sys.stdout.write(msg)
      untouched(msg)
      sys.exit(0)
@@ -97,8 +99,8 @@
             num += msg[newpos+1]
             newpos += 1
 
+        url = 'https://trac.osgeo.org/grass/ticket/' + num
         # check if ticket really exists
-        # url = 'https://trac.osgeo.org/grass/ticket/' + num
         # request = requests.get(url)
         # if request.status_code != 200:
         #     # does not exist
@@ -131,7 +133,7 @@
             num += msg[newpos+1]
             newpos += 1
 
-        if newpos+1 <= len(msg)-1 and msg[newpos+1] not in (' ', '\n'):
+        if newpos+1 <= len(msg)-1 and msg[newpos+1] not in (' ', '\n', ')'):
              oldpos = newpos + 1
              continue
         



More information about the grass-commit mailing list