コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
ファイル: tree.py プロジェクト: 0X1A/servo
 def setup_git(self):
     assert vcs.is_git_repo(self.tests_root)
     return vcs.get_git_func(self.tests_root)