Native equivalents of jQuery functions
1 day ago
no comments, be the first one!
written by Sandeep Gupta
Thursday, November 17, 2011 at 7:42 PM
Labels: Code Challenge , Coding Techniques , My Projects
no comments, be the first one!
GET /repos/:user/:repo/commits/:sha
{
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"commit": {
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"author": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"committer": {
"name": "Monalisa Octocat",
"email": "support@github.com",
"date": "2011-04-14T16:00:49Z"
},
"message": "Fix all the bugs",
"tree": {
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
},
"author": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"committer": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"parents": [
{
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
}
],
"stats": {
"additions": 104,
"deletions": 4,
"total": 108
},
"files": [
{
"filename": "file1.txt",
"additions": 10,
"deletions": 2,
"total": 12
}
]
}
package org.eclipse.egit.github.core;
public class Stats {
private int additions;
private int deletions;
private int total;
public int getAdditions() {
return additions;
}
public void setAdditions(int additions) {
this.additions = additions;
}
public int getDeletions() {
return deletions;
}
public void setDeletions(int deletions) {
this.deletions = deletions;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
}private Stats stats;
private List<CommitFile> files;
public Stats getStats() {
return stats;
}
public void setStats(Stats stats) {
this.stats = stats;
}
public List<CommitFile> getFiles() {
return files;
}
public void setFiles(List<CommitFile> files) {
this.files = files;
}
public void test() {
CommitService commitService = new CommitService();
RepositoryCommit commit = commitService.getCommit(repository, sha);
System.out.println("Total lines impacted: " + commit.getTotal());
System.out.println("Total files impacted: " + commit.getFiles().size());
}
written by Sandeep Gupta
Thursday, November 10, 2011 at 9:48 PM
Labels: Java , Workarounds
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 India License.