代码拉取完成,页面将自动刷新
#!/usr/bin/python3
#-*-coding:utf-8-*-
###############################################################
## Name : git_push
## Author :
## Date :
## Description:
##
##
###############################################################
import sys
import os
import re
import argparse
def main():
fl_list = []
print("STEP.1: git pull")
os.system("git pull")
print("STEP.2: git status")
os.system("git status")
hand = os.popen("git status").readlines()
for line in hand:
line = line.strip()
res = re.search(r"modified:\s+([\/\.\w]+)", line)
if res:
fl = res.group(1)
fl_list.append(fl)
print("STEP.3: sel push file")
i = 0
for fl in fl_list:
print(" {0}: {1}".format(i, fl))
i+=1
if len(fl_list) == 0:
print("NO FILE NEED PUSH, EXIT")
sys.exit(0)
inp = input("please sel 0 1 .. or all (default is all): ")
cmt = input("please input commit (default is update): ")
add_line = "git add "
cmt_line = "git commit -m "
psh_line = "git push"
if inp == "" or inp == "all":
for fl in fl_list:
add_line += fl + " "
else:
num_list = inp.split(" ")
for num in num_list:
add_line += fl_list[int(num)] + " "
if cmt == "":
cmt = "update"
cmt_line += "\"{}\"".format(cmt)
print("STEP.4: git add/commit/push")
os.system(add_line)
os.system(cmt_line)
os.system(psh_line)
if __name__ == "__main__":
print("%s is working" % __file__)
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。