[GRASS-SVN] r74134 - grass-addons/tools/svn2git
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 25 15:09:40 PST 2019
Author: martinl
Date: 2019-02-25 15:09:40 -0800 (Mon, 25 Feb 2019)
New Revision: 74134
Modified:
grass-addons/tools/svn2git/3-rewrite-messages.sh
grass-addons/tools/svn2git/rewrite.py
Log:
svn2git: tunig rewrite.py
Modified: grass-addons/tools/svn2git/3-rewrite-messages.sh
===================================================================
--- grass-addons/tools/svn2git/3-rewrite-messages.sh 2019-02-25 16:50:41 UTC (rev 74133)
+++ grass-addons/tools/svn2git/3-rewrite-messages.sh 2019-02-25 23:09:40 UTC (rev 74134)
@@ -14,7 +14,7 @@
# 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_touched.txt ../log_${repo}_touched.txt
mv /tmp/log_untouched.txt ../log_${repo}_untouched.txt
cd ..
Modified: grass-addons/tools/svn2git/rewrite.py
===================================================================
--- grass-addons/tools/svn2git/rewrite.py 2019-02-25 16:50:41 UTC (rev 74133)
+++ grass-addons/tools/svn2git/rewrite.py 2019-02-25 23:09:40 UTC (rev 74134)
@@ -11,7 +11,11 @@
f.write('Message is:\n' + msg + '\n')
# Don't touch messages that reference other databases
-if msg.find('RT bug ') >= 0 or msg.find('RT #') >= 0 or msg.find('RT#') >= 0:
+if msg.find('RT bug ') >= 0 or \
+ msg.find('RT #') >= 0 or \
+ msg.find('RT#') >= 0 or \
+ msg.find('r3 bug') >= 0 or \
+ msg.find('r2 calc') >= 0:
sys.stdout.write(msg)
untouched(msg)
sys.exit(0)
@@ -76,7 +80,7 @@
if newpos >= 0:
if newpos == len(msg) - 1:
break
- if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+ if not(msg[newpos+1] >= '0' and msg[newpos+1] <= '9'):
oldpos = newpos + 1
continue
@@ -89,7 +93,7 @@
# check if ticket really exists
num = ''
while True:
- if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+ if not(msg[newpos+1] >= '0' and msg[newpos+1] <= '9'):
break
num += msg[newpos+1]
newpos += 1
@@ -115,17 +119,22 @@
if newpos >= 0:
if newpos == len(msg) - 1:
break
- if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+ if (newpos > 0 and msg[newpos-1] != ' ') or \
+ not(msg[newpos+1] >= '0' and msg[newpos+1] <= '9'):
oldpos = newpos + 1
continue
num = ''
while True:
- if not(msg[newpos+1] >= '1' and msg[newpos+1] <= '9'):
+ if not(msg[newpos+1] >= '0' and msg[newpos+1] <= '9'):
break
num += msg[newpos+1]
newpos += 1
+ if newpos+1 <= len(msg)-1 and msg[newpos+1] not in (' ', '\n'):
+ oldpos = newpos + 1
+ continue
+
url = 'https://trac.osgeo.org/grass/changeset/' + num
msg = msg[0:newpos-len(num)] + url + msg[newpos+1:]
oldpos = newpos
More information about the grass-commit
mailing list