@staticmethod<EOL><INDENT>def from_local_repository(repository_path, refspec=None):<DEDENT>
context = GitContext()<EOL>if refspec is None:<EOL><INDENT>sha_list = [_git("<STR_LIT>", "<STR_LIT>", "<STR_LIT>", _cwd=repository_path).replace(u"<STR_LIT:\n>", u"<STR_LIT>")]<EOL><DEDENT>else:<EOL><INDENT>sha_list = _git("<STR_LIT>", refspec, _cwd=repository_path).split()<EOL><DEDENT>for sha in sha_list:<EOL><INDENT>long_format = "<STR_LIT>"<EOL>raw_commit = _git("<STR_LIT>", sha, "<STR_LIT>", long_format, _cwd=repository_path).split("<STR_LIT:\n>")<EOL>(name, email, date, parents), commit_msg = raw_commit[<NUM_LIT:0>].split('<STR_LIT:\x00>'), "<STR_LIT:\n>".join(raw_commit[<NUM_LIT:1>:])<EOL>commit_parents = parents.split("<STR_LIT:U+0020>")<EOL>commit_is_merge_commit = len(commit_parents) > <NUM_LIT:1><EOL>changed_files = _git("<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", sha, _cwd=repository_path).split()<EOL>commit_date = arrow.get(ustr(date), "<STR_LIT>").datetime<EOL>commit_msg_obj = GitCommitMessage.from_full_message(commit_msg)<EOL>commit = GitCommit(context, commit_msg_obj, sha=sha, author_name=name,<EOL>author_email=email, date=commit_date, changed_files=changed_files,<EOL>parents=commit_parents, is_merge_commit=commit_is_merge_commit)<EOL>context.commits.append(commit)<EOL><DEDENT>return context<EOL>
Retrieves the git context from a local git repository.
        :param repository_path: Path to the git repository to retrieve the context from
        :param refspec: The commit(s) to retrieve