Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talanta repair git pull last commit #1077

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions walle/service/git/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ def init(self, url, branch="master"):
os.makedirs(self.path)
# git clone
if self.is_git_dir():
self.checkout_2_branch(branch)
return self.pull()
#self.checkout_2_branch(branch)
#return self.pull()
return self.checkout_pull_branch(branch)
else:
return self.clone(url)

Expand Down Expand Up @@ -131,6 +132,16 @@ def checkout_2_branch(self, branch):
'''
PyRepo(self.path).git.checkout(branch)

def checkout_pull_branch(self, branch):
'''
切换到某个分支并拉取最新代码

@param branch:
@return:
'''
PyRepo(self.path).git.checkout(branch)
PyRepo(self.path).git.pull()

def checkout_2_commit(self, branch, commit):
'''
切换分支的某个commit
Expand Down