karagenit / forks

Find Most Updated Forks of a Github Repository
http://caleb.techhounds.com/forks
MIT License
1 stars 0 forks source link

Finding Commit Diff from Parent Repo #17

Open karagenit opened 7 years ago

karagenit commented 7 years ago

Can't list commits of a repo - can only get refs and commitComments. Could run a separate query with a random commit's ID and then get it's history.

Only way to look at commits:

query ($owner: String!, $name: String!) {
  repository(owner: $owner, name: $name) {
    defaultBranchRef {
      id
      name
      target {
        id
        commitUrl
      }
    }
    refs(refPrefix: "refs/heads/", last: 1) {
      edges {
        node {
          id
          name
          target {
            commitUrl
            __typename
          }
        }
      }
    }
    commitComments(last: 1) {
      edges {
        node {
          commit {
            commitUrl
            committedDate
            history(first: 1) {
              edges {
                node {
                  commitUrl
                }
              }
            }
          }
        }
      }
    }
  }
}
karagenit commented 7 years ago

Comparing Commits:

https://developer.github.com/v3/repos/commits/#compare-two-commits

Doesn't appear to exist in the GraphQL API. Additionally, doing this with the v3 API would cost 1 request per comparison, which isn't really feasible.

karagenit commented 7 years ago

Re: comparing commits:

We could only run the comparison on repos above a certain point threshold, see #18

karagenit commented 7 years ago
... on Commit

from a ref connection...

karagenit commented 7 years ago

^^^

Can get the master refs of both the parent and each fork, and compare them. To see how many ahead/behind the fork is, could trace through the history of both parent & fork - accuracy up to say 20?