Yuvipanda has uploaded a new change for review.
https://gerrit.wikimedia.org/r/140650
Change subject: [WIP] Add script that makes beta branch
......................................................................
[WIP] Add script that makes beta branch
Change-Id: Ie839ab8525d5cc037b478861d04c23af928ad7d4
---
A scripts/make-beta.py
1 file changed, 63 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/50/140650/1
diff --git a/scripts/make-beta.py b/scripts/make-beta.py
new file mode 100644
index 0000000..fb984b4
--- /dev/null
+++ b/scripts/make-beta.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+import sh
+import os
+
+PATH_PREFIX = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
+
+
+def p(*path_fragments):
+ return os.path.join(PATH_PREFIX, *path_fragments)
+
+sh.git.reset('--hard')
+
+
+def mv_dir(dir_path):
+ sh.git.mv(
+ p(dir_path, 'src/main/java/org/wikipedia'),
+ p(dir_path, 'src/main/java/org/beta')
+ )
+
+ sh.mkdir('-p', p(dir_path, 'src/main/java/org/wikipedia'))
+
+ sh.git.mv(
+ p(dir_path, 'src/main/java/org/beta'),
+ p(dir_path, 'src/main/java/org/wikipedia')
+ )
+
+
+def do_replacements(lines):
+ for line in lines:
+ if 'org.wikipedia' in line:
+ yield line.replace('org.wikipedia', 'org.wikipedia.beta')
+ else:
+ yield line
+
+
+def transform_file(file_path):
+ f = open(file_path)
+ lines = f.readlines()
+ f.close()
+ of = open(file_path, 'w')
+ for line in do_replacements(lines):
+ of.write(line)
+ of.close()
+ print file_path
+
+
+def transform_project(dir_path):
+ mv_dir(dir_path)
+ for root, dirs, files in os.walk(p(dir_path,
'src/main/java/org/wikipedia/beta')):
+ for file_name in files:
+ file_path = os.path.join(root, file_name)
+ transform_file(file_path)
+
+ for root, dirs, files in os.walk(p(dir_path, 'res')):
+ for file_name in files:
+ if file_name.endswith('.xml'):
+ file_path = os.path.join(root, file_name)
+ transform_file(file_path)
+
+ transform_file(p(dir_path, 'AndroidManifest.xml'))
+
+transform_project('wikipedia')
+transform_project('wikipedia-it')
--
To view, visit https://gerrit.wikimedia.org/r/140650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie839ab8525d5cc037b478861d04c23af928ad7d4
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits