用python写的一个SVN拉取小工具
本帖最后由 jg57055 于 2023-7-24 10:20 编辑第一次发帖还不会使用非常抱歉,本工具就是为了方便记录下拉取SVN的具体时间以及可以实现多个工程的拉取,快捷清理及查看日志功能软件已经打包稍后发送上来
import os
import tkinter as tk
import threading
import time
def gengxi1():
t.delete(1.0, tk.END)
with open('C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
print(b)
try:
c=os.system("TortoiseProc.exe /command:update /path:"+'"'+b+'"'+"/closeonend:1")
except:
print('更新失败')
t.insert('end','更新失败')
else:
if c==0:
print('更新成功')
t.insert('end', '更新成功')
a=(time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime()))
t.insert('end',a)
else:
print('更新失败')
t.insert('end', '更新失败')
def qingli():
t.delete(1.0, tk.END)
with open(r'C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
print(b)
try:
c = os.system("TortoiseProc.exe /command:cleanup /path:" + '"' + b + '"' + "/closeonend:1")
except:
t.insert('end', '清理失败')
else:
if c == 0:
t.insert('end', '清理成功')
else:
t.insert('end', '清理失败')
def rizhi():
t.delete(1.0, tk.END)
with open(r'C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
os.system("TortoiseProc.exe /command:log /path:" + '"' + b + '"' + "/closeonend:1")
def huanyuan():
t.delete(1.0, tk.END)
with open(r'C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
print(b)
os.system("TortoiseProc.exe /command:revert /path:" + '"' + b + '"' + "/closeonend:1")
a = (time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime()))
t.insert('end', a)
def dingwei():
t.delete(1.0, tk.END)
with open(r'C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
print(b)
os.system("TortoiseProc.exe /command:relocate /path:" + '"' + b + '"' + "/closeonend:1")
def bangzhu():
t.delete(1.0, tk.END)
with open(r'C:\gjg\svn.txt', 'w') as f:
f.write(txt.get())
b = txt.get()
print(b)
os.system("TortoiseProc.exe /command:help /path:" + '"' + b + '"' + "/closeonend:1")
def thread_it(func, *args):
'''将函数打包进线程'''
k = threading.Thread(target=func, args=args)
k.setDaemon(True)
k.start()
if __name__ == '__main__':
window=tk.Tk()
window.title('SVN')
window.geometry("200x250")
if not os.path.exists("C:/gjg"):
os.mkdir("C:/gjg")
try:
with open('C:\gjg\svn.txt', "r") as f:
e1=f.read()
print(e1)
except:
e1='地址,多个地址用*分隔'
t= tk.Text(window,width = '250', height=11,bg = 'LightBlue')
t.pack(side = 'bottom')
btn1 = tk.Button(window, text="更新svn", bg="orange", command=lambda: thread_it(gengxi1))
btn1.place(x=1, y=40)
btn2 = tk.Button(window, text="清理svn", bg="orange", command=qingli)
btn2.place(x=60, y=40)
btn3 = tk.Button(window, text="查看日志", bg="orange", command=lambda: thread_it(rizhi))
btn3.place(x=120, y=40)
btn4 = tk.Button(window, text="还原svn", bg="orange", command=lambda: thread_it(huanyuan))
btn4.place(x=1, y=70)
btn5 = tk.Button(window, text="重新定位", bg="orange", command=lambda: thread_it(dingwei))
btn5.place(x=60, y=70)
btn6 = tk.Button(window, text="帮助", bg="orange", command=lambda: thread_it(bangzhu))
btn6.place(x=130, y=70)
e1 = tk.StringVar(value=e1)
txt = tk.Entry(window, width=30,textvariable = e1)
txt.place(x =1,y=10)
window.mainloop()
操作界面如图,不同的工程地址间用*分开
下载:https://wwuz.lanzoum.com/ijvVy13c2uih 密码:61fg
第一次发帖还不会使用非常抱歉,本工具就是为了方便记录下拉取SVN的具体时间以及可以实现多个工程的拉取,快捷清理及查看日志功能软件已经打包稍后发送上来 下载:https://wwuz.lanzoum.com/ijvVy13c2uih 密码:61fg
感谢大佬原创作品 有个左右小箭头可以规范的插入python代码,建议楼主编辑一下帖子. 操作界面如图,不同的工程地址间用*分开 大白baymax 发表于 2023-7-24 10:02
有个左右小箭头可以规范的插入python代码,建议楼主编辑一下帖子.
好的 感谢 赏鸡腿,好东西阿,谢谢楼主分享
页:
[1]