def __checkout_branch(self, branch, path, repo, sudo, owner):
        branch_name = "# On branch %s" % branch
        if branch and not branch_name in self.execute("git --git-dir=\"%s/.git\" --work-tree=\"%s\" status" % (path, path),
                                                      sudo=True, stdout=False):
            self.log("Repository for %s is not in branch %s ! Switching..." % (repo, branch))
            self.execute('git --git-dir="%s/.git" --work-tree="%s" checkout %s' % (path, path, branch), sudo=sudo, user=owner)
            self.log("Repository %s currently in branch %s!" % (repo, branch))
dataset/ETHPy150Open python-provy/provy/provy/more/debian/vcs/git.py/GitRole.__checkout_branch/original