-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcivix_update_git_workflow.py
executable file
·65 lines (43 loc) · 1.98 KB
/
civix_update_git_workflow.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
56
57
58
59
60
61
62
63
64
65
#! /usr/bin/python
from subprocess import getstatusoutput
print(getstatusoutput("pwd"))
git_status = "git status"
git_status_return = getstatusoutput(git_status)
# todo check if word "repository" is found
if git_status_return[1].find("nothing to commit") < 0:
print("There are uncommitted changes which need to be resolved before continuing. Exiting:" + git_status_return[1])
quit()
git_pull = "git pull"
git_pull_return = getstatusoutput(git_pull)
print(git_pull_return)
print('\n\n checkout_branch:')
checkout_branch = "git checkout -b civix-upgrade"
checkout_branch_return = getstatusoutput(checkout_branch)
print(checkout_branch_return)
print('\n\n civix_upgrade:')
civix_upgrade = "civix upgrade --yes --no-interaction"
civix_upgrade_return = getstatusoutput(civix_upgrade)
# print(civix_upgrade_return)
print('\n\n git_add_all_unommitted_changes:')
git_add_all_unommitted_changes = "git add -A"
git_add_all_unommitted_changes_return = getstatusoutput(git_add_all_unommitted_changes)
print(git_add_all_unommitted_changes_return)
print('\n\n use_civix_version_as_commit_message:')
# use_civix_version_as_commit_message = 'echo "\"$(civix --version)\"" | xargs git commit -m'
info_name = "civix upgrade 23.02.1"
use_civix_version_as_commit_message = 'git commit -m "' + info_name + '"'
use_civix_version_as_commit_message_return = getstatusoutput(use_civix_version_as_commit_message)
# print(use_civix_version_as_commit_message_return)
push_branch = "git push --set-upstream origin civix-upgrade"
push_branch_return = getstatusoutput(push_branch)
print(push_branch_return)
print("\n\n")
git_checkout_master = "git checkout master"
git_checkout_master_return = getstatusoutput(git_checkout_master)
delete_local_branch = "git branch -d civix-upgrade"
delete_local_branch_return = getstatusoutput(delete_local_branch)
print("Suggested branch name:\n" + info_name)
## check if repo is on github
# github create PR
# github merge PR
# delete_branch_remote = "git push origin --delete civix-upgrade"