-
Notifications
You must be signed in to change notification settings - Fork 35
/
commitScript.py
executable file
·55 lines (45 loc) · 1.57 KB
/
commitScript.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
from shutil import copyfile
import sys
import datetime
import ntpath
import time
import subprocess
print( "Usage: python commitScript branch \"commit string\"");
if len(sys.argv) < 1:
print "Not enough parameters passed"
exit();
##define CABBAGE_VERSION "Cabbage(64bit) v2.0.00"
patch_number = 0
patch_string=''
newFiletext = ''
with open('./Source/CabbageCommonHeaders.h') as f:
for line in f.readlines():
if 'Cabbage(64bit) v2.0.' in line:
patch_number = int(line[line.rfind('.')+1:].strip().replace('"', ''))
patch_number+=1
if patch_number<10:
patch_string = str(patch_number).zfill(2)
print(patch_string)
line = '#define CABBAGE_VERSION "Cabbage(64bit) v2.0.'+patch_string+'"\n'
newFiletext+=line
with open('./Source/CabbageCommonHeaders.h', "w") as f:
f.write(newFiletext)
gitCommand = 'git add JuceLibraryCode/AppConfig.h'
print gitCommand
process = subprocess.Popen(gitCommand, shell=True, stdout=subprocess.PIPE)
process.wait()
gitCommand = 'git add Source'
print gitCommand
process = subprocess.Popen(gitCommand, shell=True, stdout=subprocess.PIPE)
process.wait()
print gitCommand
process = subprocess.Popen(gitCommand, shell=True, stdout=subprocess.PIPE)
process.wait()
gitCommand = 'git commit -m \"'+sys.argv[2]+'\"'
print gitCommand
process = subprocess.Popen(gitCommand, shell=True, stdout=subprocess.PIPE)
process.wait()
gitCommand = 'git push origin '+sys.argv[1]
process = subprocess.Popen(gitCommand, shell=True, stdout=subprocess.PIPE)
process.wait()