def _file_contents(self, path, rev=None):
        """
        Get content of `path` at `rev`.

        If `rev` is None, the current working version is returned.
        """
        rev = self._resolve_rev(rev)
        prefix_from_repo_root = self._git_cmd('rev-parse --show-prefix')
        if not rev:
            with open(path) as fp:
                result = ''.join(fp)
            return result
        else:
            path = os.path.join(prefix_from_repo_root, path)
            result = self._git_cmd('show %s:"%s"' % (rev, path))
            # `git show` messes with blank lines at ends of files,
            # so we have to append our own for non-empty files
            if result:
                result = result + '\n'
            return result
dataset/ETHPy150Open jenanwise/codequality/codequality/scmhandlers.py/GitHandler._file_contents/original