def callGit(self, workspacePath, *args):
cmdLine = ['git']
cmdLine.extend(args)
try:
output = subprocess.check_output(cmdLine, cwd=os.path.join(os.getcwd(), workspacePath, self.__dir),
universal_newlines=True, stderr=subprocess.DEVNULL)
except subprocess.CalledProcessError as e:
raise BuildError("git error:\n Directory: '{}'\n Command: '{}'\n'{}'".format(
os.path.join(workspacePath, self.__dir), " ".join(cmdLine), e.output.rstrip()))
return output
# Get GitSCM status. The purpose of this function is to return the status of the given directory
#
# return values:
# - error: The SCM is in a error state. Use this if git returned a error code.
# - dirty: SCM is dirty. Could be: modified files, switched to another branch/tag/commit/repo, unpushed commits.
# - clean: Same branch/tag/commit as specified in the recipe and no local changes.
# - empty: Directory is not existing.
#
# This function is called when build with --clean-checkout. 'error' and 'dirty' SCMs are moved to attic,
# while empty and clean directories are not.
评论列表
文章目录