Git.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:HelloShell 作者: wl879 项目源码 文件源码
def cmd(self, cmd, force=False, no_work=False):
        if self.work_tree and no_work == False:
            cmd = re.sub(r"^git ", "git --work-tree="+self.work_tree+" --git-dir="+os.path.join(self.work_tree, ".git")+" ", cmd.strip())

        if self._enable_echo:
            Echo.echo("#[hello git #] "+cmd)

        if not force and not os.path.exists(os.path.join(self.work_tree, ".git")):
            (status, output) = (1, "Not a git repository: !["+self.work_tree+"]")
        else:
            (status, output) = commands.getstatusoutput(cmd)

        if self._enable_echo:
            self._enable_echo = False
            Echo.echo("#[hello git -> " + output.replace("\n", "\nhello git -> ")+"]")
            if status != 0:
                exit(status)
        return (status, output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号