@contextmanager
    def get_historian(self, sha, base_path):
        p = []
        change = {}
        next_path = []

        def name_status_gen():
            p[:] = [self.repo.log_pipe('--pretty=format:%n%H', '--name-status',
                                       sha, '--', base_path)]
            f = p[0].stdout
            for l in f:
                if l == '\n': continue
                old_sha = l.rstrip('\n')
                for l in f:
                    if l == '\n': break
                    _, path = l.rstrip('\n').split('\t', 1)
                    while path not in change:
                        change[path] = old_sha
                        if next_path == [path]: yield old_sha
                        try:
                            path, _ = path.rsplit('/', 1)
                        except ValueError:
                            break
            f.close()
            p[0].terminate()
            p[0].wait()
            p[:] = []
            while True: yield None
        gen = name_status_gen()

        def historian(path):
            try:
                return change[path]
            except __HOLE__:
                next_path[:] = [path]
                return gen.next()
        yield historian

        if p:
            p[0].stdout.close()
            p[0].terminate()
            p[0].wait()
dataset/ETHPy150Open hvr/trac-git-plugin/tracext/git/PyGIT.py/Storage.get_historian