forked from JOJ/Joint-Teapot
		
	feat: set reset target
This commit is contained in:
		
							parent
							
								
									3550042c8e
								
							
						
					
					
						commit
						16028d8195
					
				|  | @ -568,7 +568,10 @@ def joj3_all( | ||||||
|         git_push_ok = False |         git_push_ok = False | ||||||
|         while not git_push_ok: |         while not git_push_ok: | ||||||
|             repo_path = tea.pot.git.repo_clean_and_checkout( |             repo_path = tea.pot.git.repo_clean_and_checkout( | ||||||
|                 repo_name, "grading", clean_git_lock=True |                 repo_name, | ||||||
|  |                 "grading", | ||||||
|  |                 clean_git_lock=True, | ||||||
|  |                 reset_target="origin/grading", | ||||||
|             ) |             ) | ||||||
|             repo: Repo = tea.pot.git.get_repo(repo_name) |             repo: Repo = tea.pot.git.get_repo(repo_name) | ||||||
|             if "grading" not in repo.remote().refs: |             if "grading" not in repo.remote().refs: | ||||||
|  |  | ||||||
|  | @ -75,8 +75,10 @@ class Git: | ||||||
|         self, |         self, | ||||||
|         repo_name: str, |         repo_name: str, | ||||||
|         checkout_dest: str, |         checkout_dest: str, | ||||||
|  |         *, | ||||||
|         auto_retry: bool = True, |         auto_retry: bool = True, | ||||||
|         clean_git_lock: bool = False, |         clean_git_lock: bool = False, | ||||||
|  |         reset_target: str = "origin/master", | ||||||
|     ) -> str: |     ) -> str: | ||||||
|         repo_dir = os.path.join(self.repos_dir, repo_name) |         repo_dir = os.path.join(self.repos_dir, repo_name) | ||||||
|         repo = self.get_repo(repo_name) |         repo = self.get_repo(repo_name) | ||||||
|  | @ -92,7 +94,7 @@ class Git: | ||||||
|                         if os.path.exists(lock_path): |                         if os.path.exists(lock_path): | ||||||
|                             os.remove(lock_path) |                             os.remove(lock_path) | ||||||
|                 repo.git.fetch("--tags", "--all", "-f") |                 repo.git.fetch("--tags", "--all", "-f") | ||||||
|                 repo.git.reset("--hard", "origin/master") |                 repo.git.reset("--hard", reset_target) | ||||||
|                 repo.git.clean("-d", "-f", "-x") |                 repo.git.clean("-d", "-f", "-x") | ||||||
|                 repo.git.checkout(checkout_dest) |                 repo.git.checkout(checkout_dest) | ||||||
|                 retry_interval = 0 |                 retry_interval = 0 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user