docs: def from_local_repository(repository_path, refspec=None):
          """ 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
          """
  
          context = GitContext()
  
          # If no refspec is defined, fallback to the last commit on the current branch
          if refspec is None:
              # We tried many things here e.g.: defaulting to e.g. HEAD or HEAD^... (incl. dealing with
              # repos that only have a single commit - HEAD^... doesn't work there), but then we still get into
              # problems with e.g. merge commits. Easiest solution is just taking the SHA from `git log -1`.
              sha_list = [_git("log", "-1", "--pretty=%H", _cwd=repository_path).replace(u"\n", u"")]
          else:
              sha_list = _git("rev-list", refspec, _cwd=repository_path).split()
  
          for sha in sha_list:
              # Get info from the local git repository: https://git-scm.com/docs/pretty-formats
              long_format = "--pretty=%aN%x00%aE%x00%ai%x00%P%n%B"
              raw_commit = _git("log", sha, "-1", long_format, _cwd=repository_path).split("\n")
  
              (name, email, date, parents), commit_msg = raw_commit[0].split('\x00'), "\n".join(raw_commit[1:])
  
              commit_parents = parents.split(" ")
              commit_is_merge_commit = len(commit_parents) > 1
  
              # changed files in last commit
              changed_files = _git("diff-tree", "--no-commit-id", "--name-only", "-r", sha, _cwd=repository_path).split()
  
              # "YYYY-MM-DD HH:mm:ss Z" -> ISO 8601-like format
              # Use arrow for datetime parsing, because apparently python is quirky around ISO-8601 dates:
              # http://stackoverflow.com/a/30696682/381010
              commit_date = arrow.get(ustr(date), "YYYY-MM-DD HH:mm:ss Z").datetime
  
              # Create Git commit object with the retrieved info
              commit_msg_obj = GitCommitMessage.from_full_message(commit_msg)
  
              commit = GitCommit(context, commit_msg_obj, sha=sha, author_name=name,
                                 author_email=email, date=commit_date, changed_files=changed_files,
                                 parents=commit_parents, is_merge_commit=commit_is_merge_commit)
  
              context.commits.append(commit)
  
          return context