cleaning up

This commit is contained in:
Kohsuke Kawaguchi
2012-04-06 08:22:44 -07:00
parent aac30b923c
commit 0b2fdc598b
3 changed files with 40 additions and 43 deletions

View File

@@ -1,50 +1,51 @@
package org.kohsuke.github;
import java.util.Date;
import java.util.Locale;
/**
* A branch in a repository.
*
* @author Yusuke Kokubo
*
*/
public class GHBranch {
GitHub root;
GHRepository owner;
private GitHub root;
private GHRepository owner;
GHUser creator;
private String name;
private GHCommitPointer commit;
private String name;
private Commit commit;
public GitHub getRoot() {
return root;
}
public GHRepository getOwner() {
return owner;
}
public GHUser getCreator() {
return creator;
}
public static class Commit {
String sha,url;
}
public String getName() {
return name;
}
public GitHub getRoot() {
return root;
}
public GHCommitPointer getCommit() {
return commit;
}
/**
* Repository that this branch is in.
*/
public GHRepository getOwner() {
return owner;
}
@Override
public String toString() {
return "Branch:"+name+" in "+owner.getUrl();
}
public String getName() {
return name;
}
public GHBranch wrap(GHRepository repo) {
this.owner = repo;
this.root = repo.root;
return this;
}
/**
* The commit that this branch currently points to.
*/
public String getSHA1() {
return commit.sha;
}
@Override
public String toString() {
return "Branch:" + name + " in " + owner.getUrl();
}
/*package*/ GHBranch wrap(GHRepository repo) {
this.owner = repo;
this.root = repo.root;
return this;
}
}

View File

@@ -31,8 +31,6 @@ class JsonBranch {
GHBranch branch;
GHBranch wrap(GHRepository r) {
branch.owner = r;
branch.root = r.root;
return branch;
return branch.wrap(r);
}
}

View File

@@ -33,10 +33,8 @@ class JsonBranches {
List<GHBranch> branches;
public List<GHBranch> wrap(GHRepository owner) {
for (GHBranch branch : branches) {
branch.owner = owner;
branch.root = owner.root;
}
for (GHBranch branch : branches)
branch.wrap(owner);
return branches;
}
}