def load_commits(range)
      base_commit = nil
      commits = []
      last_commit = nil
      loop do
        new_commits = ::Octokit.commits(@path, nil, :last_sha => last_commit, :per_page => 100, :top => range.last)
        break if new_commits.empty?

        base_commit_index = new_commits.find_index do |commit|
          commit.sha == range.first
        end unless range.first == ''
        unless base_commit_index.nil?
          if base_commit_index > 0
            commits += new_commits[0..base_commit_index-1]
          end
          base_commit = new_commits[base_commit_index]
          break
        end
        commits += new_commits
        last_commit = new_commits.last.sha
      end

      [base_commit, commits]
    end
def load_commits(range)
      base_commit = nil
      commits = []
      last_commit = nil
      loop do
        new_commits = ::Octokit.commits(@path, nil, :last_sha => last_commit, :per_page => 100, :top => range.last)
        break if new_commits.empty?

        base_commit_index = new_commits.find_index do |commit|
          commit.sha == range.first
        end unless range.first == ''
        unless base_commit_index.nil?
          if base_commit_index > 0
            commits += new_commits[0..base_commit_index-1]
          end
          base_commit = new_commits[base_commit_index]
          break
        end
        commits += new_commits
        last_commit = new_commits.last.sha
      end

      [base_commit, commits]
    end
This method uses Octokit to load all commits from the given commit range

 @note GitHub API is currently limited to 60 calls a minute, so you won't
       be able to query branches with more than 2100 commits (35 commits
       per call).
 @param [String, Range] range The range of commits for which the commits
        should be loaded. This may be given as a string
        (`'master..development'`), a range (`'master'..'development'`)
        or as a single ref (`'master'`). A single ref name means all
        commits reachable from that ref.
 @return [Hashie::Mash, nil] The base commit of the requested range or
         `nil` if the the range starts at the beginning of the history
 @return [Array<Hashie::Mash>] All commits in the given commit range
 @see Octokit::Commits#commits