Skip to content

Commit 017690e

Browse files
committed
Added warning about default branch to commits.list.
Closes ask#44.
1 parent 96b0a41 commit 017690e

3 files changed

Lines changed: 7 additions & 40 deletions

File tree

github2/commits.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ def __repr__(self):
2424

2525

2626
class Commits(GithubCommand):
27-
"""
28-
.. warning::
29-
Unfortunately, commits from repositories containing certain characters
30-
such as '.' will fail. This is an issue with the GitHub API, and can't
31-
currently be worked around in this library.
32-
"""
3327
domain = "commits"
3428

3529
def list(self, project, branch="master", file=None):
3630
"""List commits on a project
3731
32+
.. warning::
33+
Not all projects use ``master`` as their default branch, you can
34+
check the value of the ``Repo(project).master_branch`` attribute to
35+
determine the default branch of a given repository.
36+
3837
:param str project: project name
39-
:param str branch: branch name
38+
:param str branch: branch name, or ``master`` if not given
4039
:param str file: optional file filter
4140
"""
4241
return self.get_values("list", project, branch, file,

tests/data/github.com,api,v2,json,commits,list,kennethreitz,osxpython.org,master,f245f9d2f5db473934bef7aed73bbdac

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/test_commits.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import _setup
22

3-
import sys
4-
5-
from nose.tools import (assert_equals, assert_false)
3+
from nose.tools import assert_equals
64

75
import utils
86

@@ -34,21 +32,3 @@ def test_list_with_branch_and_file(self):
3432
assert_equals(len(commits), 35)
3533
assert_equals(commits[0].id,
3634
'482f657443df4b701137a3025ae08476cddd2b7d')
37-
38-
def test_list_repo_with_dot(self):
39-
"""GitHub returns error listing commits in repos containing '.'
40-
41-
The purpose of this test is to tell us when this issue is fixed
42-
upstream.
43-
"""
44-
try:
45-
commits = self.client.commits.list('kennethreitz/osxpython.org')
46-
except RuntimeError:
47-
# The hoop jumping here is for Python 2 & 3 compatibility, it is
48-
# also good a sign it may be time to use 2to3 on the tests.
49-
e = sys.exc_info()[1]
50-
if """'{"error":"Not Found"}'""" not in e.args[0]:
51-
raise
52-
commits = None
53-
assert_false(commits,
54-
"Listing commits with '.' in name is fixed upstream!")

0 commit comments

Comments
 (0)