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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 17 07:54:04 PST 2019


Author: martinl
Date: 2019-02-17 07:54:04 -0800 (Sun, 17 Feb 2019)
New Revision: 74097

Modified:
   grass-addons/tools/svn2git/rewrite.py
Log:
svn2git: rewrite also revision URL

Modified: grass-addons/tools/svn2git/rewrite.py
===================================================================
--- grass-addons/tools/svn2git/rewrite.py	2019-02-17 15:31:14 UTC (rev 74096)
+++ grass-addons/tools/svn2git/rewrite.py	2019-02-17 15:54:04 UTC (rev 74097)
@@ -22,10 +22,10 @@
      untouched(msg)
      sys.exit(0)
 
+# Fix '#1234'
 oldpos = 0
 old_msg = msg
 while True:
-
     # # We already have reference to github pull requests written like
     # # 'github #1234', so skip them
     # newpos = msg.find('github #', oldpos)
@@ -107,6 +107,31 @@
 
     break
 
+# Fix 'r1234'
+oldpos = 0
+old_msg = msg
+while True:
+    newpos = msg.find('r', oldpos)
+    if newpos >= 0:
+        if newpos == len(msg) - 1:
+            break
+        if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+            oldpos = newpos + 1
+            continue
+
+        num = ''
+        while True:
+            if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+                break
+            num += msg[newpos+1]
+            newpos += 1
+
+        url = 'https://trac.osgeo.org/grass/changeset/' + num            
+        msg = msg[0:newpos-len(num)] + url + msg[newpos+1:]
+        oldpos = newpos
+        continue
+    break
+
 if msg != old_msg:
     with open('/tmp/log_touched.txt', 'a') as f:
         f.write('Old message was:\n' + old_msg + 'New message is:\n' + msg + '\n')



More information about the grass-commit mailing list