@Override
  public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    RepositoryCommit commit = (RepositoryCommit) adapterView.getAdapter().getItem(position);
    Intent intent = new Intent().setClass(CommitHistoryActivity.this, CommitActivity.class);

    intent.putExtra(Constants.Repository.REPO_OWNER, mRepoOwner);
    intent.putExtra(Constants.Repository.REPO_NAME, mRepoName);
    intent.putExtra(Constants.Object.OBJECT_SHA, commit.getSha());
    intent.putExtra(Constants.Object.TREE_SHA, commit.getCommit().getTree().getSha());

    startActivity(intent);
  }
Example #2
0
 @Override
 public void process(Exchange exchange) throws Exception {
   Message in = exchange.getIn();
   RepositoryCommit commit = (RepositoryCommit) in.getBody();
   User author = commit.getAuthor();
   log.debug(
       "Got commit with author: "
           + author.getLogin()
           + ": "
           + author.getHtmlUrl()
           + " SHA "
           + commit.getSha());
 }
 /**
  * Print commit authors and dates paged in blocks of 25
  *
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
   final int size = 25;
   final RepositoryId repo = new RepositoryId("github", "hubot");
   final String message = "   {0} by {1} on {2}";
   final CommitService service = new CommitService();
   int pages = 1;
   for (Collection<RepositoryCommit> commits : service.pageCommits(repo, size)) {
     System.out.println("Commit Page " + pages++);
     for (RepositoryCommit commit : commits) {
       String sha = commit.getSha().substring(0, 7);
       String author = commit.getCommit().getAuthor().getName();
       Date date = commit.getCommit().getAuthor().getDate();
       System.out.println(MessageFormat.format(message, sha, author, date));
     }
   }
 }