def get_influence(self, task): tools = Tools(task, task.joltdir) path = tools.expand_path(self.path) git_abs = self._find_dotgit(path) git_rel = git_abs[len(self.joltdir) + 1:] relpath = path[len(git_abs) + 1:] relpath = fs.as_posix(relpath) if relpath else relpath if not fs.path.exists(path): return "{0}/{1}: N/A".format(git_rel, relpath) try: git = new_git(None, git_abs, git_rel) return "{0}/{1}: {2}".format(git_rel, relpath, git.tree_hash(path=relpath or "/")) except JoltCommandError as e: stderr = "\n".join(e.stderr) if "exists on disk, but not in" in stderr: return "{0}/{1}: N/A".format(git_rel, relpath) raise e
def is_influenced_by(self, task, path): tools = Tools(task, task.joltdir) gitpath = tools.expand_path(self.path) return fs.is_relative_to(path, gitpath)