├── .gitignore ├── .isort.cfg ├── .pylintrc ├── .travis.yml ├── CHANGELOG ├── COPYING ├── MANIFEST.in ├── README.rst ├── docs ├── Makefile ├── conf.py ├── contributing.rst ├── getting-started.rst ├── index.rst ├── read-the-docs.rst └── using.rst ├── requirements.txt ├── setup.py ├── sphinx_git ├── __init__.py └── version.py ├── tests ├── __init__.py ├── test_git_changelog.py └── test_git_commit_detail.py └── tox.ini /.gitignore: -------------------------------------------------------------------------------- 1 | sphinx_git.egg-info/ 2 | dist/ 3 | *.pyc 4 | sample/_build 5 | docs/_build 6 | .travis-solo 7 | .ropeproject 8 | *.swp 9 | .tox 10 | build 11 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | multi_line_output=3 3 | include_trailing_comma=True 4 | not_skip="__init__.py" 5 | known_first_party= 6 | sphinx_git 7 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | persistent=yes 3 | cache-size=500 4 | 5 | [MESSAGES CONTROL] 6 | # I0011 Warning locally suppressed using disable-msg 7 | # I0012 Warning locally suppressed using disable-msg 8 | # W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments. 9 | # C0111 Missing docstring 10 | disable=I0011,I0012,W0142,C0111 11 | 12 | [REPORTS] 13 | msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} 14 | files-output=n 15 | reports=no 16 | 17 | [BASIC] 18 | no-docstring-rgx=__.*__|_.*|Test.*|test.*|.*Test|.*Tests|tests 19 | class-rgx=[A-Z_][a-zA-Z0-9_]+$ 20 | function-rgx=[a-zA_][a-zA-Z0-9_]{2,70}$ 21 | method-rgx=[a-z_][a-zA-Z0-9_]{2,70}$ 22 | const-rgx=(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__)|register|urlpatterns)$ 23 | good-names=_,__,i,j,n,pk,id,setUp,tearDown,qs,fn 24 | 25 | [TYPECHECK] 26 | 27 | # Tells whether missing members accessed in mixin class should be ignored. A 28 | # mixin class is detected if its name ends with "mixin" (case insensitive). 29 | ignore-mixin-members=yes 30 | 31 | # List of classes names for which member attributes should not be checked 32 | # (useful for classes with attributes dynamically set). 33 | ignored-classes=SQLObject,WSGIRequest 34 | 35 | # List of members which are set dynamically and missed by pylint inference 36 | # system, and so shouldn't trigger E0201 when accessed. 37 | generated-members=client,objects,DoesNotExist,id,pk,_meta,base_fields,context,__subclasses__,modifiers,Modifiers,refs,.*_set 38 | 39 | # List of method names used to declare (i.e. assign) instance attributes 40 | defining-attr-methods=__init__,__new__,setUp 41 | 42 | 43 | [VARIABLES] 44 | init-import=no 45 | dummy-variables-rgx=_|dummy 46 | 47 | [SIMILARITIES] 48 | min-similarity-lines=6 49 | ignore-comments=yes 50 | ignore-docstrings=yes 51 | 52 | [MISCELLANEOUS] 53 | notes=FIXME,XXX 54 | 55 | [FORMAT] 56 | max-module-lines=500 57 | indent-string=' ' 58 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | install: 3 | - pip install tox 4 | script: 5 | - tox 6 | matrix: 7 | include: 8 | - python: 2.7 9 | env: 10 | - TOXENV=py27 11 | - python: 3.5 12 | env: 13 | - TOXENV=py35 14 | dist: xenial 15 | - python: 3.6 16 | env: 17 | - TOXENV=py36 18 | - python: 3.7 19 | env: 20 | - TOXENV=py37 21 | sudo: required 22 | dist: bionic 23 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | dev 2 | --- 3 | 4 | * 5 | 6 | v11.0.0 7 | ------- 8 | 9 | * Add support for plain-formatting the commit message. instead of bold. 10 | (Aleksey Marin) 11 | * Generated well-formed docutils trees. (amedama41) 12 | 13 | v10.1.1 14 | ------- 15 | 16 | * Handle generating commit details for detached HEADs. 17 | 18 | v10.1.0 19 | ------- 20 | 21 | * Add filename_filter argument to git_changelog. (Emmanuelle Delescolle) 22 | * Add options to hide author, date and/or detail to git_changelog. 23 | (Peter Mosmans) 24 | * Stop using a deprecated Sphinx API (allowing us to support future 25 | versions of Sphinx). (Peter Mosmans) 26 | * Add repo-dir option, to display changelogs/commits for other repos. 27 | (boeddeker) 28 | 29 | v10.0.0 30 | ------- 31 | 32 | * Drop Python 2.6 support. 33 | * Add Python 3.4 and 3.5 support. 34 | * Add git_commit_detail directive. (pomalley) 35 | 36 | v9 37 | -- 38 | 39 | * Work against the latest GitPython. (pomalley) 40 | 41 | v8 42 | -- 43 | 44 | * Output detailed commit messages as paragraphs rather than captions to 45 | fix PDF output. 46 | * Add documentation. 47 | * Reshuffle how the build works. 48 | * Make sphinx_git a package rather than a module. 49 | 50 | v7 51 | -- 52 | 53 | * Update GitPython requirement in setup.py. 54 | 55 | v6 56 | -- 57 | 58 | * Add the detailed-message-pre option to toggle the display mode for the 59 | detailed messages of commits. 60 | 61 | v5 62 | -- 63 | 64 | * Generate a warning if both rev-list and revisions options are given. 65 | 66 | v4 67 | -- 68 | * Add rev-list option to specify a range of commits to show. 69 | (Gregory Eric Sanderson) 70 | 71 | v3 72 | -- 73 | * Add option to specify the number of revisions to display. 74 | 75 | v2 76 | -- 77 | * Split the display of the main commit message and the description. 78 | (Will Weaver) 79 | * Build using tox. (Marc Abramowitz) 80 | 81 | v1 82 | -- 83 | * Initial implementation. 84 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CHANGELOG 2 | include COPYING 3 | include README 4 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | sphinx-git 2 | ---------- 3 | 4 | .. image:: https://travis-ci.org/OddBloke/sphinx-git.png?branch=master 5 | :target: https://travis-ci.org/OddBloke/sphinx-git 6 | 7 | sphinx-git is an extension to the `Sphinx documentation tool`_ that allows you 8 | to include excerpts from your git history within your documentation. This 9 | could be used for release changelogs, to pick out specific examples of history 10 | in documentation, or just to surface what is happening in the project. 11 | 12 | To use it, add 'sphinx_git' to 'extensions' in your Sphinx conf.py, and add:: 13 | 14 | .. git_changelog:: 15 | 16 | where you want the list of commits to appear. 17 | 18 | For more details, see `the documentation on Read the Docs`_. 19 | 20 | Example 21 | ======= 22 | 23 | You can see a live example `in the Read the Docs documentation`_; the HTML output looks like this: 24 | 25 | .. image:: https://user-images.githubusercontent.com/62736/34072980-a8469baa-e25e-11e7-968f-553caad65e56.png 26 | 27 | .. _Sphinx documentation tool: http://sphinx-doc.org/ 28 | .. _the documentation on Read the Docs: http://sphinx-git.readthedocs.org/en/latest/?utm_source=github&utm_medium=github&utm_campaign=github 29 | .. _in the Read the Docs documentation: http://sphinx-git.readthedocs.io/en/stable/using.html#git-changelog-directive 30 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | # the i18n builder cannot share the environment and doctrees with the others 15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 16 | 17 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 18 | 19 | help: 20 | @echo "Please use \`make ' where is one of" 21 | @echo " html to make standalone HTML files" 22 | @echo " dirhtml to make HTML files named index.html in directories" 23 | @echo " singlehtml to make a single large HTML file" 24 | @echo " pickle to make pickle files" 25 | @echo " json to make JSON files" 26 | @echo " htmlhelp to make HTML files and a HTML help project" 27 | @echo " qthelp to make HTML files and a qthelp project" 28 | @echo " devhelp to make HTML files and a Devhelp project" 29 | @echo " epub to make an epub" 30 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 31 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 32 | @echo " text to make text files" 33 | @echo " man to make manual pages" 34 | @echo " texinfo to make Texinfo files" 35 | @echo " info to make Texinfo files and run them through makeinfo" 36 | @echo " gettext to make PO message catalogs" 37 | @echo " changes to make an overview of all changed/added/deprecated items" 38 | @echo " linkcheck to check all external links for integrity" 39 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 40 | 41 | clean: 42 | -rm -rf $(BUILDDIR)/* 43 | 44 | html: 45 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 48 | 49 | dirhtml: 50 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 51 | @echo 52 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 53 | 54 | singlehtml: 55 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 56 | @echo 57 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 58 | 59 | pickle: 60 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 61 | @echo 62 | @echo "Build finished; now you can process the pickle files." 63 | 64 | json: 65 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 66 | @echo 67 | @echo "Build finished; now you can process the JSON files." 68 | 69 | htmlhelp: 70 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 71 | @echo 72 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 73 | ".hhp project file in $(BUILDDIR)/htmlhelp." 74 | 75 | qthelp: 76 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 77 | @echo 78 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 79 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 80 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sphinx-git.qhcp" 81 | @echo "To view the help file:" 82 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sphinx-git.qhc" 83 | 84 | devhelp: 85 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 86 | @echo 87 | @echo "Build finished." 88 | @echo "To view the help file:" 89 | @echo "# mkdir -p $$HOME/.local/share/devhelp/sphinx-git" 90 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/sphinx-git" 91 | @echo "# devhelp" 92 | 93 | epub: 94 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 95 | @echo 96 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 97 | 98 | latex: 99 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 100 | @echo 101 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 102 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 103 | "(use \`make latexpdf' here to do that automatically)." 104 | 105 | latexpdf: 106 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 107 | @echo "Running LaTeX files through pdflatex..." 108 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 109 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 110 | 111 | text: 112 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 113 | @echo 114 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 115 | 116 | man: 117 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 118 | @echo 119 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 120 | 121 | texinfo: 122 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 123 | @echo 124 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 125 | @echo "Run \`make' in that directory to run these through makeinfo" \ 126 | "(use \`make info' here to do that automatically)." 127 | 128 | info: 129 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 130 | @echo "Running Texinfo files through makeinfo..." 131 | make -C $(BUILDDIR)/texinfo info 132 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 133 | 134 | gettext: 135 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 136 | @echo 137 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 138 | 139 | changes: 140 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 141 | @echo 142 | @echo "The overview file is in $(BUILDDIR)/changes." 143 | 144 | linkcheck: 145 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 146 | @echo 147 | @echo "Link check complete; look for any errors in the above output " \ 148 | "or in $(BUILDDIR)/linkcheck/output.txt." 149 | 150 | doctest: 151 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 152 | @echo "Testing of doctests in the sources finished, look at the " \ 153 | "results in $(BUILDDIR)/doctest/output.txt." 154 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # sphinx-git documentation build configuration file, created by 4 | # sphinx-quickstart on Tue Nov 26 09:24:59 2013. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx_git'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = [] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'sphinx-git' 44 | copyright = u'2013, Daniel Watkins' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | from sphinx_git.version import __version__ as version 51 | # The short X.Y version. 52 | version = version 53 | # The full version, including alpha/beta/rc tags. 54 | release = version 55 | 56 | # The language for content autogenerated by Sphinx. Refer to documentation 57 | # for a list of supported languages. 58 | #language = None 59 | 60 | # There are two options for replacing |today|: either, you set today to some 61 | # non-false value, then it is used: 62 | #today = '' 63 | # Else, today_fmt is used as the format for a strftime call. 64 | #today_fmt = '%B %d, %Y' 65 | 66 | # List of patterns, relative to source directory, that match files and 67 | # directories to ignore when looking for source files. 68 | exclude_patterns = ['_build'] 69 | 70 | # The reST default role (used for this markup: `text`) to use for all documents. 71 | #default_role = None 72 | 73 | # If true, '()' will be appended to :func: etc. cross-reference text. 74 | #add_function_parentheses = True 75 | 76 | # If true, the current module name will be prepended to all description 77 | # unit titles (such as .. function::). 78 | #add_module_names = True 79 | 80 | # If true, sectionauthor and moduleauthor directives will be shown in the 81 | # output. They are ignored by default. 82 | #show_authors = False 83 | 84 | # The name of the Pygments (syntax highlighting) style to use. 85 | pygments_style = 'sphinx' 86 | 87 | # A list of ignored prefixes for module index sorting. 88 | #modindex_common_prefix = [] 89 | 90 | 91 | # -- Options for HTML output --------------------------------------------------- 92 | 93 | # The theme to use for HTML and HTML Help pages. See the documentation for 94 | # a list of builtin themes. 95 | html_theme = 'default' 96 | 97 | # Theme options are theme-specific and customize the look and feel of a theme 98 | # further. For a list of options available for each theme, see the 99 | # documentation. 100 | #html_theme_options = {} 101 | 102 | # Add any paths that contain custom themes here, relative to this directory. 103 | #html_theme_path = [] 104 | 105 | # The name for this set of Sphinx documents. If None, it defaults to 106 | # " v documentation". 107 | #html_title = None 108 | 109 | # A shorter title for the navigation bar. Default is the same as html_title. 110 | #html_short_title = None 111 | 112 | # The name of an image file (relative to this directory) to place at the top 113 | # of the sidebar. 114 | #html_logo = None 115 | 116 | # The name of an image file (within the static path) to use as favicon of the 117 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 118 | # pixels large. 119 | #html_favicon = None 120 | 121 | # Add any paths that contain custom static files (such as style sheets) here, 122 | # relative to this directory. They are copied after the builtin static files, 123 | # so a file named "default.css" will overwrite the builtin "default.css". 124 | html_static_path = [] 125 | 126 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 127 | # using the given strftime format. 128 | #html_last_updated_fmt = '%b %d, %Y' 129 | 130 | # If true, SmartyPants will be used to convert quotes and dashes to 131 | # typographically correct entities. 132 | #html_use_smartypants = True 133 | 134 | # Custom sidebar templates, maps document names to template names. 135 | #html_sidebars = {} 136 | 137 | # Additional templates that should be rendered to pages, maps page names to 138 | # template names. 139 | #html_additional_pages = {} 140 | 141 | # If false, no module index is generated. 142 | #html_domain_indices = True 143 | 144 | # If false, no index is generated. 145 | #html_use_index = True 146 | 147 | # If true, the index is split into individual pages for each letter. 148 | #html_split_index = False 149 | 150 | # If true, links to the reST sources are added to the pages. 151 | #html_show_sourcelink = True 152 | 153 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 154 | #html_show_sphinx = True 155 | 156 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 157 | #html_show_copyright = True 158 | 159 | # If true, an OpenSearch description file will be output, and all pages will 160 | # contain a tag referring to it. The value of this option must be the 161 | # base URL from which the finished HTML is served. 162 | #html_use_opensearch = '' 163 | 164 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 165 | #html_file_suffix = None 166 | 167 | # Output file base name for HTML help builder. 168 | htmlhelp_basename = 'sphinx-gitdoc' 169 | 170 | 171 | # -- Options for LaTeX output -------------------------------------------------- 172 | 173 | latex_elements = { 174 | # The paper size ('letterpaper' or 'a4paper'). 175 | #'papersize': 'letterpaper', 176 | 177 | # The font size ('10pt', '11pt' or '12pt'). 178 | #'pointsize': '10pt', 179 | 180 | # Additional stuff for the LaTeX preamble. 181 | #'preamble': '', 182 | } 183 | 184 | # Grouping the document tree into LaTeX files. List of tuples 185 | # (source start file, target name, title, author, documentclass [howto/manual]). 186 | latex_documents = [ 187 | ('index', 'sphinx-git.tex', u'sphinx-git Documentation', 188 | u'Daniel Watkins', 'manual'), 189 | ] 190 | 191 | # The name of an image file (relative to this directory) to place at the top of 192 | # the title page. 193 | #latex_logo = None 194 | 195 | # For "manual" documents, if this is true, then toplevel headings are parts, 196 | # not chapters. 197 | #latex_use_parts = False 198 | 199 | # If true, show page references after internal links. 200 | #latex_show_pagerefs = False 201 | 202 | # If true, show URL addresses after external links. 203 | #latex_show_urls = False 204 | 205 | # Documents to append as an appendix to all manuals. 206 | #latex_appendices = [] 207 | 208 | # If false, no module index is generated. 209 | #latex_domain_indices = True 210 | 211 | 212 | # -- Options for manual page output -------------------------------------------- 213 | 214 | # One entry per manual page. List of tuples 215 | # (source start file, name, description, authors, manual section). 216 | man_pages = [ 217 | ('index', 'sphinx-git', u'sphinx-git Documentation', 218 | [u'Daniel Watkins'], 1) 219 | ] 220 | 221 | # If true, show URL addresses after external links. 222 | #man_show_urls = False 223 | 224 | 225 | # -- Options for Texinfo output ------------------------------------------------ 226 | 227 | # Grouping the document tree into Texinfo files. List of tuples 228 | # (source start file, target name, title, author, 229 | # dir menu entry, description, category) 230 | texinfo_documents = [ 231 | ('index', 'sphinx-git', u'sphinx-git Documentation', 232 | u'Daniel Watkins', 'sphinx-git', 'One line description of project.', 233 | 'Miscellaneous'), 234 | ] 235 | 236 | # Documents to append as an appendix to all manuals. 237 | #texinfo_appendices = [] 238 | 239 | # If false, no module index is generated. 240 | #texinfo_domain_indices = True 241 | 242 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 243 | #texinfo_show_urls = 'footnote' 244 | -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | sphinx-git is already the work of more than just myself! There are a number of 5 | ways that you can contribute to the sphinx-git project. 6 | 7 | Open Issues on GitHub 8 | --------------------- 9 | 10 | If there's a problem with how sphinx-git works, or if there's a feature that 11 | you'd like to see, `open up an issue in GitHub`_. Give as much information as 12 | you can and I'll do my best to get to it! 13 | 14 | 15 | Submit a Patch 16 | -------------- 17 | 18 | If you feel confident enough, have a stab at scratching your own itch in 19 | sphinx-git. Fork the project on GitHub, make your changes and submit a pull 20 | request. 21 | 22 | Pull requests will need to pass the `Travis CI build`_, which uses tox. 23 | You can run this by doing the following:: 24 | 25 | $ pip install tox 26 | $ tox 27 | 28 | This will run the build on all supported Python versions. If you're on 29 | an environment that doesn't have both available then do the best you 30 | can, and then open up your pull request; Travis will pick this up and 31 | build it for you. 32 | 33 | Pull Request Checklist 34 | ~~~~~~~~~~~~~~~~~~~~~~ 35 | 36 | Once you've got a patch ready, check the following things: 37 | 38 | * You've written tests for your change 39 | * The Travis CI build passes; this includes: 40 | 41 | * PEP-8 on the sphinx_git package and the tests 42 | * Pylint on the sphinx_git package 43 | * Passing unit tests (of course!) 44 | * You've added a line to the CHANGELOG 45 | * You've added documentation (if appropriate) 46 | 47 | .. _open up an issue in GitHub: https://github.com/OddBloke/sphinx-git/issues/new 48 | .. _Travis CI build: https://travis-ci.org/OddBloke/sphinx-git/pull_requests 49 | -------------------------------------------------------------------------------- /docs/getting-started.rst: -------------------------------------------------------------------------------- 1 | Getting Started 2 | =============== 3 | 4 | Including sphinx-git In Your Project 5 | ------------------------------------ 6 | 7 | This guide assumes that you already have a Sphinx documentation project 8 | configured and building. If that is not the case, see `the Sphinx 9 | documentation`_ first and then come back. 10 | 11 | Installing sphinx-git 12 | ~~~~~~~~~~~~~~~~~~~~~ 13 | 14 | The first thing you will need to do is install sphinx-git:: 15 | 16 | pip install sphinx-git 17 | 18 | You may also want to include it in your setup.py or requirements.txt to ensure 19 | that sphinx-git is installed wherever you generate your documentation; each 20 | project will probably have a different way of doing this. 21 | 22 | Including sphinx-git In Your Sphinx Configuration 23 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | 25 | Once you have installed sphinx-git, you need to configure Sphinx to look for 26 | it. Find the Sphinx conf.py which is used to generate your documentation. 27 | Somewhere in that file (generally towards the top), you will find the 28 | ``extensions`` setting. Add ``sphinx_git`` to this list (note the 29 | underscore):: 30 | 31 | extensions = ['sphinx_git'] 32 | 33 | Add A git Changelog To Your Project 34 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | 36 | All the hard parts are done, now you can add a git changelog to your project! 37 | Find a documentation file where you want it and add:: 38 | 39 | Recent Changes 40 | -------------- 41 | 42 | .. git_changelog:: 43 | 44 | Build your documentation and, voila!, you have a git changelog right there in 45 | your docs! 46 | 47 | There are a number of ways you can configure sphinx-git to output precisely 48 | what you want, which are outlined in the next section of the documentation. 49 | 50 | 51 | .. _the Sphinx documentation: http://sphinx-doc.org/tutorial.html 52 | 53 | Add Details of the Latest Commit to Your Project 54 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | 56 | You can also display information about the state of the repository when the documentation 57 | was compiled with the ``git_commit_detail`` directive:: 58 | 59 | .. git_commit_detail:: 60 | :branch: 61 | :commit: -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to sphinx-git's documentation! 2 | ====================================== 3 | 4 | sphinx-git is an extension to the `Sphinx documentation tool`_ that allows you 5 | to include excerpts from your git history within your documentation. This 6 | could be used for release changelogs, to pick out specific examples of history 7 | in documentation, or just to surface what is happening in the project. 8 | 9 | See :ref:`recent_changes` below for an example of what can be done with it. 10 | 11 | Contents 12 | -------- 13 | 14 | .. toctree:: 15 | :maxdepth: 2 16 | 17 | getting-started 18 | using 19 | read-the-docs 20 | contributing 21 | 22 | .. _recent_changes: 23 | 24 | Recent Changes 25 | -------------- 26 | 27 | .. git_changelog:: 28 | 29 | 30 | .. _Sphinx documentation tool: http://sphinx-doc.org/ 31 | -------------------------------------------------------------------------------- /docs/read-the-docs.rst: -------------------------------------------------------------------------------- 1 | Enabling on Read the Docs 2 | ========================= 3 | 4 | `Read the Docs`_ is an excellent website that hosts Sphinx-generated 5 | documentation (including `the documentation for this project`_, which is 6 | probably where you are reading it). This document assumes that you already 7 | have your project configured on Read the Docs, using their default 8 | configuration [#read-the-docs-getting-started]_. 9 | 10 | As a custom extension, sphinx-git isn't supported out-of-the-box by Read the 11 | Docs, but it is very easy to get it working! 12 | 13 | Creating a Documentation Requirements File 14 | ------------------------------------------ 15 | 16 | The first thing you'll need to do is create a `pip requirements file`_ 17 | for your documentation. Create a file containing:: 18 | 19 | sphinx-git 20 | 21 | and commit it somewhere in your repository [#pinning]_ (I will assume it is in 22 | ``requirements/doc.txt`` for the rest of this document). 23 | 24 | Configuring Read the Docs 25 | ------------------------- 26 | 27 | Navigate to the Read the Docs admin page for your project. This will be of the 28 | form ``https://readthedocs.org/dashboard//edit/``. Once on this 29 | page, you need to do two things: 30 | 31 | * Tick the box under "Use virtualenv", so that Read the Docs will install our 32 | custom documentation requirements, and 33 | * Enter your documentation requirements file name in the "Requirements file" 34 | box (``requirements/doc.txt`` from above). 35 | 36 | Submitting the form should cause your project to be rebuilt, now with 37 | sphinx-git available! 38 | 39 | .. _Read the Docs: https://readthedocs.org/ 40 | .. _the documentation for this project: http://sphinx-git.readthedocs.org/en/latest/ 41 | .. _pip requirements file: http://www.pip-installer.org/en/latest/cookbook.html#requirements-files 42 | 43 | .. rubric:: Footnotes 44 | 45 | .. [#read-the-docs-getting-started] 46 | Follow `the Read the Docs getting started guide 47 | `_ if 48 | you haven't already. 49 | 50 | .. [#pinning] 51 | You should probably pin that requirement to a specific version, but that is 52 | outside the scope of this documentation. This is probably a good place to 53 | start reading about it: http://nvie.com/posts/pin-your-packages/ 54 | -------------------------------------------------------------------------------- /docs/using.rst: -------------------------------------------------------------------------------- 1 | Using sphinx-git 2 | ================ 3 | 4 | Currently, sphinx-git provides two extensions to Sphinx: the 5 | ``git_changelog`` and ``git_commit_detail`` directives. 6 | 7 | git_changelog Directive 8 | ----------------------- 9 | 10 | The ``git_changelog`` directive produces a list of commits in the repository in 11 | which the documentation build is happening. 12 | 13 | By default, it will output the most recent 10 commits. So:: 14 | 15 | .. git_changelog:: 16 | 17 | produces: 18 | 19 | .. git_changelog:: 20 | 21 | As you can see, each revision has the message, author and date output in a 22 | list. If a commit has a detailed message (i.e. any part of the commit message 23 | that is not on the first line), that will be output below the list item for 24 | that commit. 25 | 26 | Changing Number of Revisions in Output 27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 | 29 | If you want to change the number of revisions output by ``git_changelog``, then 30 | you can specify the ``:revisions:`` argument. So:: 31 | 32 | .. git_changelog:: 33 | :revisions: 2 34 | 35 | produces: 36 | 37 | .. git_changelog:: 38 | :revisions: 2 39 | 40 | If you specify more revisions than the history contains, all revisions in the 41 | history will be displayed. 42 | 43 | Specifying Range of Revisions to Output 44 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | 46 | If you want even more control over the output of ``git_changelog``, then you 47 | can specify precisely the revisions you want included using the ``:rev-list:`` 48 | argument. So:: 49 | 50 | .. git_changelog:: 51 | :rev-list: v3..v4 52 | 53 | produces a list of all the commits between the v3 and v4 tags: 54 | 55 | .. git_changelog:: 56 | :rev-list: v3..v4 57 | 58 | and:: 59 | 60 | .. git_changelog:: 61 | :rev-list: v1 62 | 63 | gives you a list of all commits up to the v1 tag (most of which involved me 64 | wrestling with setuptools): 65 | 66 | .. git_changelog:: 67 | :rev-list: v1 68 | 69 | ``:rev-list:`` lets you specify revisions using anything that ``git rev-parse`` 70 | will accept. See `the man page`_ for details. 71 | 72 | .. warning:: 73 | 74 | The ``:revisions:`` argument and the ``:rev-list:`` argument don't play 75 | nicely together. ``:rev-list:`` will always take precedence, and all 76 | commits specified by the revision specification be output regardless of the 77 | ``:revisions:`` argument [#patches]_. 78 | 79 | Sphinx will output a warning if you specify both. 80 | 81 | Filter Revisons to Matching Only Certain Files Based on Filenames 82 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | 84 | If you only want to see the changelog regarding certain files (eg. for devops 85 | reasons you need to have both SaSS and CSS in your repository or you only want 86 | to see the changes made to the docs directory) you can use the 87 | ``:filename_filter:`` argument with ``git_changelog``. ``:filename_filter:`` is 88 | expecting anything that can be evaluated as a regular expression. So:: 89 | 90 | .. git_changelog:: 91 | :filename_filter: doc/.*\.rst 92 | 93 | will produce the list of commits that modified documentation content. 94 | 95 | .. note:: 96 | 97 | The ``:filename_filter:`` argument is compatible with both ``:revisions:`` 98 | and ``:rev-list:``. Filtering on filenames is then performed on the 99 | selected (number of) revisions. 100 | 101 | 102 | Preformatted Output for Detailed Messages 103 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | 105 | If you would prefer for the detailed commit messages to be output as 106 | preformatted text (e.g. if you include code samples in your commit messages), 107 | then you can specify this preference using the ``:detailed-message-pre:`` 108 | argument. So:: 109 | 110 | .. git_changelog:: 111 | :rev-list: 3669419^..3669419 112 | :detailed-message-pre: True 113 | 114 | becomes: 115 | 116 | .. git_changelog:: 117 | :rev-list: 3669419^..3669419 118 | :detailed-message-pre: True 119 | 120 | .. _the man page: https://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html 121 | 122 | .. rubric:: Footnotes 123 | 124 | .. [#patches] 125 | :doc:`Patches welcome! ` 126 | 127 | 128 | Hiding author name from change lines 129 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | 131 | If you need clean output without author's names in changelog, 132 | then you can specify this preference using the ``:hide_author: True`` 133 | argument, for example: 134 | 135 | .. git_changelog:: 136 | :hide_author: 1 137 | 138 | 139 | Hiding commit date from change lines 140 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 141 | 142 | If you need clean output without commit dates in changelog, 143 | then you can specify this preference using the ``:hide_date: True`` 144 | argument, for example: 145 | 146 | .. git_changelog:: 147 | :hide_date: True 148 | 149 | 150 | Strong commit message text 151 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | 153 | Commit message formatted with bold text by default. 154 | Use ``:detailed-message-strong: False`` argument if you prefer regular font, 155 | for example: 156 | 157 | .. git_changelog:: 158 | :detailed-message-strong: False 159 | 160 | 161 | git_commit_detail Directive 162 | --------------------------- 163 | 164 | The ``git_commit_detail`` directive produces information about the current commit in the 165 | repository against which the documentation is being built. The following options are available: 166 | 167 | branch 168 | Display the branch name. 169 | 170 | commit 171 | Display the commit hash. 172 | 173 | sha_length 174 | Set the number of characters of the hash to display. 175 | 176 | no_github_link 177 | By default, if the repository's origin remote is GitHub, the commit will 178 | link to the GitHub page for the commit. Use this option to disable this. 179 | 180 | uncommitted 181 | Show a warning if there are uncommitted changes in the repository. 182 | 183 | untracked 184 | Show a warning if there are untracked files in the repository directory. 185 | 186 | For example:: 187 | 188 | .. git_commit_detail:: 189 | :branch: 190 | :commit: 191 | :sha_length: 10 192 | :uncommitted: 193 | :untracked: 194 | 195 | becomes 196 | 197 | .. git_commit_detail:: 198 | :branch: 199 | :commit: 200 | :sha_length: 10 201 | :uncommitted: 202 | :untracked: 203 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | isort 3 | lxml 4 | mock 5 | nose 6 | pycodestyle 7 | pylint 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | 4 | exec(compile( 5 | open('sphinx_git/version.py').read(), 'sphinx_git/version.py', 'exec')) 6 | 7 | 8 | setup( 9 | name='sphinx-git', 10 | description='git Changelog for Sphinx', 11 | version=__version__, 12 | author='Daniel Watkins', 13 | author_email='daniel@daniel-watkins.co.uk', 14 | install_requires=['six', 'sphinx', 'GitPython>=0.3.6'], 15 | url="https://github.com/OddBloke/sphinx-git", 16 | packages=['sphinx_git'], 17 | ) 18 | -------------------------------------------------------------------------------- /sphinx_git/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012-2013 (C) Daniel Watkins 2 | # 3 | # This program is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program. If not, see . 15 | 16 | import re 17 | from datetime import datetime 18 | 19 | import six 20 | from docutils import nodes 21 | from docutils.parsers.rst import Directive, directives 22 | from git import Repo 23 | 24 | 25 | # pylint: disable=too-few-public-methods, abstract-method 26 | class GitDirectiveBase(Directive): 27 | def _find_repo(self): 28 | env = self.state.document.settings.env 29 | repo_dir = self.options.get('repo-dir', env.srcdir) 30 | repo = Repo(repo_dir, search_parent_directories=True) 31 | return repo 32 | 33 | 34 | # pylint: disable=too-few-public-methods 35 | class GitCommitDetail(GitDirectiveBase): 36 | default_sha_length = 7 37 | 38 | option_spec = { 39 | 'branch': bool, 40 | 'commit': bool, 41 | 'uncommitted': bool, 42 | 'untracked': bool, 43 | 'sha_length': int, 44 | 'no_github_link': bool, 45 | } 46 | 47 | # pylint: disable=attribute-defined-outside-init 48 | def run(self): 49 | self.repo = self._find_repo() 50 | self.branch_name = None 51 | if not self.repo.head.is_detached: 52 | self.branch_name = self.repo.head.ref.name 53 | self.commit = self.repo.commit() 54 | self.sha_length = self.options.get('sha_length', 55 | self.default_sha_length) 56 | markup = self._build_markup() 57 | return markup 58 | 59 | def _build_markup(self): 60 | field_list = nodes.field_list() 61 | item = nodes.paragraph() 62 | item.append(field_list) 63 | if 'branch' in self.options and self.branch_name is not None: 64 | name = nodes.field_name(text="Branch") 65 | body = nodes.field_body() 66 | body.append(nodes.emphasis(text=self.branch_name)) 67 | field = nodes.field() 68 | field += [name, body] 69 | field_list.append(field) 70 | if 'commit' in self.options: 71 | name = nodes.field_name(text="Commit") 72 | body = nodes.field_body() 73 | if 'no_github_link' in self.options: 74 | body.append(self._commit_text_node()) 75 | else: 76 | body.append(self._github_link()) 77 | field = nodes.field() 78 | field += [name, body] 79 | field_list.append(field) 80 | if 'uncommitted' in self.options and self.repo.is_dirty(): 81 | item.append(nodes.warning('', nodes.inline( 82 | text="There were uncommitted changes when this was compiled." 83 | ))) 84 | if 'untracked' in self.options and self.repo.untracked_files: 85 | item.append(nodes.warning('', nodes.inline( 86 | text="There were untracked files when this was compiled." 87 | ))) 88 | return [item] 89 | 90 | def _github_link(self): 91 | try: 92 | url = self.repo.remotes.origin.url 93 | url = url.replace('.git/', '').replace('.git', '') 94 | if 'github' in url: 95 | commit_url = url + '/commit/' + self.commit.hexsha 96 | ref = nodes.reference('', self.commit.hexsha[:self.sha_length], 97 | refuri=commit_url) 98 | par = nodes.paragraph('', '', ref) 99 | return par 100 | return self._commit_text_node() 101 | except AttributeError as error: 102 | print("ERROR: ", error) 103 | return self._commit_text_node() 104 | 105 | def _commit_text_node(self): 106 | return nodes.emphasis(text=self.commit.hexsha[:self.sha_length]) 107 | 108 | 109 | # pylint: disable=too-few-public-methods 110 | class GitChangelog(GitDirectiveBase): 111 | 112 | option_spec = { 113 | 'revisions': directives.nonnegative_int, 114 | 'rev-list': six.text_type, 115 | 'detailed-message-pre': bool, 116 | 'detailed-message-strong': bool, 117 | 'filename_filter': six.text_type, 118 | 'hide_author': bool, 119 | 'hide_date': bool, 120 | 'hide_details': bool, 121 | 'repo-dir': six.text_type, 122 | } 123 | 124 | def run(self): 125 | if 'rev-list' in self.options and 'revisions' in self.options: 126 | self.state.document.reporter.warning( 127 | 'Both rev-list and revisions options given; proceeding using' 128 | ' only rev-list.', 129 | line=self.lineno 130 | ) 131 | commits = self._commits_to_display() 132 | markup = self._build_markup(commits) 133 | return markup 134 | 135 | def _commits_to_display(self): 136 | repo = self._find_repo() 137 | commits = self._filter_commits(repo) 138 | return commits 139 | 140 | def _filter_commits(self, repo): 141 | if 'rev-list' in self.options: 142 | commits = repo.iter_commits(rev=self.options['rev-list']) 143 | else: 144 | commits = repo.iter_commits() 145 | revisions_to_display = self.options.get('revisions', 10) 146 | commits = list(commits)[:revisions_to_display] 147 | if 'filename_filter' in self.options: 148 | return self._filter_commits_on_filenames(commits) 149 | return commits 150 | 151 | def _filter_commits_on_filenames(self, commits): 152 | filtered_commits = [] 153 | filter_exp = re.compile(self.options.get('filename_filter', r'.*')) 154 | for commit in commits: 155 | # SHA of an empty tree found at 156 | # http://stackoverflow.com/questions/33916648/get-the-diff-details-of-first-commit-in-gitpython 157 | # will be used to get the list of files of initial commit 158 | compared_with = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' 159 | if len(commit.parents) > 0: # pylint: disable=len-as-condition 160 | compared_with = commit.parents[0].hexsha 161 | for diff in commit.diff(compared_with): 162 | if filter_exp.match(diff.a_path) or \ 163 | filter_exp.match(diff.b_path): 164 | filtered_commits.append(commit) 165 | break 166 | return filtered_commits 167 | 168 | def _build_markup(self, commits): 169 | list_node = nodes.bullet_list() 170 | for commit in commits: 171 | date_str = datetime.fromtimestamp(commit.authored_date) 172 | if '\n' in commit.message: 173 | message, detailed_message = commit.message.split('\n', 1) 174 | else: 175 | message = commit.message 176 | detailed_message = None 177 | 178 | item = nodes.list_item() 179 | par = nodes.paragraph() 180 | # choose detailed message style by detailed-message-strong option 181 | if self.options.get('detailed-message-strong', True): 182 | par += nodes.strong(text=message) 183 | else: 184 | par += nodes.inline(text=message) 185 | 186 | if not self.options.get('hide_author'): 187 | par += [nodes.inline(text=" by "), 188 | nodes.emphasis(text=six.text_type(commit.author))] 189 | if not self.options.get('hide_date'): 190 | par += [nodes.inline(text=" at "), 191 | nodes.emphasis(text=str(date_str))] 192 | item.append(par) 193 | if detailed_message and not self.options.get('hide_details'): 194 | detailed_message = detailed_message.strip() 195 | if self.options.get('detailed-message-pre', False): 196 | item.append( 197 | nodes.literal_block(text=detailed_message)) 198 | else: 199 | item.append(nodes.paragraph(text=detailed_message)) 200 | list_node.append(item) 201 | return [list_node] 202 | 203 | 204 | def setup(app): 205 | app.add_directive('git_changelog', GitChangelog) 206 | app.add_directive('git_commit_detail', GitCommitDetail) 207 | -------------------------------------------------------------------------------- /sphinx_git/version.py: -------------------------------------------------------------------------------- 1 | __version__ = '11.0.0' 2 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | from shutil import rmtree 2 | from tempfile import mkdtemp 3 | 4 | from mock import Mock 5 | 6 | 7 | class TempDirTestCase(object): 8 | def setup(self): 9 | self.root = mkdtemp() 10 | 11 | def teardown(self): 12 | rmtree(self.root) 13 | 14 | 15 | class MakeTestableMixin(object): 16 | """ 17 | Define an __init__ with no arguments for sphinx directives. 18 | 19 | This saves us from having to pass in a bunch of Mocks which we will never 20 | look at. 21 | """ 22 | 23 | def __init__(self): 24 | self.lineno = 123 25 | self.options = {} 26 | self.state = Mock() 27 | -------------------------------------------------------------------------------- /tests/test_git_changelog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | from datetime import datetime 4 | 5 | import six 6 | from bs4 import BeautifulSoup 7 | from git import InvalidGitRepositoryError, Repo 8 | from mock import ANY, call 9 | from nose.tools import ( 10 | assert_equal, 11 | assert_greater, 12 | assert_in, 13 | assert_less_equal, 14 | assert_not_in, 15 | assert_raises, 16 | ) 17 | 18 | from sphinx_git import GitChangelog 19 | 20 | from . import MakeTestableMixin, TempDirTestCase 21 | 22 | 23 | class TestableGitChangelog(MakeTestableMixin, GitChangelog): 24 | 25 | pass 26 | 27 | 28 | class ChangelogTestCase(TempDirTestCase): 29 | 30 | def setup(self): 31 | super(ChangelogTestCase, self).setup() 32 | self.changelog = TestableGitChangelog() 33 | self.changelog.state.document.settings.env.srcdir = self.root 34 | 35 | 36 | class TestNoRepository(ChangelogTestCase): 37 | 38 | def test_not_a_repository(self): 39 | assert_raises(InvalidGitRepositoryError, self.changelog.run) 40 | 41 | 42 | class TestWithRepository(ChangelogTestCase): 43 | 44 | def _set_username(self, username): 45 | config_writer = self.repo.config_writer() 46 | config_writer.set_value('user', 'name', username) 47 | config_writer.release() 48 | 49 | def setup(self): 50 | super(TestWithRepository, self).setup() 51 | self.repo = Repo.init(self.root) 52 | self._set_username('Test User') 53 | 54 | def test_no_commits(self): 55 | assert_raises(ValueError, self.changelog.run) 56 | 57 | def test_single_commit_produces_single_item(self): 58 | self.repo.index.commit('my root commit') 59 | nodes = self.changelog.run() 60 | assert_equal(1, len(nodes)) 61 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 62 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 63 | bullet_list = list_markup.bullet_list 64 | assert_equal(1, len(bullet_list.findAll('list_item'))) 65 | 66 | def test_single_commit_message_and_user_display(self): 67 | self.repo.index.commit('my root commit') 68 | nodes = self.changelog.run() 69 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 70 | item = list_markup.bullet_list.list_item 71 | children = list(item.childGenerator()) 72 | assert_equal(1, len(children)) 73 | par_children = list(item.paragraph.childGenerator()) 74 | assert_equal(5, len(par_children)) 75 | assert_equal('my root commit', par_children[0].text) 76 | assert_equal('Test User', par_children[2].text) 77 | 78 | def test_single_commit_message_and_user_display_with_non_ascii_chars(self): 79 | self._set_username('þéßþ Úßéë') 80 | self.repo.index.commit('my root commit') 81 | nodes = self.changelog.run() 82 | list_markup = BeautifulSoup(six.text_type(nodes[0]), features='xml') 83 | item = list_markup.bullet_list.list_item 84 | children = list(item.childGenerator()) 85 | assert_equal(1, len(children)) 86 | par_children = list(item.paragraph.childGenerator()) 87 | assert_equal(5, len(par_children)) 88 | assert_equal('my root commit', par_children[0].text) 89 | assert_equal(u'þéßþ Úßéë', par_children[2].text) 90 | 91 | def test_single_commit_time_display(self): 92 | before = datetime.now().replace(microsecond=0) 93 | self.repo.index.commit('my root commit') 94 | nodes = self.changelog.run() 95 | after = datetime.now() 96 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 97 | item = list_markup.bullet_list.list_item.paragraph 98 | children = list(item.childGenerator()) 99 | timestamp = datetime.strptime(children[4].text, '%Y-%m-%d %H:%M:%S') 100 | assert_less_equal(before, timestamp) 101 | assert_greater(after, timestamp) 102 | 103 | def test_single_commit_default_detail_setting(self): 104 | self.repo.index.commit( 105 | 'my root commit\n\nadditional information\nmore info' 106 | ) 107 | nodes = self.changelog.run() 108 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 109 | item = list_markup.bullet_list.list_item 110 | children = list(item.childGenerator()) 111 | assert_equal(2, len(children)) 112 | par_children = list(item.paragraph.childGenerator()) 113 | assert_equal(5, len(par_children)) 114 | assert_equal('my root commit', par_children[0].text) 115 | assert_equal('Test User', par_children[2].text) 116 | assert_equal( 117 | str(children[1]), 118 | 'additional information\nmore info' 119 | ) 120 | 121 | def test_single_commit_preformmated_detail_lines(self): 122 | self.repo.index.commit( 123 | 'my root commit\n\nadditional information\nmore info' 124 | ) 125 | self.changelog.options.update({'detailed-message-pre': True}) 126 | nodes = self.changelog.run() 127 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 128 | item = list_markup.bullet_list.list_item 129 | children = list(item.childGenerator()) 130 | assert_equal(2, len(children)) 131 | assert_equal( 132 | str(children[1]), 133 | 'additional information\n' 134 | 'more info' 135 | ) 136 | 137 | def test_more_than_ten_commits(self): 138 | for n in range(15): 139 | self.repo.index.commit('commit #{0}'.format(n)) 140 | nodes = self.changelog.run() 141 | assert_equal(1, len(nodes)) 142 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 143 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 144 | bullet_list = list_markup.bullet_list 145 | assert_equal(10, len(bullet_list.findAll('list_item'))) 146 | for n, child in zip(range(15, 5), bullet_list.childGenerator()): 147 | assert_in('commit #{0}'.format(n), child.text) 148 | assert_not_in('commit #4', bullet_list.text) 149 | 150 | def test_specifying_number_of_commits(self): 151 | for n in range(15): 152 | self.repo.index.commit('commit #{0}'.format(n)) 153 | self.changelog.options.update({'revisions': 5}) 154 | nodes = self.changelog.run() 155 | assert_equal(1, len(nodes)) 156 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 157 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 158 | bullet_list = list_markup.bullet_list 159 | assert_equal(5, len(bullet_list.findAll('list_item'))) 160 | for n, child in zip(range(15, 10), bullet_list.childGenerator()): 161 | assert_in('commit #{0}'.format(n), child.text) 162 | assert_not_in('commit #9', bullet_list.text) 163 | 164 | def test_specifying_a_rev_list(self): 165 | self.repo.index.commit('before tag') 166 | commit = self.repo.index.commit('at tag') 167 | self.repo.index.commit('after tag') 168 | self.repo.index.commit('last commit') 169 | self.repo.create_tag('testtag', commit) 170 | 171 | self.changelog.options.update({'rev-list': 'testtag..'}) 172 | nodes = self.changelog.run() 173 | 174 | assert_equal(1, len(nodes)) 175 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 176 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 177 | 178 | bullet_list = list_markup.bullet_list 179 | assert_equal(2, len(bullet_list.findAll('list_item'))) 180 | 181 | children = list(bullet_list.childGenerator()) 182 | first_element = children[0] 183 | second_element = children[1] 184 | assert_in('last commit', first_element.text) 185 | assert_in('after tag', second_element.text) 186 | 187 | def test_warning_given_if_rev_list_and_revisions_both_given(self): 188 | self.repo.index.commit('a commit') 189 | self.changelog.options.update({'rev-list': 'HEAD', 'revisions': 12}) 190 | nodes = self.changelog.run() 191 | assert_equal( 192 | 1, self.changelog.state.document.reporter.warning.call_count 193 | ) 194 | 195 | def test_line_number_displayed_in_multiple_option_warning(self): 196 | self.repo.index.commit('a commit') 197 | self.changelog.options.update({'rev-list': 'HEAD', 'revisions': 12}) 198 | nodes = self.changelog.run() 199 | document_reporter = self.changelog.state.document.reporter 200 | assert_equal( 201 | [call(ANY, line=self.changelog.lineno)], 202 | document_reporter.warning.call_args_list 203 | ) 204 | 205 | def test_name_filter(self): 206 | self.repo.index.commit('initial') 207 | for file_name in ['abc.txt', 'bcd.txt', 'abc.other', 'atxt']: 208 | full_path = os.path.join(self.repo.working_tree_dir, file_name) 209 | f = open(full_path, 'w+') 210 | f.close() 211 | self.repo.index.add([full_path]) 212 | self.repo.index.commit('commit with file {}'.format(file_name)) 213 | self.repo.index.commit('commit without file') 214 | 215 | self.changelog.options.update({'filename_filter': 'a.*txt'}) 216 | nodes = self.changelog.run() 217 | assert_equal(1, len(nodes)) 218 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 219 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 220 | 221 | bullet_list = list_markup.bullet_list 222 | assert_equal(2, len(bullet_list.findAll('list_item')), nodes) 223 | 224 | next_file = os.path.join(self.repo.working_tree_dir, 'atxt') 225 | f = open(next_file, 'w+') 226 | f.close() 227 | self.repo.index.add([next_file]) 228 | self.repo.index.commit('show me') 229 | 230 | nodes = self.changelog.run() 231 | assert_equal(1, len(nodes), nodes) 232 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 233 | assert_equal(1, len(list_markup.findAll('bullet_list'))) 234 | 235 | bullet_list = list_markup.bullet_list 236 | assert_equal(2, len(bullet_list.findAll('list_item')), nodes) 237 | 238 | def test_single_commit_hide_details(self): 239 | self.repo.index.commit( 240 | 'Another commit\n\nToo much information' 241 | ) 242 | self.changelog.options.update({'hide_details': True}) 243 | nodes = self.changelog.run() 244 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 245 | item = list_markup.bullet_list.list_item 246 | children = list(item.childGenerator()) 247 | assert_equal(1, len(children)) 248 | par_children = list(item.paragraph.childGenerator()) 249 | assert_equal(5, len(par_children)) 250 | assert_equal('Another commit', par_children[0].text) 251 | assert_equal('Test User', par_children[2].text) 252 | 253 | def test_single_commit_message_hide_author(self): 254 | self.repo.index.commit('Yet another commit') 255 | self.changelog.options.update({'hide_author': True}) 256 | nodes = self.changelog.run() 257 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 258 | item = list_markup.bullet_list.list_item 259 | children = list(item.childGenerator()) 260 | print(children) 261 | assert_equal(1, len(children)) 262 | par_children = list(item.paragraph.childGenerator()) 263 | assert_equal(3, len(par_children)) 264 | assert_equal('Yet another commit', par_children[0].text) 265 | assert_not_in(' by Test User', par_children[1].text) 266 | assert_in(' at ', par_children[1].text) 267 | 268 | def test_single_commit_message_hide_date(self): 269 | self.repo.index.commit('Yet yet another commit') 270 | self.changelog.options.update({'hide_date': True}) 271 | nodes = self.changelog.run() 272 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 273 | item = list_markup.bullet_list.list_item 274 | children = list(item.childGenerator()) 275 | print(children) 276 | assert_equal(1, len(children)) 277 | par_children = list(item.paragraph.childGenerator()) 278 | assert_equal(3, len(par_children)) 279 | assert_equal('Yet yet another commit', par_children[0].text) 280 | assert_not_in(' at ', par_children[1].text) 281 | assert_in(' by ', par_children[1].text) 282 | 283 | 284 | class TestWithOtherRepository(TestWithRepository): 285 | """ 286 | The destination repository is not in the same repository as the rst files. 287 | """ 288 | def setup(self): 289 | super(TestWithOtherRepository, self).setup() 290 | self.changelog.state.document.settings.env.srcdir = os.getcwd() 291 | self.changelog.options.update({'repo-dir': self.root}) 292 | -------------------------------------------------------------------------------- /tests/test_git_commit_detail.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | from tempfile import mkstemp 4 | 5 | from bs4 import BeautifulSoup 6 | from git import Repo 7 | from nose.tools import assert_equal, assert_in, assert_is, assert_is_not 8 | 9 | from sphinx_git import GitCommitDetail 10 | 11 | from . import MakeTestableMixin, TempDirTestCase 12 | 13 | 14 | class TestableGitCommitDetail(MakeTestableMixin, GitCommitDetail): 15 | github_nonce_url = 'https://github.com/no_user/no_repo.git/' 16 | github_nonce_commit_base = 'https://github.com/no_user/no_repo/commit/' 17 | 18 | 19 | class TestCommitDetail(TempDirTestCase): 20 | def setup(self): 21 | super(TestCommitDetail, self).setup() 22 | self.commit_detail = TestableGitCommitDetail() 23 | self.commit_detail.state.document.settings.env.srcdir = self.root 24 | self.repo = Repo.init(self.root) 25 | config_writer = self.repo.config_writer() 26 | config_writer.set_value('user', 'name', 'Test User') 27 | config_writer.release() 28 | 29 | def test_commit_only(self): 30 | self.repo.index.commit('my root commit') 31 | self.commit_detail.options = {'commit': True} 32 | nodes = self.commit_detail.run() 33 | node_p = nodes[0] #

node 34 | node_fl = node_p[0] # field list 35 | node_f = node_fl[0] # field 36 | assert_equal(1, len(node_fl)) 37 | assert_equal('Commit', node_f[0].astext()) 38 | assert_equal( 39 | self.repo.commit().hexsha[:GitCommitDetail.default_sha_length], 40 | node_f[1].astext() 41 | ) 42 | 43 | def test_branch_only(self): 44 | self.repo.index.commit('my root commit') 45 | self.commit_detail.options = {'branch': True} 46 | nodes = self.commit_detail.run() 47 | node_p = nodes[0] #

node 48 | node_fl = node_p[0] # field list 49 | node_f = node_fl[0] # field 50 | assert_equal(1, len(node_fl)) 51 | assert_equal('Branch', node_f[0].astext()) 52 | assert_equal('master', node_f[1].astext()) 53 | 54 | def test_commit_and_branch(self): 55 | self.repo.index.commit('my root commit') 56 | self.commit_detail.options = {'commit': True, 'branch': True} 57 | nodes = self.commit_detail.run() 58 | node_p = nodes[0] #

node 59 | node_fl = node_p[0] # field list 60 | node_f_b = node_fl[0] # field--branch 61 | node_f_c = node_fl[1] # field--commit 62 | assert_equal(2, len(node_fl)) 63 | assert_equal('Commit', node_f_c[0].astext()) 64 | assert_equal('Branch', node_f_b[0].astext()) 65 | 66 | def test_github_link(self): 67 | self.repo.index.commit('my root commit') 68 | self.commit_detail.options = {'commit': True} 69 | self.repo.create_remote('origin', self.commit_detail.github_nonce_url) 70 | nodes = self.commit_detail.run() 71 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 72 | assert_is_not(list_markup.reference, None) 73 | assert_equal( 74 | self.commit_detail.github_nonce_commit_base + 75 | self.repo.commit().hexsha, 76 | list_markup.reference['refuri'] 77 | ) 78 | assert_equal( 79 | self.repo.commit().hexsha[:GitCommitDetail.default_sha_length], 80 | list_markup.reference.text 81 | ) 82 | 83 | def test_no_github_link(self): 84 | self.repo.index.commit('my root commit') 85 | self.commit_detail.options = {'commit': True, 'no_github_link': True} 86 | self.repo.create_remote('origin', self.commit_detail.github_nonce_url) 87 | nodes = self.commit_detail.run() 88 | list_markup = BeautifulSoup(str(nodes[0]), features='xml') 89 | assert_is(list_markup.reference, None) 90 | 91 | def test_sha_length(self): 92 | self.repo.index.commit('my root commit') 93 | self.commit_detail.options = {'commit': True, 'sha_length': 4} 94 | nodes = self.commit_detail.run() 95 | node_p = nodes[0] #

node 96 | node_fl = node_p[0] # field list 97 | node_f = node_fl[0] # field 98 | assert_equal(1, len(node_fl)) 99 | assert_equal('Commit', node_f[0].astext()) 100 | assert_equal(self.repo.commit().hexsha[:4], node_f[1].astext()) 101 | 102 | def test_untracked_files(self): 103 | self.repo.index.commit('my root commit') 104 | self.commit_detail.options = {'untracked': True} 105 | fd, name = mkstemp(dir=self.root) 106 | os.close(fd) 107 | nodes = self.commit_detail.run() 108 | node_p = nodes[0] #

node 109 | assert_equal(2, len(node_p)) 110 | node_w = node_p[1] # nodes.warning 111 | node_i = node_w[0] # inline 112 | assert_in('untracked', node_i.astext()) 113 | 114 | def test_uncommitted_changes(self): 115 | fd, name = mkstemp(dir=self.root) 116 | self.repo.index.add([name]) 117 | self.repo.index.commit('my root commit') 118 | os.write(fd, "some change".encode('utf-8')) 119 | os.close(fd) 120 | self.commit_detail.options = {'uncommitted': True} 121 | nodes = self.commit_detail.run() 122 | node_p = nodes[0] #

node 123 | assert_equal(2, len(node_p)) 124 | node_w = node_p[1] # nodes.warning 125 | node_i = node_w[0] # inline 126 | assert_in('uncommitted', node_i.astext()) 127 | 128 | def test_detached_head(self): 129 | self.repo.index.commit('my root commit') 130 | self.repo.index.commit('a second commit') 131 | self.repo.head.reference = self.repo.commit('HEAD~') 132 | assert self.repo.head.is_detached, "HEAD unexpectedly attached" 133 | 134 | self.commit_detail.options = {'commit': True} 135 | nodes = self.commit_detail.run() 136 | node_p = nodes[0] #

node 137 | node_fl = node_p[0] # field list 138 | node_f = node_fl[0] # field 139 | assert_equal(1, len(node_fl)) 140 | assert_equal('Commit', node_f[0].astext()) 141 | assert_equal( 142 | self.repo.commit().hexsha[:GitCommitDetail.default_sha_length], 143 | node_f[1].astext() 144 | ) 145 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py27,py34,py35 3 | 4 | [testenv] 5 | deps = -rrequirements.txt 6 | commands = 7 | pycodestyle sphinx_git/ tests/ 8 | pylint --rcfile=.pylintrc sphinx_git/ 9 | isort --diff --recursive --check sphinx_git tests 10 | nosetests 11 | --------------------------------------------------------------------------------