Initial working version
Succesfully tested on Gerrit
http://review.cyanogenmod.org/#/q/message:%22do+not+merge:+automatic+translation+import%22+owner:%22Marco+Brohet+%253Ctherbom%2540gmail.com%253E%22,n,z
diff --git a/create_cm_caf_xml.py b/create_cm_caf_xml.py
index f101d8c..6232114 100755
--- a/create_cm_caf_xml.py
+++ b/create_cm_caf_xml.py
@@ -5,6 +5,8 @@
# Generates cm_caf.xml based on the strings that were added to
# CM's *.xml compared to AOSP's *.xml
+import git
+import os
from xml.dom import minidom
def create_cm_caf_xml(strings_base, strings_cm, path):
@@ -82,3 +84,14 @@
if t == 4:
f.write('</resources>')
f.close()
+
+def push_as_commit(path, name):
+ path = os.getcwd() + '/' + path
+ repo = git.Repo(path)
+ repo.git.add(path)
+ try:
+ repo.git.commit(m='Crowdin translation import')
+ repo.git.push('ssh://cobjeM@review.cyanogenmod.org:29418/' + name, 'HEAD:refs/for/cm-11.0')
+ print 'Succesfully pushed commit for' + name
+ except:
+ print 'No commit pushed (probably empty?) for ' + name