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)
评论列表
文章目录