Browse Source

增加了与远程仓库断开连接的功能

Huan 5 years ago
parent
commit
48f77226c7
2 changed files with 13 additions and 1 deletions
  1. 7 1
      GIT.py
  2. 6 0
      Git_Ctrl.py

+ 7 - 1
GIT.py

@@ -240,7 +240,7 @@ def Main():
     a_y += 1
     tkinter.Button(top, bg=bbg, fg=fg, text='commit补丁', command=cherry_pick, font=FONT, width=width_B,
                    height=height_B).grid(column=a_x, row=a_y, sticky=tkinter.E + tkinter.W)
-    tkinter.Button(top, bg=bbg, fg=fg, text='删除远程仓库', command=cherry_pick, font=FONT, width=width_B,
+    tkinter.Button(top, bg=bbg, fg=fg, text='删除远程仓库', command=Del_remote, font=FONT, width=width_B,
                    height=height_B).grid(column=a_x+1, row=a_y, sticky=tkinter.E + tkinter.W)
     tkinter.Button(top, bg=bbg, fg=fg, text='工作区列表', command=lambda :not_Args(Git.Stash_List), font=FONT, width=width_B,
                    height=height_B).grid(column=a_x+2, row=a_y, sticky=tkinter.E + tkinter.W)
@@ -366,6 +366,12 @@ def Bind_remote():
     do_Sys(Git.Bind_remote, (get_Name(), Local, Remote))
     update_Git_Dir()
 
+def Del_remote():
+    global RemoteSSH, RemoteName, Git
+    name = RemoteName.get()
+    do_Sys(Git.Del_remote, (get_Name(), name))
+    update_Git_Dir()
+
 def Add_remote():
     global RemoteSSH, RemoteName, Git
     SSH = RemoteSSH.get()

+ 6 - 0
Git_Ctrl.py

@@ -138,6 +138,9 @@ class git_Repo:#git的基类
     def cherry_pick(self,commit):#补丁
         return subprocess.Popen(f'echo 补丁... && {git_path} cherry-pick {commit} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
 
+    def Del_remote(self,remote_name):
+        return subprocess.Popen(f'echo 删除远程仓库... && {git_path} remote remove {remote_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+
     def Add_remote(self,remote,remote_name):
         return subprocess.Popen(f'echo 添加远程仓库... && {git_path} remote add {remote_name} {remote} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
 
@@ -361,6 +364,9 @@ class git_Ctrol:
     def cherry_pick(self,name,commit):
         return self.get_git(name).cherry_pick(commit)
 
+    def Del_remote(self,name,remote_name):
+        return self.get_git(name).Del_remote(remote_name)
+
     def Add_remote(self,name,remote,remote_name):
         return self.get_git(name).Add_remote(remote,remote_name)