Browse Source

push -u 版本分支

liuyuqi-dellpc 1 year ago
parent
commit
9dd357f02a

+ 3 - 3
repo_sync/platform/coding/coding.py

@@ -182,7 +182,7 @@ class CodingIE(BasePlatform):
         result = subprocess.run(
             ['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_coding {current_branch}')
+        os.system(f'git pull -u origin_coding {current_branch}')
         os.system('git remote remove origin_coding')
         os.chdir('..')
         print('pull success')
@@ -203,9 +203,9 @@ class CodingIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_coding {current_branch}')
+        os.system(f'git pull -u origin_coding {current_branch}')
         
-        os.system('git push -u origin_coding')
+        os.system(f'git push -u origin_coding {current_branch}')
         os.system('git remote remove origin_coding')
         os.chdir('..')
         print('push success')

+ 3 - 1
repo_sync/platform/gitea.py

@@ -11,7 +11,7 @@
 class GiteaIE(object):
     def __init__(self, username:str, token:str, host:str =None ,params: dict = None) -> None:
         super().__init__(username=username,token=token)
-        self._host = 'https://git.yoqi.me' if host is None else host
+        self._host = 'https://gitea.com' if host is None else host
 
     def create_repo(self, repo_name: str):
         pass
@@ -24,8 +24,10 @@ class GiteaIE(object):
 
     def clone(self):
         pass
+
     def push(self, local_repo_path: str):
         pass
+        
     def pull(self, local_repo_path: str):
         return super().pull(local_repo_path)
     

+ 3 - 3
repo_sync/platform/gitee.py

@@ -83,7 +83,7 @@ class GiteeIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gitee {current_branch}')
+        os.system(f'git pull -u origin_gitee {current_branch}')
         os.system('git remote remove origin_gitee')
         os.chdir('..')
         print('pull from gitee success')
@@ -100,9 +100,9 @@ class GiteeIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gitee {current_branch}')
+        os.system(f'git pull -u origin_gitee {current_branch}')
         
-        os.system('git push -u origin_gitee')
+        os.system(f'git push -u origin_gitee {current_branch}')
         os.system('git remote remove origin_gitee')
         os.chdir('..')
         print('push to gitee success')

+ 3 - 3
repo_sync/platform/github.py

@@ -81,7 +81,7 @@ class GithubIE(BasePlatform):
         result = subprocess.run(
             ['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_github {current_branch}')
+        os.system(f'git pull -u origin_github {current_branch}')
         os.system('git remote remove origin_github')
         os.chdir('..')
         print('pull from github success')
@@ -105,9 +105,9 @@ class GithubIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_github {current_branch}')
+        os.system(f'git pull -u origin_github {current_branch}')
         
-        os.system('git push -u origin_github')
+        os.system(f'git push -u origin_github {current_branch}')
         os.system('git remote remove origin_github')
         os.chdir('..')
 

+ 4 - 4
repo_sync/platform/gitlab.py

@@ -15,7 +15,7 @@ from repo_sync.repo import Repo
 class GitlabIE(BasePlatform):
     """gitlab async"""
 
-    def __init__(self, username:str, token:str,host:str =None ,params: dict = None) -> None:
+    def __init__(self, username:str, token:str, host:str =None, params: dict = None) -> None:
         super().__init__(username=username, token=token)
         self.host = self.host or 'https://gitlab.com'
         self.sess.headers.update({"Authorization": f"Bearer {self.token}"})
@@ -100,7 +100,7 @@ class GitlabIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gitlab {current_branch}')
+        os.system(f'git pull -u origin_gitlab {current_branch}')
         os.system("git remote remove origin_gitlab")
         os.chdir("..")
         print(f"pull repo:{self.username}/{repo_name} from gitlab success")
@@ -125,9 +125,9 @@ class GitlabIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gitlab {current_branch}')
+        os.system(f'git pull -u origin_gitlab {current_branch}')
         
-        os.system("git push -u origin_gitlab")
+        os.system(f"git push -u origin_gitlab {current_branch}")
         os.system("git remote remove origin_gitlab")
         os.chdir("..")
         print(f"push repo:{self.username}/{repo_name} to gitlab success")

+ 3 - 3
repo_sync/platform/gogs.py

@@ -100,7 +100,7 @@ class GogsIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gogs {current_branch}')
+        os.system(f'git pull -u origin_gogs {current_branch}')
         os.system('git remote remove origin_gogs')
         os.chdir('..')
     
@@ -119,8 +119,8 @@ class GogsIE(BasePlatform):
         )
         result = subprocess.run(['git', 'symbolic-ref', '--short', 'HEAD'], capture_output=True, text=True)
         current_branch = result.stdout.strip()
-        os.system(f'git pull origin_gogs {current_branch}')
-        os.system('git push -u origin_gogs')
+        os.system(f'git pull -u origin_gogs {current_branch}')
+        os.system(f'git push -u origin_gogs {current_branch}')
         os.system('git remote remove origin_gogs')
         os.chdir('..')