[GRASS-SVN] r72393 - in grass-addons/tools: . svn2git

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 19 09:44:52 PDT 2018


Author: martinl
Date: 2018-03-19 09:44:52 -0700 (Mon, 19 Mar 2018)
New Revision: 72393

Added:
   grass-addons/tools/svn2git/
   grass-addons/tools/svn2git/readme.txt
   grass-addons/tools/svn2git/svn-contributors-to-git.py
Log:
add first notes about subversion to git migration

Added: grass-addons/tools/svn2git/readme.txt
===================================================================
--- grass-addons/tools/svn2git/readme.txt	                        (rev 0)
+++ grass-addons/tools/svn2git/readme.txt	2018-03-19 16:44:52 UTC (rev 72393)
@@ -0,0 +1,14 @@
+Notes about Subversion2Git migration
+------------------------------------
+
+0. Go to SVN dir repo
+
+1. Generate authors file
+
+$ svn log --xml --quiet | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' > authors.txt
+
+2. Update authors file based on contributors.csv and contributors_extra.csv files
+
+$ python3 svn-contributors-to-git.py
+
+3. TBD


Property changes on: grass-addons/tools/svn2git/readme.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id
\ 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/svn-contributors-to-git.py
===================================================================
--- grass-addons/tools/svn2git/svn-contributors-to-git.py	                        (rev 0)
+++ grass-addons/tools/svn2git/svn-contributors-to-git.py	2018-03-19 16:44:52 UTC (rev 72393)
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import fileinput
+
+def contribs_to_git(contribs_file, authors_file):
+    extra = True if 'extra' in contribs_file else False
+    contribs_data = {}
+    with open(contribs_file) as fd:
+        for line in fd.readlines()[1:]:
+            if not extra:
+                cvs_id,name,email,country,osgeo_id,rfc2_agreed = line.split(',')
+            else:
+                name,email,country,rfc2_agreed = line.split(',')
+            email = '@'.join(email.split(' ', -1))
+            names = list(map(lambda x: x.lower(), name.split(' ')))
+            if not extra:
+                names.append(osgeo_id)
+                names.append(cvs_id)
+            for uid in names:
+                if uid != '-':
+                    contribs_data[uid] = '{uid} = {name} {email}'.format(uid=uid, name=name, email=email)
+
+    with fileinput.FileInput(authors_file, inplace=True) as fd:
+        for line in fd:
+            author, rest = map(lambda x: x.strip(), line.split(' ', 1))
+            if author in contribs_data:
+                print(contribs_data[author])
+            else:
+                print(line, end='')
+
+### MAIN ###
+for cfile in ('contributors.csv', 'contributors_extra.csv'):
+    contribs_to_git(cfile, 'authors.txt')


Property changes on: grass-addons/tools/svn2git/svn-contributors-to-git.py
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ 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