diff --git a/walle/service/git/repo.py b/walle/service/git/repo.py index 1fa319ec..e0d3b1a5 100644 --- a/walle/service/git/repo.py +++ b/walle/service/git/repo.py @@ -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) @@ -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