github: Remove method `GithubAPI::get_branch_commits`
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 21 Jun 2019 02:27:06 +0000 (22:27 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 11 Jul 2019 01:42:16 +0000 (21:42 -0400)
Let clients handle that.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/github/api.nit
lib/github/tests/test_api.nit

index 8f439f1..c1fa99f 100644 (file)
@@ -305,30 +305,6 @@ class GithubAPI
                return get("/repos/{repo.full_name}/branches/{name}").as(nullable Branch)
        end
 
-       # List all commits in `self`.
-       #
-       # This can be long depending on the branch size.
-       # Commit are returned in an unspecified order.
-       fun get_branch_commits(branch: Branch): Array[Commit] do
-               var res = new Array[Commit]
-               var done = new HashSet[String]
-               var todos = new Array[Commit]
-               todos.add branch.commit
-               loop
-                       if todos.is_empty then break
-                       var commit = todos.pop
-                       if done.has(commit.sha) then continue
-                       done.add commit.sha
-                       res.add commit
-                       var parents = commit.parents
-                       if parents == null then continue
-                       for parent in parents do
-                               todos.add parent
-                       end
-               end
-               return res
-       end
-
        # Get the Github commit with `sha`.
        #
        # Returns `null` if the commit cannot be found.
index 02ccc22..235a170 100644 (file)
@@ -272,8 +272,6 @@ class TestGithubAPI
                assert branch.name == "master"
        end
 
-       # TODO branch commits
-
        fun test_get_commit is test do
                var commit = api.get_commit(repo, "64ce1f")
                assert commit isa Commit