def open(self): """Return a File object opened for reading the file contents, or the contents of the file when last committed, if use_comitted is true.""" if self.use_committed: git = vcs.get_git_func(os.path.dirname(__file__)) blob = git("show", "HEAD:%s" % self.rel_path) file_obj = ContextManagerStringIO(blob) else: file_obj = open(self.path) return file_obj
def setup_git(self): assert vcs.is_git_repo(self.tests_root) return vcs.get_git_func(self.tests_root)