|
46 | 46 | "language": "python",
|
47 | 47 | "metadata": {},
|
48 | 48 | "outputs": [],
|
49 |
| - "prompt_number": 5 |
| 49 | + "prompt_number": 1 |
50 | 50 | },
|
51 | 51 | {
|
52 | 52 | "cell_type": "markdown",
|
|
66 | 66 | "language": "python",
|
67 | 67 | "metadata": {},
|
68 | 68 | "outputs": [],
|
69 |
| - "prompt_number": 7 |
| 69 | + "prompt_number": 2 |
70 | 70 | },
|
71 | 71 | {
|
72 | 72 | "cell_type": "markdown",
|
|
130 | 130 | ]
|
131 | 131 | }
|
132 | 132 | ],
|
133 |
| - "prompt_number": 8 |
| 133 | + "prompt_number": 3 |
| 134 | + }, |
| 135 | + { |
| 136 | + "cell_type": "heading", |
| 137 | + "level": 2, |
| 138 | + "metadata": {}, |
| 139 | + "source": [ |
| 140 | + "Listing Combined Status Associated with a Reference" |
| 141 | + ] |
| 142 | + }, |
| 143 | + { |
| 144 | + "cell_type": "code", |
| 145 | + "collapsed": false, |
| 146 | + "input": [ |
| 147 | + "import github3\n", |
| 148 | + "\n", |
| 149 | + "\n", |
| 150 | + "repository = github3.repository('sigmavirus24', 'github3.py')" |
| 151 | + ], |
| 152 | + "language": "python", |
| 153 | + "metadata": {}, |
| 154 | + "outputs": [], |
| 155 | + "prompt_number": 1 |
| 156 | + }, |
| 157 | + { |
| 158 | + "cell_type": "markdown", |
| 159 | + "metadata": {}, |
| 160 | + "source": [ |
| 161 | + "With a repository object, we can now retrieve the statuses from a number of different commit-like objects which we can retrieve using the repository's ``commit`` method." |
| 162 | + ] |
| 163 | + }, |
| 164 | + { |
| 165 | + "cell_type": "code", |
| 166 | + "collapsed": false, |
| 167 | + "input": [ |
| 168 | + "commit = repository.commit('9df71a9772d5f43e332c855a32d4689f28289989')\n", |
| 169 | + "tag = repository.commit('0.9.3')\n", |
| 170 | + "branch = repository.commit('stable/0.9')" |
| 171 | + ], |
| 172 | + "language": "python", |
| 173 | + "metadata": {}, |
| 174 | + "outputs": [], |
| 175 | + "prompt_number": 2 |
| 176 | + }, |
| 177 | + { |
| 178 | + "cell_type": "markdown", |
| 179 | + "metadata": {}, |
| 180 | + "source": [ |
| 181 | + "Each of these bindings now hold a reference to a different ``RepoCommit`` object and each has a ``status`` method. We can retrieve the combined status about each reference and print them." |
| 182 | + ] |
| 183 | + }, |
| 184 | + { |
| 185 | + "cell_type": "code", |
| 186 | + "collapsed": false, |
| 187 | + "input": [ |
| 188 | + "for ref in (commit, tag, branch):\n", |
| 189 | + " print('Showing combined status for \"{0.sha}\" ({0.html_url})'.format(ref))\n", |
| 190 | + " combined_status = ref.status()\n", |
| 191 | + " print(\" State: {0.state}; Total count: {0.total_count}\".format(combined_status))\n", |
| 192 | + " print(\" Statuses:\")\n", |
| 193 | + " for status in combined_status.statuses:\n", |
| 194 | + " print(\" State: {0.state}; Description: {0.description}; Context: {0.context}\".format(status))" |
| 195 | + ], |
| 196 | + "language": "python", |
| 197 | + "metadata": {}, |
| 198 | + "outputs": [ |
| 199 | + { |
| 200 | + "output_type": "stream", |
| 201 | + "stream": "stdout", |
| 202 | + "text": [ |
| 203 | + "Showing combined status for \"9df71a9772d5f43e332c855a32d4689f28289989\" (https://github.com/sigmavirus24/github3.py/commit/9df71a9772d5f43e332c855a32d4689f28289989)\n", |
| 204 | + " State: success; Total count: 1" |
| 205 | + ] |
| 206 | + }, |
| 207 | + { |
| 208 | + "output_type": "stream", |
| 209 | + "stream": "stdout", |
| 210 | + "text": [ |
| 211 | + "\n", |
| 212 | + " Statuses:\n", |
| 213 | + " State: success; Description: The Travis CI build passed; Context: continuous-integration/travis-ci\n", |
| 214 | + "Showing combined status for \"52a3f30e05cf434285e775979f01f1a8355049a7\" (https://github.com/sigmavirus24/github3.py/commit/52a3f30e05cf434285e775979f01f1a8355049a7)\n", |
| 215 | + " State: success; Total count: 1" |
| 216 | + ] |
| 217 | + }, |
| 218 | + { |
| 219 | + "output_type": "stream", |
| 220 | + "stream": "stdout", |
| 221 | + "text": [ |
| 222 | + "\n", |
| 223 | + " Statuses:\n", |
| 224 | + " State: success; Description: The Travis CI build passed; Context: continuous-integration/travis-ci\n", |
| 225 | + "Showing combined status for \"c4c3fc3ea3b56152303a1a856d7d7fe220b9b8b4\" (https://github.com/sigmavirus24/github3.py/commit/c4c3fc3ea3b56152303a1a856d7d7fe220b9b8b4)\n", |
| 226 | + " State: failure; Total count: 1" |
| 227 | + ] |
| 228 | + }, |
| 229 | + { |
| 230 | + "output_type": "stream", |
| 231 | + "stream": "stdout", |
| 232 | + "text": [ |
| 233 | + "\n", |
| 234 | + " Statuses:\n", |
| 235 | + " State: failure; Description: The Travis CI build failed; Context: continuous-integration/travis-ci/push\n" |
| 236 | + ] |
| 237 | + } |
| 238 | + ], |
| 239 | + "prompt_number": 3 |
134 | 240 | },
|
135 | 241 | {
|
136 | 242 | "cell_type": "heading",
|
|
0 commit comments