Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 7 commits
  • 7 files changed
  • 5 commit comments
  • 4 contributors
Showing with 126 additions and 16 deletions.
  1. +0 −4 .travis.yml
  2. +1 −0 CHANGELOG.md
  3. +3 −10 README.md
  4. +12 −1 lib/octokit/client/commits.rb
  5. +1 −1 lib/octokit/version.rb
  6. +98 −0 spec/fixtures/v3/compare.json
  7. +11 −0 spec/octokit/client/commits_spec.rb
View
4 .travis.yml
@@ -3,10 +3,6 @@ matrix:
allow_failures:
- rvm: ruby-head
rvm:
- - rbx-18mode
- - rbx-19mode
- - jruby-18mode
- - jruby-19mode
- 1.8.7
- 1.9.2
- 1.9.3
View
1 CHANGELOG.md
@@ -1,5 +1,6 @@
# CHANGELOG
+* [1.9.4 - August 6, 2012](https://github.com/pengwynn/octokit/compare/v1.9.3...v1.9.4)
* [1.9.3 - July 27, 2012](https://github.com/pengwynn/octokit/compare/v1.9.2...v1.9.3)
* [1.9.2 - July 25, 2012](https://github.com/pengwynn/octokit/compare/v1.9.1...v1.9.2)
* [1.9.1 - July 11, 2012](https://github.com/pengwynn/octokit/compare/v1.8.1...v1.9.1)
View
13 README.md
@@ -1,8 +1,9 @@
-# Octokit [![Build Status](https://secure.travis-ci.org/pengwynn/octokit.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/pengwynn/octokit.png?travis)][gemnasium]
+# Octokit [![Build Status](https://secure.travis-ci.org/pengwynn/octokit.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/pengwynn/octokit.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/badge.png)][codeclimate]
Simple Ruby wrapper for the GitHub v3 API.
[travis]: http://travis-ci.org/pengwynn/octokit
[gemnasium]: https://gemnasium.com/pengwynn/octokit
+[codeclimate]: https://codeclimate.com/github/pengwynn/octokit
## Installation
gem install octokit
@@ -98,19 +99,11 @@ end
## Supported Ruby Versions
This library aims to support and is [tested against][travis] the following Ruby
-implementations:
+versions:
* Ruby 1.8.7
* Ruby 1.9.2
* Ruby 1.9.3
-* [JRuby][]
-* [Rubinius][]
-
-[jruby]: http://www.jruby.org/
-[rubinius]: http://rubini.us/
-
-If something doesn't work on one of these interpreters, it should be considered
-a bug.
This library may inadvertently work (or seem to work) on other Ruby
implementations, however support will only be provided for the versions listed
View
13 lib/octokit/client/commits.rb
@@ -13,7 +13,7 @@ module Commits
# @see http://developer.github.com/v3/repos/commits/
def commits(repo, sha_or_branch="master", options={})
params = { :sha => sha_or_branch, :per_page => 35 }
- get("repos/#{Repository.new(repo)}/commits", options.merge(params), 3)
+ get("repos/#{Repository.new(repo)}/commits", params.merge(options), 3)
end
alias :list_commits :commits
@@ -82,6 +82,17 @@ def commit_comment(repo, id, options={})
get("repos/#{Repository.new(repo)}/comments/#{id}", options, 3)
end
+ # Compare two commits
+ #
+ # @param repo [String, Hash, Repository] A GitHub repository
+ # @param base [String] The sha of the starting commit
+ # @param end [String] The sha of the ending commit
+ # @return [Hashie::Mash] A hash representing the comparison
+ # @see http://developer.github.com/v3/repos/commits/
+ def compare(repo, start, endd, options={})
+ get("repos/#{Repository.new(repo)}/compare/#{start}...#{endd}", options, 3)
+ end
+
end
end
end
View
2 lib/octokit/version.rb
@@ -1,3 +1,3 @@
module Octokit
- VERSION = "1.9.3" unless defined?(Octokit::VERSION)
+ VERSION = "1.9.4" unless defined?(Octokit::VERSION)
end
View
98 spec/fixtures/v3/compare.json
@@ -0,0 +1,98 @@
+{"ahead_by": 0,
+ "files": [],
+ "merge_base_commit":
+ {"sha": "b7b37f75a80b8e84061cd45b246232ad958158f5",
+ "author":
+ {"id": 10308,
+ "login": "sferik",
+ "avatar_url":
+ "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
+ "url": "https://api.github.com/users/sferik",
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb"},
+ "commit":
+ {"comment_count": 0,
+ "author":
+ {"name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com",
+ "date": "2012-07-27T10:23:34-07:00"},
+ "committer":
+ {"name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com",
+ "date": "2012-07-27T10:23:34-07:00"},
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/git/commits/b7b37f75a80b8e84061cd45b246232ad958158f5",
+ "message":
+ "Merge pull request #117 from lanej/master\n\nallow override of the per_page parameter from Client#commits",
+ "tree":
+ {"sha": "9c5df3c0f203bfe8c09d4da7b0795cdf6f1a1d5e",
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/git/trees/9c5df3c0f203bfe8c09d4da7b0795cdf6f1a1d5e"}},
+ "committer":
+ {"id": 10308,
+ "login": "sferik",
+ "avatar_url":
+ "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
+ "url": "https://api.github.com/users/sferik",
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb"},
+ "parents":
+ [{"sha": "2f6c36319af163acdefdd05e016d40b65e3a482c",
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/commits/2f6c36319af163acdefdd05e016d40b65e3a482c"},
+ {"sha": "7950a0287f12419f00487b518dd8221a87e559da",
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/commits/7950a0287f12419f00487b518dd8221a87e559da"}],
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/commits/b7b37f75a80b8e84061cd45b246232ad958158f5"},
+ "permalink_url":
+ "https://github.com/gvaughn/octokit/compare/gvaughn:0e0d7ae...gvaughn:b7b37f7",
+ "diff_url":
+ "https://github.com/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5.diff",
+ "commits": [],
+ "total_commits": 0,
+ "behind_by": 2,
+ "base_commit":
+ {"sha": "0e0d7ae299514da692eb1cab741562c253d44188",
+ "author":
+ {"id": 10308,
+ "login": "sferik",
+ "avatar_url":
+ "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
+ "url": "https://api.github.com/users/sferik",
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb"},
+ "commit":
+ {"comment_count": 0,
+ "author":
+ {"name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com",
+ "date": "2012-07-27T10:31:34-07:00"},
+ "committer":
+ {"name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com",
+ "date": "2012-07-27T10:31:34-07:00"},
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/git/commits/0e0d7ae299514da692eb1cab741562c253d44188",
+ "message": "Add CodeClimate badge",
+ "tree":
+ {"sha": "841640f89489414c6d09ff06a72deab1502d7107",
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/git/trees/841640f89489414c6d09ff06a72deab1502d7107"}},
+ "committer":
+ {"id": 10308,
+ "login": "sferik",
+ "avatar_url":
+ "https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
+ "url": "https://api.github.com/users/sferik",
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb"},
+ "parents":
+ [{"sha": "a7e1ca21c9de24743f3c6f840b96711c0baa0890",
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/commits/a7e1ca21c9de24743f3c6f840b96711c0baa0890"}],
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/commits/0e0d7ae299514da692eb1cab741562c253d44188"},
+ "url":
+ "https://api.github.com/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5",
+ "status": "behind",
+ "patch_url":
+ "https://github.com/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5.patch",
+ "html_url":
+ "https://github.com/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5"}
View
11 spec/octokit/client/commits_spec.rb
@@ -78,4 +78,15 @@
end
+ describe ".compare" do
+
+ it "should return a comparison" do
+ stub_get("/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5").
+ to_return(:body => fixture("v3/compare.json"))
+ comparison = @client.compare("gvaughn/octokit", '0e0d7ae299514da692eb1cab741562c253d44188', 'b7b37f75a80b8e84061cd45b246232ad958158f5')
+ comparison.base_commit.sha.should == '0e0d7ae299514da692eb1cab741562c253d44188'
+ comparison.merge_base_commit.sha.should == 'b7b37f75a80b8e84061cd45b246232ad958158f5'
+ end
+ end
+
end

Showing you all comments on commits in this comparison.

@catsby
octokit member

Fix the build

For various definitions of "fix". Why not support JRuby/Rubinius?

@sferik
octokit member

If you look at the last failed build, the failures have absolutely nothing to do with our code. Our specs aren't even being run. The builds were crapping out before they got to that step.

As I see it, Ruby is defined by MRI. Yes, there's RubySpec, but that was reverse-engineered from MRI, including specifying long-standing MRI bugs.

If our specs pass on MRI but fail on JRuby, that's a bug in JRuby, not a bug in our code, so it shouldn't affect our overall build status. I suppose I could have moved JRuby and Rubinius to the allow_failures array so they don't affect our overall build status, but IMHO, the purpose of CI is not for us to discover bugs in JRuby and Rubinius.

If you asked me the same question 12 months ago, I probably would have given you a different answer. Since then, I've grown tired of investigating failures that I did not cause and am not responsible for fixing.

@pengwynn
octokit member

The failures have been intermittent and random, too. I had chalked it up to Travis instability. @sferik, are you seeing the same on Twitter?

@sferik
octokit member

Travis is partially to blame but the fact they keep breaking leads be to think the core problem is instability in JRuby and Rubinius. They simply shouldn't be that hard to get running.

I've kept these implementations enabled for the twitter gem for now, but I'm inclined to rip them out if I start seeing repeated failures.

@catsby
octokit member

If our specs pass on MRI but fail on JRuby, that's a bug in JRuby, not a bug in our code

Fair enough; your commit message just threw me ;)

Something went wrong with that request. Please try again.