Git directive

Options

The repository directive takes these options.

  • number_of_revisions: positive integer

    Set the number of revision to show commit history. Default is 10.

  • revision: revision string

    Set revision string to show particular commit history.

  • with_ref_url:

    Set as a flag to show commit URL on repository hosting service. It supports github and bitbucket.

  • include_diff:

    Set as a flag to show diff text with commit history. The diff text is hidden with initial state. Clicking around commit message shows the diff text.

Top commit history

.. git::
    :number_of_revisions: 20
    :with_ref_url:
    :include_diff:
  • update requirements.txt for readthedocs by Tetsuya Morimoto at 2020-04-19 10:25:34

    c679610f5090efe28720e30830a16c0a886bc274

    diff --git a/docs/requirements.txt b/docs/requirements.txt
    index 724c3fa..e30d554 100644
    --- a/docs/requirements.txt
    +++ b/docs/requirements.txt
    @@ -1 +1,28 @@
    +alabaster==0.7.12
    +Babel==2.8.0
    +certifi==2020.4.5.1
    +chardet==3.0.4
    +docutils==0.16
    +gitdb==4.0.4
    +GitPython==3.1.1
    +idna==2.9
    +imagesize==1.2.0
    +Jinja2==2.11.2
    +MarkupSafe==1.1.1
    +packaging==20.3
    +Pygments==2.6.1
    +pyparsing==2.4.7
    +pytz==2019.3
    +requests==2.23.0
    +six==1.14.0
    +smmap==3.0.2
    +snowballstemmer==2.0.0
     Sphinx==3.0.1
    +sphinxcontrib-applehelp==1.0.2
    +sphinxcontrib-devhelp==1.0.2
    +sphinxcontrib-htmlhelp==1.0.3
    +sphinxcontrib-jsmath==1.0.1
    +sphinxcontrib-qthelp==1.0.3
    +sphinxcontrib-serializinghtml==1.1.4
    +sphinxcontrib-vcs==0.3.0
    +urllib3==1.25.9
    diff --git a/requirements.txt b/requirements.txt
    deleted file mode 100644
    index b7cef77..0000000
    --- a/requirements.txt
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -alabaster==0.7.12
    -Babel==2.6.0
    -certifi==2019.3.9
    -chardet==3.0.4
    -docutils==0.14
    -gitdb2==2.0.5
    -GitPython==2.1.11
    -idna==2.8
    -imagesize==1.1.0
    -Jinja2==2.10.1
    -MarkupSafe==1.1.1
    -packaging==19.0
    -Pygments==2.3.1
    -pyparsing==2.4.0
    -pytz==2019.1
    -requests==2.21.0
    -six==1.12.0
    -smmap2==2.0.5
    -snowballstemmer==1.2.1
    -Sphinx==2.0.1
    -sphinxcontrib-applehelp==1.0.1
    -sphinxcontrib-devhelp==1.0.1
    -sphinxcontrib-htmlhelp==1.0.2
    -sphinxcontrib-jsmath==1.0.1
    -sphinxcontrib-qthelp==1.0.2
    -sphinxcontrib-serializinghtml==1.1.3
    -sphinxcontrib-vcs==0.2.0
    -urllib3==1.24.2
    
  • add readthedocs configuration by Tetsuya Morimoto at 2020-04-19 10:19:59

    a670da28b99537ab3ecc1a5c6c8a315c8b9cbdb7

    diff --git a/.readthedocs.yml b/.readthedocs.yml
    new file mode 100644
    index 0000000..380cc55
    --- /dev/null
    +++ b/.readthedocs.yml
    @@ -0,0 +1,8 @@
    +version: 2
    +python:
    +  version: 3.8
    +  install:
    +    - requirements: docs/requirements.txt
    +sphinx:
    +  configuration: docs/conf.py
    +formats: all
    diff --git a/docs/requirements.txt b/docs/requirements.txt
    new file mode 100644
    index 0000000..724c3fa
    --- /dev/null
    +++ b/docs/requirements.txt
    @@ -0,0 +1 @@
    +Sphinx==3.0.1
    
  • update version 0.3.0 by Tetsuya Morimoto at 2020-04-19 10:01:26

    42609430def821e0f022d4f96ae0096d97b3fd49

    diff --git a/README.md b/README.md
    index 7da6901..7a8eaf6 100644
    --- a/README.md
    +++ b/README.md
    @@ -32,6 +32,11 @@ For more information have a look at [the documentation](https://sphinxcontrib-vc
     
     ## ChangeLog
     
    +### 0.3.0 (2020-04-19)
    +
    +* drop Python 3.5 support
    +* add type annotation and modules reference
    +
     ### 0.2.2 (2019-11-06)
     
     * fix packaging issue: cannot import sphinxcontrib.repository
    diff --git a/docs/conf.py b/docs/conf.py
    index bc84ddd..f29c996 100644
    --- a/docs/conf.py
    +++ b/docs/conf.py
    @@ -1,5 +1,3 @@
    -# -*- coding: utf-8 -*-
    -#
     # sphinxcontrib-vcs documentation build configuration file, created by
     # sphinx-quickstart on Tue Sep  6 08:30:32 2016.
     #
    @@ -54,18 +52,18 @@ source_suffix = '.rst'
     master_doc = 'index'
     
     # General information about the project.
    -project = u'sphinxcontrib-vcs'
    -copyright = u'2016, Tetsuya Morimoto'
    -author = u'Tetsuya Morimoto'
    +project = 'sphinxcontrib-vcs'
    +copyright = '2020, Tetsuya Morimoto'
    +author = 'Tetsuya Morimoto'
     
     # The version info for the project you're documenting, acts as replacement for
     # |version| and |release|, also used in various other places throughout the
     # built documents.
     #
     # The short X.Y version.
    -version = u'0.1'
    +version = '3.0'
     # The full version, including alpha/beta/rc tags.
    -release = u'0.1'
    +release = '3.0.0'
     
     # The language for content autogenerated by Sphinx. Refer to documentation
     # for a list of supported languages.
    @@ -125,7 +123,7 @@ todo_include_todos = False
     # The theme to use for HTML and HTML Help pages.  See the documentation for
     # a list of builtin themes.
     #
    -html_theme = 'nature'
    +html_theme = 'haiku'
     
     # Theme options are theme-specific and customize the look and feel of a theme
     # further.  For a list of options available for each theme, see the
    @@ -265,8 +263,8 @@ latex_elements = {
     # (source start file, target name, title,
     #  author, documentclass [howto, manual, or own class]).
     latex_documents = [
    -    (master_doc, 'sphinxcontrib-vcs.tex', u'sphinxcontrib-vcs Documentation',
    -     u'Tetsuya Morimoto', 'manual'),
    +    (master_doc, 'sphinxcontrib-vcs.tex', 'sphinxcontrib-vcs Documentation',
    +     'Tetsuya Morimoto', 'manual'),
     ]
     
     # The name of an image file (relative to this directory) to place at the top of
    @@ -307,7 +305,7 @@ latex_documents = [
     # One entry per manual page. List of tuples
     # (source start file, name, description, authors, manual section).
     man_pages = [
    -    (master_doc, 'sphinxcontrib-vcs', u'sphinxcontrib-vcs Documentation',
    +    (master_doc, 'sphinxcontrib-vcs', 'sphinxcontrib-vcs Documentation',
          [author], 1)
     ]
     
    @@ -322,7 +320,7 @@ man_pages = [
     # (source start file, target name, title, author,
     #  dir menu entry, description, category)
     texinfo_documents = [
    -    (master_doc, 'sphinxcontrib-vcs', u'sphinxcontrib-vcs Documentation',
    +    (master_doc, 'sphinxcontrib-vcs', 'sphinxcontrib-vcs Documentation',
          author, 'sphinxcontrib-vcs', 'One line description of project.',
          'Miscellaneous'),
     ]
    diff --git a/setup.py b/setup.py
    index e476271..4f6aa6a 100644
    --- a/setup.py
    +++ b/setup.py
    @@ -22,9 +22,9 @@ setup(
             'Intended Audience :: Developers',
             'Operating System :: OS Independent',
             'Programming Language :: Python :: 3',
    -        'Programming Language :: Python :: 3.5',
             'Programming Language :: Python :: 3.6',
             'Programming Language :: Python :: 3.7',
    +        'Programming Language :: Python :: 3.8',
             'Programming Language :: Python :: Implementation :: CPython',
             'Topic :: Software Development :: Libraries',
             'Environment :: Console',
    
  • add autodoc.typehints to make a module reference with type hints by Tetsuya Morimoto at 2020-04-19 09:38:09

    068a324a04089b6c62a37dd019abf70745ea4bf0

    diff --git a/docs/conf.py b/docs/conf.py
    index 33518c2..bc84ddd 100644
    --- a/docs/conf.py
    +++ b/docs/conf.py
    @@ -29,7 +29,13 @@
     # Add any Sphinx extension module names here, as strings. They can be
     # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
     # ones.
    -extensions = ['sphinxcontrib.vcs']
    +extensions = [
    +    'sphinx.ext.autodoc',
    +    'sphinx.ext.autodoc.typehints',
    +    'sphinx.ext.autosummary',
    +    'sphinxcontrib.vcs',
    +]
    +autodoc_typehints = 'description'
     
     # Add any paths that contain templates here, relative to this directory.
     templates_path = ['_templates']
    diff --git a/docs/index.rst b/docs/index.rst
    index 43db167..b20c97a 100644
    --- a/docs/index.rst
    +++ b/docs/index.rst
    @@ -22,10 +22,19 @@ Acknowledgments
     .. _sphinx-git: https://github.com/OddBloke/sphinx-git
     
     
    +Modules
    +=======
    +
    +.. currentmodule:: sphinxcontrib
    +
    +.. autosummary::
    +
    +    vcs
    +    repository
    +
     Indices and tables
     ==================
     
     * :ref:`genindex`
    -* :ref:`modindex`
     * :ref:`search`
     
    diff --git a/docs/repository.rst b/docs/repository.rst
    new file mode 100644
    index 0000000..4b8e71c
    --- /dev/null
    +++ b/docs/repository.rst
    @@ -0,0 +1,9 @@
    +:orphan:
    +
    +sphinxcontrib.repository
    +========================
    +
    +.. automodule:: sphinxcontrib.repository
    +
    +.. automodule:: sphinxcontrib.repository.git
    +   :members:
    diff --git a/docs/vcs.rst b/docs/vcs.rst
    new file mode 100644
    index 0000000..8a0880f
    --- /dev/null
    +++ b/docs/vcs.rst
    @@ -0,0 +1,8 @@
    +:orphan:
    +
    +sphinxcontrib.vcs
    +=================
    +
    +.. automodule:: sphinxcontrib.vcs
    +   :members:
    +   :undoc-members:
    diff --git a/sphinxcontrib/repository/__init__.py b/sphinxcontrib/repository/__init__.py
    index 0b16719..f7a6f12 100644
    --- a/sphinxcontrib/repository/__init__.py
    +++ b/sphinxcontrib/repository/__init__.py
    @@ -1 +1,4 @@
    -from ._git import GitRepository  # noqa
    +"""
    +Define an implementation to handle each repository.
    +"""
    +from .git import GitRepository  # noqa
    diff --git a/sphinxcontrib/repository/_git.py b/sphinxcontrib/repository/git.py
    similarity index 90%
    rename from sphinxcontrib/repository/_git.py
    rename to sphinxcontrib/repository/git.py
    index a29f4be..9ff9a62 100644
    --- a/sphinxcontrib/repository/_git.py
    +++ b/sphinxcontrib/repository/git.py
    @@ -1,3 +1,6 @@
    +"""
    +Implement Git repository.
    +"""
     import re
     
     import gitdb
    @@ -33,9 +36,15 @@ class GitRepository(Repo):
     
         @property
         def branch_name(self) -> str:
    +        """
    +        Represent branch name.
    +        """
             return self.head.ref.name
     
         def get_commit(self, revision: str) -> Optional[Commit]:
    +        """
    +        Return `Commit` object of given revision.
    +        """
             try:
                 commit = self.commit(revision)
             except gitdb.exc.BadName as err:
    @@ -55,6 +64,9 @@ class GitRepository(Repo):
                         revision: Optional[str] = None,
                         max_count: Optional[int] = None,
                         **kwargs: Any) -> List[Commit]:
    +        """
    +        Return List of `Commit` objects.
    +        """
             if revision is not None:
                 self.get_commit(revision)
                 self.max_count = 1
    @@ -75,6 +87,9 @@ class GitRepository(Repo):
             return self._commits[:self.max_count]
     
         def get_diff(self, revision: str) -> str:
    +        """
    +        Return diff string of given revision.
    +        """
             if len(self._commits) == 0:
                 self.get_commits()
     
    @@ -89,6 +104,9 @@ class GitRepository(Repo):
             return self.git.diff(prev_hexsha, target_commit.hexsha)
     
         def get_commit_url(self, revision: str) -> str:
    +        """
    +        Return the commit URL of given revision.
    +        """
             if len(self._commits) == 0:
                 self.get_commits()
     
    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index 90546f4..f319f52 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -1,3 +1,6 @@
    +"""
    +Define Sphinx directive to handle a repository.
    +"""
     import os
     from datetime import datetime
     
    @@ -68,6 +71,9 @@ class BaseDirective(Directive):
             ...
     
         def run(self) -> List[Node]:
    +        """
    +        Return list of `Node`.
    +        """
             list_node = nodes.bullet_list()
     
             number_of_revisions = self.options.get(OPTION_NUMBER_OF_REVISIONS, 10)
    @@ -85,12 +91,18 @@ class BaseDirective(Directive):
     class GitDirective(BaseDirective):
     
         def get_repo(self, number_of_revisions: int) -> GitRepository:
    +        """
    +        Return Git repository.
    +        """
             env = self.state.document.settings.env
             return GitRepository(
                 number_of_revisions, env.srcdir, search_parent_directories=True,
             )
     
         def get_changelog(self, repo: GitRepository, commit: Commit) -> Node:
    +        """
    +        Return changelog.
    +        """
             item = nodes.list_item()
             para = nodes.paragraph()
     
    
  • add mypy test by Tetsuya Morimoto at 2020-04-19 07:41:28

    2afd4c283df724a30deed48404f3d3ab710ab25a

    diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml
    index 2236eee..38bc982 100644
    --- a/.github/workflows/pythonpackage.yml
    +++ b/.github/workflows/pythonpackage.yml
    @@ -34,6 +34,10 @@ jobs:
             flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
             # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
             flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
    +    - name: Type check with mypy
    +      run: |
    +        pip install mypy
    +        mypy sphinxcontrib/
         - name: Test with pytest
           run: |
             pip install pytest
    
  • add type annotation to be able to check type error by Tetsuya Morimoto at 2020-04-18 15:35:03

    e5f92c2d00ce4fdbb641e836a4fa8c07a24999ec

    diff --git a/.gitignore b/.gitignore
    index 9be4ee2..54a03a5 100644
    --- a/.gitignore
    +++ b/.gitignore
    @@ -1,3 +1,4 @@
    +.mypy_cache/
     _build/
     
     # Byte-compiled / optimized / DLL files
    diff --git a/setup.cfg b/setup.cfg
    index e18e330..55c5fdd 100644
    --- a/setup.cfg
    +++ b/setup.cfg
    @@ -10,6 +10,9 @@ universal = 1
     [upload_sphinx]
     upload-dir = docs/_build/html
     
    +[mypy]
    +ignore_missing_imports = True
    +
     [tool:pytest]
     markers =
         sphinx
    diff --git a/sphinxcontrib/repository/_git.py b/sphinxcontrib/repository/_git.py
    index 3dbae74..a29f4be 100644
    --- a/sphinxcontrib/repository/_git.py
    +++ b/sphinxcontrib/repository/_git.py
    @@ -6,33 +6,42 @@ from git import Repo
     from .utils import find_hosting_site, make_commit_url
     from .utils import log
     
    +# type check
    +from typing import Any
    +from typing import Dict
    +from typing import List
    +from typing import Optional
    +from typing import Pattern
    +from git.objects.commit import Commit
    +
     
     class GitRepository(Repo):
     
         EMPTY_TREE_SHA = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
    -    URL_PATTERN = re.compile(
    +    URL_PATTERN: Pattern[str] = re.compile(
             r"""
             git@(?P<domain>.*?):(?P<account>.*?)/(?P<repository_name>.*?)\.git
             |https://github.com/(?P<account_>.*?)/(?P<repository_name_>.*?)\.git
             """, re.VERBOSE
         )
     
    -    def __init__(self, max_count, *args, **kwargs):
    +    def __init__(self, max_count: int, *args: Any, **kwargs: Any) -> None:
             super(GitRepository, self).__init__(*args, **kwargs)
    -        self.max_count = max_count
    -        self._hexsha = {}
    -        self._commits = []
    +        self.max_count: int = max_count
    +        self._hexsha: Dict[str, int] = {}
    +        self._commits: List[Commit] = []
     
         @property
    -    def branch_name(self):
    +    def branch_name(self) -> str:
             return self.head.ref.name
     
    -    def get_commit(self, revision):
    +    def get_commit(self, revision: str) -> Optional[Commit]:
             try:
                 commit = self.commit(revision)
             except gitdb.exc.BadName as err:
                 log.error(err)
                 log.warn("Not found '%s' in git repository" % revision)
    +            return None
             else:
                 self._commits.append(commit)
                 self._hexsha[commit.hexsha] = 0
    @@ -42,7 +51,10 @@ class GitRepository(Repo):
                     self._hexsha[prev_commit.hexsha] = 1
                 return commit
     
    -    def get_commits(self, revision=None, max_count=None, **kwargs):
    +    def get_commits(self,
    +                    revision: Optional[str] = None,
    +                    max_count: Optional[int] = None,
    +                    **kwargs: Any) -> List[Commit]:
             if revision is not None:
                 self.get_commit(revision)
                 self.max_count = 1
    @@ -62,7 +74,7 @@ class GitRepository(Repo):
     
             return self._commits[:self.max_count]
     
    -    def get_diff(self, revision):
    +    def get_diff(self, revision: str) -> str:
             if len(self._commits) == 0:
                 self.get_commits()
     
    @@ -76,7 +88,7 @@ class GitRepository(Repo):
                 prev_hexsha = self.EMPTY_TREE_SHA
             return self.git.diff(prev_hexsha, target_commit.hexsha)
     
    -    def get_commit_url(self, revision):
    +    def get_commit_url(self, revision: str) -> str:
             if len(self._commits) == 0:
                 self.get_commits()
     
    @@ -85,11 +97,11 @@ class GitRepository(Repo):
             return make_commit_url(self.URL_PATTERN, url, site, revision)
     
     
    -def get_repo(path):
    -    return GitRepository(path, search_parent_directories=True)
    +def get_repo(path: str) -> GitRepository:
    +    return GitRepository(5, path=path, search_parent_directories=True)
     
     
    -def test():
    +def test() -> None:
         r = get_repo('.')
     
         commits = r.get_commits(max_count=3)
    diff --git a/sphinxcontrib/repository/utils.py b/sphinxcontrib/repository/utils.py
    index c7de869..20f4dd8 100644
    --- a/sphinxcontrib/repository/utils.py
    +++ b/sphinxcontrib/repository/utils.py
    @@ -1,7 +1,13 @@
     import logging
     import re
     
    -HOSTING_SERVICE = {
    +# type check
    +from typing import Dict
    +from typing import Optional
    +from typing import Pattern
    +
    +
    +HOSTING_SERVICE: Dict[str, Dict[str, Optional[str]]] = {
         'github': {
             'site': 'https://github.com',
             'commit_template': '{site}/{user}/{repository}/commit/{sha}',
    @@ -23,7 +29,7 @@ logging.basicConfig(
     log = logging.getLogger('sphinxcontrib-vcs')
     
     
    -def find_hosting_site(url):
    +def find_hosting_site(url: str) -> Dict[str, Optional[str]]:
         if url.find('github.com') > 0:
             return HOSTING_SERVICE['github']
         elif url.find('bitbucket.org') > 0:
    @@ -31,7 +37,8 @@ def find_hosting_site(url):
         return HOSTING_SERVICE['internal']
     
     
    -def make_commit_url(pattern, path, site, revision):
    +def make_commit_url(pattern: Pattern[str], path: str,
    +                    site: Dict[str, Optional[str]], revision: str) -> str:
         m = re.match(pattern, path)
         if m is None:
             return ''
    @@ -45,7 +52,9 @@ def make_commit_url(pattern, path, site, revision):
     
         account = info.get('account') or info.get('account_')
         repository = info.get('repository_name') or info.get('repository_name_')
    -    return site['commit_template'].format(
    +    commit_template = site['commit_template']
    +    assert commit_template is not None
    +    return commit_template.format(
             site=_site,
             user=account,
             repository=repository,
    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index 83e162e..90546f4 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -9,7 +9,17 @@ from sphinx.util.osutil import copyfile
     
     from .repository import GitRepository
     
    -__version__ = '0.2.2'
    +# type check
    +from typing import Any
    +from typing import Callable
    +from typing import Dict
    +from typing import List
    +from docutils.nodes import Node
    +from git.objects.commit import Commit
    +from sphinx.application import Sphinx
    +
    +
    +__version__ = '0.3.0'
     
     logger = logging.getLogger(__name__)
     
    @@ -20,7 +30,7 @@ CSS_CLASS = {
     }
     
     
    -def get_revision(argument):
    +def get_revision(argument: str) -> str:
         if argument is None:
             raise ValueError('revision string required as argument')
         return argument.strip()
    @@ -34,30 +44,36 @@ OPTION_WITH_REF_URL = 'with_ref_url'
     
     class BaseDirective(Directive):
     
    -    option_spec = {
    +    option_spec: Dict[str, Callable[[str], Any]] = {
             OPTION_INCLUDE_DIFF: directives.flag,
             OPTION_NUMBER_OF_REVISIONS: directives.positive_int,
             OPTION_REVISION: get_revision,
             OPTION_WITH_REF_URL: directives.flag,
         }
     
    -    def _make_message_node(self, message, sha):
    +    def _make_message_node(self, message: str, sha: str) -> nodes.strong:
             message, classes = message, []
             if OPTION_INCLUDE_DIFF in self.options:
                 classes = CSS_CLASS['message']
             return nodes.strong(ids=[sha], text=message, classes=classes)
     
    -    def _make_diff_node(self, diff, sha):
    +    def _make_diff_node(self, diff: str, sha: str) -> nodes.literal_block:
             classes = CSS_CLASS['diff']
             return nodes.literal_block(ids=[sha], text=diff, classes=classes)
     
    -    def run(self):
    +    def get_repo(self, number_of_revisions: int) -> GitRepository:
    +        ...
    +
    +    def get_changelog(self, repo: GitRepository, commit: Commit) -> Node:
    +        ...
    +
    +    def run(self) -> List[Node]:
             list_node = nodes.bullet_list()
     
             number_of_revisions = self.options.get(OPTION_NUMBER_OF_REVISIONS, 10)
             repo = self.get_repo(number_of_revisions)
             if repo is None:
    -            return
    +            return []
     
             revision = self.options.get(OPTION_REVISION)
             for commit in repo.get_commits(revision=revision):
    @@ -68,13 +84,13 @@ class BaseDirective(Directive):
     
     class GitDirective(BaseDirective):
     
    -    def get_repo(self, number_of_revisions):
    +    def get_repo(self, number_of_revisions: int) -> GitRepository:
             env = self.state.document.settings.env
             return GitRepository(
                 number_of_revisions, env.srcdir, search_parent_directories=True,
             )
     
    -    def get_changelog(self, repo, commit):
    +    def get_changelog(self, repo: GitRepository, commit: Commit) -> Node:
             item = nodes.list_item()
             para = nodes.paragraph()
     
    @@ -84,7 +100,7 @@ class GitDirective(BaseDirective):
             para.append(nodes.inline(text=' at '))
     
             commit_date = datetime.fromtimestamp(commit.authored_date)
    -        para.append(nodes.emphasis(text=commit_date))
    +        para.append(nodes.emphasis(text=str(commit_date)))
     
             item.append(para)
     
    @@ -104,14 +120,14 @@ CSS_FILES = ['contrib-vcs.css']
     JS_FILES = ['contrib-vcs.js']
     
     
    -def add_assets(app):
    +def add_assets(app: Sphinx) -> None:
         for file_ in CSS_FILES:
             app.add_css_file(file_)
         for file_ in JS_FILES:
             app.add_js_file(file_)
     
     
    -def copy_assets(app, exception):
    +def copy_assets(app: Sphinx, exception: Exception) -> None:
         if app.builder.name != 'html' or exception:
             return
     
    @@ -129,7 +145,7 @@ def copy_assets(app, exception):
         logger.info('done')
     
     
    -def setup(app):
    +def setup(app: Sphinx) -> Dict[str, Any]:
         app.add_directive('git', GitDirective)
     
         # copying css/js to _static
    
  • fix RemovedInSphinx40Warning by Tetsuya Morimoto at 2020-04-18 14:31:04

    59a42214bbc31aa6380d0bb9e24932fc1fb5ad9d

    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index 98f6517..83e162e 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -106,9 +106,9 @@ JS_FILES = ['contrib-vcs.js']
     
     def add_assets(app):
         for file_ in CSS_FILES:
    -        app.add_stylesheet(file_)
    +        app.add_css_file(file_)
         for file_ in JS_FILES:
    -        app.add_javascript(file_)
    +        app.add_js_file(file_)
     
     
     def copy_assets(app, exception):
    
  • fix a trivial bug related to 2d8c298 by Tetsuya Morimoto at 2020-04-18 14:14:12

    02df478e22d985c1ea7741751c2a06fe5f5b6ff0

    diff --git a/sphinxcontrib/repository/_git.py b/sphinxcontrib/repository/_git.py
    index 863b944..3dbae74 100644
    --- a/sphinxcontrib/repository/_git.py
    +++ b/sphinxcontrib/repository/_git.py
    @@ -69,7 +69,7 @@ class GitRepository(Repo):
             index = self._hexsha[revision]
             target_commit = self._commits[index]
             if target_commit.parents:
    -            if len(self._commits) < index + 1:
    +            if len(self._commits) < index + 2:
                     return ''
                 prev_hexsha = self._commits[index + 1].hexsha
             else:
    
  • fix a trivial bug of if no commits to get diff by Tetsuya Morimoto at 2020-04-18 14:01:04

    2d8c298fccdd84cf0a6a7dba0b037c7734c2ea0d

    diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml
    index 05dbb60..2236eee 100644
    --- a/.github/workflows/pythonpackage.yml
    +++ b/.github/workflows/pythonpackage.yml
    @@ -37,4 +37,4 @@ jobs:
         - name: Test with pytest
           run: |
             pip install pytest
    -        pytest -v sphinxcontrib/ tests/
    +        pytest -s -v sphinxcontrib/ tests/
    diff --git a/sphinxcontrib/repository/_git.py b/sphinxcontrib/repository/_git.py
    index db40916..863b944 100644
    --- a/sphinxcontrib/repository/_git.py
    +++ b/sphinxcontrib/repository/_git.py
    @@ -69,6 +69,8 @@ class GitRepository(Repo):
             index = self._hexsha[revision]
             target_commit = self._commits[index]
             if target_commit.parents:
    +            if len(self._commits) < index + 1:
    +                return ''
                 prev_hexsha = self._commits[index + 1].hexsha
             else:
                 prev_hexsha = self.EMPTY_TREE_SHA
    
  • add workflows for testing by Tetsuya Morimoto at 2020-04-18 13:34:59

    5b068da6cbf043cd72e199b514bea737713b9a67

    diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml
    new file mode 100644
    index 0000000..05dbb60
    --- /dev/null
    +++ b/.github/workflows/pythonpackage.yml
    @@ -0,0 +1,40 @@
    +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
    +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
    +
    +name: Python package
    +
    +on:
    +  push:
    +    branches: [ master ]
    +  pull_request:
    +    branches: [ master ]
    +
    +jobs:
    +  build:
    +
    +    runs-on: ubuntu-latest
    +    strategy:
    +      matrix:
    +        python-version: [3.6, 3.7, 3.8]
    +
    +    steps:
    +    - uses: actions/checkout@v2
    +    - name: Set up Python ${{ matrix.python-version }}
    +      uses: actions/setup-python@v1
    +      with:
    +        python-version: ${{ matrix.python-version }}
    +    - name: Install dependencies
    +      run: |
    +        python -m pip install --upgrade pip
    +        python setup.py develop
    +    - name: Lint with flake8
    +      run: |
    +        pip install flake8
    +        # stop the build if there are Python syntax errors or undefined names
    +        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
    +        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
    +        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
    +    - name: Test with pytest
    +      run: |
    +        pip install pytest
    +        pytest -v sphinxcontrib/ tests/
    diff --git a/README.md b/README.md
    index fd8aad4..7da6901 100644
    --- a/README.md
    +++ b/README.md
    @@ -1,6 +1,6 @@
     # sphinxcontrib-vcs
     
    -[![Build Status](https://travis-ci.org/t2y/sphinxcontrib-vcs.svg?branch=master)](https://travis-ci.org/t2y/sphinxcontrib-vcs/)
    +![](https://github.com/kazamori/github-api-tools/workflows/Python%20package/badge.svg)
     
     *sphinxcontrib-vcs* provides showing commit history in version control system.
     
    
  • remove travis ci settings by Tetsuya Morimoto at 2020-04-18 13:27:29

    2540221fd732fd11d1399d402bf7f6fc13877dbd

    diff --git a/.travis.yml b/.travis.yml
    deleted file mode 100644
    index 743b766..0000000
    --- a/.travis.yml
    +++ /dev/null
    @@ -1,18 +0,0 @@
    -language: python
    -matrix:
    -  include:
    -    - os: linux
    -      sudo: required
    -      python: 3.5
    -      env: TOXENV=py35
    -    - os: linux
    -      sudo: required
    -      python: 3.6
    -      env: TOXENV=py36
    -    - os: linux
    -      sudo: required
    -      python: 3.7
    -      env: TOXENV=py37
    -
    -install: pip install docutils tox
    -script: tox
    
  • replace sphinx-testing with sphinx.testing.fixtures with pytest by Tetsuya Morimoto at 2020-04-18 13:26:27

    9d1b7a2311e754730d898a8061aac2bb829f830d

    diff --git a/setup.cfg b/setup.cfg
    index 27c1577..e18e330 100644
    --- a/setup.cfg
    +++ b/setup.cfg
    @@ -9,3 +9,7 @@ universal = 1
     
     [upload_sphinx]
     upload-dir = docs/_build/html
    +
    +[tool:pytest]
    +markers =
    +    sphinx
    diff --git a/setup.py b/setup.py
    index 1ec0c6c..e476271 100644
    --- a/setup.py
    +++ b/setup.py
    @@ -46,7 +46,14 @@ setup(
             'GitPython',
             'Sphinx',
         ],
    -    tests_require=[
    -        'flake8', 'mock', 'nose', 'reportlab', 'sphinx-testing',
    -    ],
    +    extras_require={
    +        'test': [
    +            'pytest',
    +            'pytest-flake8',
    +        ],
    +        'lint': [
    +            'mypy',
    +            'docutils-stubs',
    +        ],
    +    },
     )
    diff --git a/tests/conftest.py b/tests/conftest.py
    new file mode 100644
    index 0000000..52510e3
    --- /dev/null
    +++ b/tests/conftest.py
    @@ -0,0 +1,26 @@
    +import os.path
    +import pathlib
    +import shutil
    +
    +import pytest
    +from sphinx.testing.path import path
    +
    +pytest_plugins = 'sphinx.testing.fixtures'
    +
    +
    +def copy_dot_git(dst_dir):
    +    path = pathlib.Path(os.path.dirname(__file__))
    +    docs_path = path.joinpath(dst_dir)
    +    if not docs_path.exists():
    +        dot_git_path = path.parent.joinpath('.git')
    +        print(f'copy {dot_git_path} to {docs_path}')
    +        shutil.copytree(dot_git_path, docs_path)
    +
    +
    +copy_dot_git('docs/test-basic/.git')
    +copy_dot_git('docs/test-errors/.git')
    +
    +
    +@pytest.fixture(scope='session')
    +def rootdir():
    +    return path(__file__).parent.abspath() / 'docs'
    diff --git a/tests/docs/test-basic/_static/.gitkeep b/tests/docs/test-basic/_static/.gitkeep
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/docs/basic/conf.py b/tests/docs/test-basic/conf.py
    similarity index 100%
    rename from tests/docs/basic/conf.py
    rename to tests/docs/test-basic/conf.py
    diff --git a/tests/docs/basic/index.rst b/tests/docs/test-basic/index.rst
    similarity index 100%
    rename from tests/docs/basic/index.rst
    rename to tests/docs/test-basic/index.rst
    diff --git a/tests/docs/test-errors/_static/.gitkeep b/tests/docs/test-errors/_static/.gitkeep
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/docs/test-errors/conf.py b/tests/docs/test-errors/conf.py
    new file mode 100644
    index 0000000..c538d5c
    --- /dev/null
    +++ b/tests/docs/test-errors/conf.py
    @@ -0,0 +1,339 @@
    +# -*- coding: utf-8 -*-
    +#
    +# Test documentation build configuration file, created by
    +# sphinx-quickstart on Fri Sep  2 17:47:39 2016.
    +#
    +# This file is execfile()d with the current directory set to its
    +# containing dir.
    +#
    +# Note that not all possible configuration values are present in this
    +# autogenerated file.
    +#
    +# All configuration values have a default; values that are commented out
    +# serve to show the default.
    +
    +# If extensions (or modules to document with autodoc) are in another directory,
    +# add these directories to sys.path here. If the directory is relative to the
    +# documentation root, use os.path.abspath to make it absolute, like shown here.
    +#
    +# import os
    +# import sys
    +# sys.path.insert(0, os.path.abspath('.'))
    +
    +# -- General configuration ------------------------------------------------
    +
    +# If your documentation needs a minimal Sphinx version, state it here.
    +#
    +# needs_sphinx = '1.0'
    +
    +# Add any Sphinx extension module names here, as strings. They can be
    +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
    +# ones.
    +extensions = ['sphinxcontrib.vcs']
    +
    +# Add any paths that contain templates here, relative to this directory.
    +templates_path = ['_templates']
    +
    +# The suffix(es) of source filenames.
    +# You can specify multiple suffix as a list of string:
    +#
    +# source_suffix = ['.rst', '.md']
    +source_suffix = '.rst'
    +
    +# The encoding of source files.
    +#
    +# source_encoding = 'utf-8-sig'
    +
    +# The master toctree document.
    +master_doc = 'index'
    +
    +# General information about the project.
    +project = u'Test'
    +copyright = u'2016, Tetsuya Morimoto'
    +author = u'Tetsuya Morimoto'
    +
    +# The version info for the project you're documenting, acts as replacement for
    +# |version| and |release|, also used in various other places throughout the
    +# built documents.
    +#
    +# The short X.Y version.
    +version = u'0.1'
    +# The full version, including alpha/beta/rc tags.
    +release = u'0.1'
    +
    +# The language for content autogenerated by Sphinx. Refer to documentation
    +# for a list of supported languages.
    +#
    +# This is also used if you do content translation via gettext catalogs.
    +# Usually you set "language" from the command line for these cases.
    +language = 'ja'
    +
    +# There are two options for replacing |today|: either, you set today to some
    +# non-false value, then it is used:
    +#
    +# today = ''
    +#
    +# Else, today_fmt is used as the format for a strftime call.
    +#
    +# today_fmt = '%B %d, %Y'
    +
    +# List of patterns, relative to source directory, that match files and
    +# directories to ignore when looking for source files.
    +# This patterns also effect to html_static_path and html_extra_path
    +exclude_patterns = []
    +
    +# The reST default role (used for this markup: `text`) to use for all
    +# documents.
    +#
    +# default_role = None
    +
    +# If true, '()' will be appended to :func: etc. cross-reference text.
    +#
    +# add_function_parentheses = True
    +
    +# If true, the current module name will be prepended to all description
    +# unit titles (such as .. function::).
    +#
    +# add_module_names = True
    +
    +# If true, sectionauthor and moduleauthor directives will be shown in the
    +# output. They are ignored by default.
    +#
    +# show_authors = False
    +
    +# The name of the Pygments (syntax highlighting) style to use.
    +pygments_style = 'sphinx'
    +
    +# A list of ignored prefixes for module index sorting.
    +# modindex_common_prefix = []
    +
    +# If true, keep warnings as "system message" paragraphs in the built documents.
    +# keep_warnings = False
    +
    +# If true, `todo` and `todoList` produce output, else they produce nothing.
    +todo_include_todos = False
    +
    +
    +# -- Options for HTML output ----------------------------------------------
    +
    +# The theme to use for HTML and HTML Help pages.  See the documentation for
    +# a list of builtin themes.
    +#
    +html_theme = 'alabaster'
    +
    +# Theme options are theme-specific and customize the look and feel of a theme
    +# further.  For a list of options available for each theme, see the
    +# documentation.
    +#
    +# html_theme_options = {}
    +
    +# Add any paths that contain custom themes here, relative to this directory.
    +# html_theme_path = []
    +
    +# The name for this set of Sphinx documents.
    +# "<project> v<release> documentation" by default.
    +#
    +# html_title = u'Test v0.3'
    +
    +# A shorter title for the navigation bar.  Default is the same as html_title.
    +#
    +# html_short_title = None
    +
    +# The name of an image file (relative to this directory) to place at the top
    +# of the sidebar.
    +#
    +# html_logo = None
    +
    +# The name of an image file (relative to this directory) to use as a favicon of
    +# the docs.
    +# This file should be a Windows icon file (.ico) being 16x16 or 32x32
    +# pixels large.
    +#
    +# html_favicon = None
    +
    +# Add any paths that contain custom static files (such as style sheets) here,
    +# relative to this directory. They are copied after the builtin static files,
    +# so a file named "default.css" will overwrite the builtin "default.css".
    +html_static_path = ['_static']
    +
    +# Add any extra paths that contain custom files (such as robots.txt or
    +# .htaccess) here, relative to this directory. These files are copied
    +# directly to the root of the documentation.
    +#
    +# html_extra_path = []
    +
    +# If not None, a 'Last updated on:' timestamp is inserted at every page
    +# bottom, using the given strftime format.
    +# The empty string is equivalent to '%b %d, %Y'.
    +#
    +# html_last_updated_fmt = None
    +
    +# If true, SmartyPants will be used to convert quotes and dashes to
    +# typographically correct entities.
    +#
    +# html_use_smartypants = True
    +
    +# Custom sidebar templates, maps document names to template names.
    +#
    +# html_sidebars = {}
    +
    +# Additional templates that should be rendered to pages, maps page names to
    +# template names.
    +#
    +# html_additional_pages = {}
    +
    +# If false, no module index is generated.
    +#
    +# html_domain_indices = True
    +
    +# If false, no index is generated.
    +#
    +# html_use_index = True
    +
    +# If true, the index is split into individual pages for each letter.
    +#
    +# html_split_index = False
    +
    +# If true, links to the reST sources are added to the pages.
    +#
    +# html_show_sourcelink = True
    +
    +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
    +#
    +# html_show_sphinx = True
    +
    +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
    +#
    +# html_show_copyright = True
    +
    +# If true, an OpenSearch description file will be output, and all pages will
    +# contain a <link> tag referring to it.  The value of this option must be the
    +# base URL from which the finished HTML is served.
    +#
    +# html_use_opensearch = ''
    +
    +# This is the file name suffix for HTML files (e.g. ".xhtml").
    +# html_file_suffix = None
    +
    +# Language to be used for generating the HTML full-text search index.
    +# Sphinx supports the following languages:
    +#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
    +#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
    +#
    +# html_search_language = 'en'
    +
    +# A dictionary with options for the search language support, empty by default.
    +# 'ja' uses this config value.
    +# 'zh' user can custom change `jieba` dictionary path.
    +#
    +# html_search_options = {'type': 'default'}
    +
    +# The name of a javascript file (relative to the configuration directory) that
    +# implements a search results scorer. If empty, the default will be used.
    +#
    +# html_search_scorer = 'scorer.js'
    +
    +# Output file base name for HTML help builder.
    +htmlhelp_basename = 'Testdoc'
    +
    +# -- Options for LaTeX output ---------------------------------------------
    +
    +latex_elements = {
    +     # The paper size ('letterpaper' or 'a4paper').
    +     #
    +     # 'papersize': 'letterpaper',
    +
    +     # The font size ('10pt', '11pt' or '12pt').
    +     #
    +     # 'pointsize': '10pt',
    +
    +     # Additional stuff for the LaTeX preamble.
    +     #
    +     # 'preamble': '',
    +
    +     # Latex figure (float) alignment
    +     #
    +     # 'figure_align': 'htbp',
    +}
    +
    +# Grouping the document tree into LaTeX files. List of tuples
    +# (source start file, target name, title,
    +#  author, documentclass [howto, manual, or own class]).
    +latex_documents = [
    +    (master_doc, 'Test.tex', u'Test Documentation',
    +     u'Tetsuya Morimoto', 'manual'),
    +]
    +
    +# The name of an image file (relative to this directory) to place at the top of
    +# the title page.
    +#
    +# latex_logo = None
    +
    +# For "manual" documents, if this is true, then toplevel headings are parts,
    +# not chapters.
    +#
    +# latex_use_parts = False
    +
    +# If true, show page references after internal links.
    +#
    +# latex_show_pagerefs = False
    +
    +# If true, show URL addresses after external links.
    +#
    +# latex_show_urls = False
    +
    +# Documents to append as an appendix to all manuals.
    +#
    +# latex_appendices = []
    +
    +# It false, will not define \strong, \code, 	itleref, \crossref ... but only
    +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
    +# packages.
    +#
    +# latex_keep_old_macro_names = True
    +
    +# If false, no module index is generated.
    +#
    +# latex_domain_indices = True
    +
    +
    +# -- Options for manual page output ---------------------------------------
    +
    +# One entry per manual page. List of tuples
    +# (source start file, name, description, authors, manual section).
    +man_pages = [
    +    (master_doc, 'test', u'Test Documentation',
    +     [author], 1)
    +]
    +
    +# If true, show URL addresses after external links.
    +#
    +# man_show_urls = False
    +
    +
    +# -- Options for Texinfo output -------------------------------------------
    +
    +# Grouping the document tree into Texinfo files. List of tuples
    +# (source start file, target name, title, author,
    +#  dir menu entry, description, category)
    +texinfo_documents = [
    +    (master_doc, 'Test', u'Test Documentation',
    +     author, 'Test', 'One line description of project.',
    +     'Miscellaneous'),
    +]
    +
    +# Documents to append as an appendix to all manuals.
    +#
    +# texinfo_appendices = []
    +
    +# If false, no module index is generated.
    +#
    +# texinfo_domain_indices = True
    +
    +# How to display URL addresses: 'footnote', 'no', or 'inline'.
    +#
    +# texinfo_show_urls = 'footnote'
    +
    +# If true, do not generate a @detailmenu in the "Top" node's menu.
    +#
    +# texinfo_no_detailmenu = False
    diff --git a/tests/docs/test-errors/index.rst b/tests/docs/test-errors/index.rst
    new file mode 100644
    index 0000000..25c016f
    --- /dev/null
    +++ b/tests/docs/test-errors/index.rst
    @@ -0,0 +1,5 @@
    +Welcome to Error documentation!
    +===============================
    +
    +.. git::
    +    :revision:
    diff --git a/tests/test_basic.py b/tests/test_basic.py
    index 0bba91e..5038180 100644
    --- a/tests/test_basic.py
    +++ b/tests/test_basic.py
    @@ -1,28 +1,26 @@
    -# -*- coding: utf-8 -*-
    +import pytest
     
    -from sphinx_testing import with_app
     
    -
    -@with_app(buildername='html', srcdir='tests/docs/basic/')
    +@pytest.mark.sphinx('html', testroot='basic/')
     def test_build_html(app, status, warning):
         app.builder.build_all()
     
     
    -@with_app(buildername='singlehtml', srcdir='tests/docs/basic/')
    +@pytest.mark.sphinx('html', testroot='basic/')
     def test_build_singlehtml(app, status, warning):
         app.builder.build_all()
     
     
    -@with_app(buildername='latex', srcdir='tests/docs/basic/')
    +@pytest.mark.sphinx(buildername='latex', srcdir='basic/')
     def test_build_latex(app, status, warning):
         app.builder.build_all()
     
     
    -@with_app(buildername='epub', srcdir='tests/docs/basic/')
    +@pytest.mark.sphinx(buildername='epub', srcdir='basic/')
     def test_build_epub(app, status, warning):
         app.builder.build_all()
     
     
    -@with_app(buildername='json', srcdir='tests/docs/basic/')
    +@pytest.mark.sphinx(buildername='json', srcdir='basic/')
     def test_build_json(app, status, warning):
         app.builder.build_all()
    diff --git a/tests/test_errors.py b/tests/test_errors.py
    index f24fa05..b14c09d 100644
    --- a/tests/test_errors.py
    +++ b/tests/test_errors.py
    @@ -1,16 +1,8 @@
    -# -*- coding: utf-8 -*-
    -import unittest
    +import pytest
     
    -from sphinx_testing import with_app
     
    -
    -class TestSphinxcontribVcsErrors(unittest.TestCase):
    -    @with_app(srcdir='tests/docs/basic', write_docstring=True)
    -    def test_no_revision_error(self, app, status, warning):
    -        """
    -        .. git::
    -            :revision:
    -        """
    -        app.builder.build_all()
    -        message = 'revision string required as argument.'
    -        self.assertIn(message, warning.getvalue())
    +@pytest.mark.sphinx('html', testroot='errors/')
    +def test_errors_build_html(app, status, warning):
    +    app.builder.build_all()
    +    message = 'revision string required as argument.'
    +    assert message in warning.getvalue()
    diff --git a/tox.ini b/tox.ini
    index 51a8ca1..5f6535e 100644
    --- a/tox.ini
    +++ b/tox.ini
    @@ -1,18 +1,11 @@
     [tox]
    -envlist = py35, py36, py37
    +envlist = py36, py37, py38
     
     [testenv]
    -passenv =
    -    LANG
    -    LC_ALL
    -; TODO: Sphinx 2.0.x raise No module named 'sphinxcontrib.serializinghtml'
     deps=
    -    nose
    -    mock
    -    flake8
    -    reportlab
    -    sphinx-testing
    -    Sphinx==1.8.5
    +    pytest
    +    pytest-flake8
    +extras=
    +    test
     commands=
    -    nosetests -v
    -    flake8 setup.py sphinxcontrib/ tests/
    +    pytest -v --flake8 sphinxcontrib/ tests/
    
  • update README by Tetsuya Morimoto at 2019-11-06 02:03:05

    0806b703030e8634d97d71c58ed56631f77a8a64

    diff --git a/README.md b/README.md
    index 73e9585..fd8aad4 100644
    --- a/README.md
    +++ b/README.md
    @@ -32,6 +32,10 @@ For more information have a look at [the documentation](https://sphinxcontrib-vc
     
     ## ChangeLog
     
    +### 0.2.2 (2019-11-06)
    +
    +* fix packaging issue: cannot import sphinxcontrib.repository
    +
     ### 0.2.1 (2019-08-04)
     
     * fix wrong Docutils DTD list_item node thanks to amedama41
    
  • fix to be able to import sphinxcontrib.repository by Tetsuya Morimoto at 2019-11-06 01:56:21

    2b2ae4e5f404b3aef281d231203e724abc9a6fa5

    diff --git a/setup.py b/setup.py
    index 9e90796..1ec0c6c 100644
    --- a/setup.py
    +++ b/setup.py
    @@ -1,6 +1,6 @@
     import re
     from os import path
    -from setuptools import setup
    +from setuptools import find_packages, setup
     
     version_py = open('sphinxcontrib/vcs.py').read()
     metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", version_py))
    @@ -39,7 +39,7 @@ setup(
         author_email='tetsuya.morimoto@gmail.com',
         zip_safe=False,
         platforms='any',
    -    packages=['sphinxcontrib'],
    +    packages=find_packages(),
         namespace_packages=['sphinxcontrib'],
         include_package_data=True,
         install_requires=[
    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index d3e7721..98f6517 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -9,7 +9,7 @@ from sphinx.util.osutil import copyfile
     
     from .repository import GitRepository
     
    -__version__ = '0.2.1'
    +__version__ = '0.2.2'
     
     logger = logging.getLogger(__name__)
     
    
  • Merge pull request #3 from t2y/dependabot/pip/urllib3-1.24.2 Bump urllib3 from 1.24.1 to 1.24.2 by Tetsuya Morimoto at 2019-11-06 01:31:35

    8729d58324940263f5774ddf6150cdb649f5768d

    
    
  • Bump urllib3 from 1.24.1 to 1.24.2 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.24.1 to 1.24.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.24.1…1.24.2) Signed-off-by: dependabot[bot] <support@github.com> by dependabot[bot] at 2019-10-21 17:38:12

    5580413dacfa8820d15076f06abf96a112868191

    diff --git a/requirements.txt b/requirements.txt
    index 8c7d5a7..b7cef77 100644
    --- a/requirements.txt
    +++ b/requirements.txt
    @@ -25,4 +25,4 @@ sphinxcontrib-jsmath==1.0.1
     sphinxcontrib-qthelp==1.0.2
     sphinxcontrib-serializinghtml==1.1.3
     sphinxcontrib-vcs==0.2.0
    -urllib3==1.24.1
    +urllib3==1.24.2
    
  • update version 0.2.1 by Tetsuya Morimoto at 2019-08-04 05:52:37

    694004f22607a734ca15f83ff30cbfb6891283d7

    diff --git a/README.md b/README.md
    index 078fada..73e9585 100644
    --- a/README.md
    +++ b/README.md
    @@ -32,6 +32,10 @@ For more information have a look at [the documentation](https://sphinxcontrib-vc
     
     ## ChangeLog
     
    +### 0.2.1 (2019-08-04)
    +
    +* fix wrong Docutils DTD list_item node thanks to amedama41
    +
     ### 0.2.0 (2018-11-17)
     
     * drop Python 2.7 support and mercurial feature
    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index 86d1d67..d3e7721 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -9,7 +9,7 @@ from sphinx.util.osutil import copyfile
     
     from .repository import GitRepository
     
    -__version__ = '0.2.0'
    +__version__ = '0.2.1'
     
     logger = logging.getLogger(__name__)
     
    
  • Merge pull request #2 from amedama41/fix_docutils_tree fix to generate well-formed docutils document tree by Tetsuya Morimoto at 2019-08-04 05:40:46

    33be27e6f95f8470876a66e2365a58e14436ed38

    
    
  • fix to generate well-formed docutils document tree by amedama41 at 2019-08-02 13:27:55

    f15e49111aae736a06ed97ad3c3140eb97e6e75e

    diff --git a/sphinxcontrib/vcs.py b/sphinxcontrib/vcs.py
    index e809400..86d1d67 100644
    --- a/sphinxcontrib/vcs.py
    +++ b/sphinxcontrib/vcs.py
    @@ -76,14 +76,17 @@ class GitDirective(BaseDirective):
     
         def get_changelog(self, repo, commit):
             item = nodes.list_item()
    +        para = nodes.paragraph()
     
    -        item.append(self._make_message_node(commit.message, commit.hexsha))
    -        item.append(nodes.inline(text=' by '))
    -        item.append(nodes.emphasis(text=commit.author.name))
    -        item.append(nodes.inline(text=' at '))
    +        para.append(self._make_message_node(commit.message, commit.hexsha))
    +        para.append(nodes.inline(text=' by '))
    +        para.append(nodes.emphasis(text=commit.author.name))
    +        para.append(nodes.inline(text=' at '))
     
             commit_date = datetime.fromtimestamp(commit.authored_date)
    -        item.append(nodes.emphasis(text=commit_date))
    +        para.append(nodes.emphasis(text=commit_date))
    +
    +        item.append(para)
     
             if OPTION_WITH_REF_URL in self.options:
                 ref_url = repo.get_commit_url(commit.hexsha)
    
  • update tox test environment and drop 3.4 support by Tetsuya Morimoto at 2019-04-13 03:04:30

    d2b208a5576d1012ff0de9ae1b3bb674ea62181f

    diff --git a/.travis.yml b/.travis.yml
    index e39d492..743b766 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -1,10 +1,6 @@
     language: python
     matrix:
       include:
    -    - os: linux
    -      sudo: required
    -      python: 3.4
    -      env: TOXENV=py34
         - os: linux
           sudo: required
           python: 3.5
    @@ -13,6 +9,10 @@ matrix:
           sudo: required
           python: 3.6
           env: TOXENV=py36
    +    - os: linux
    +      sudo: required
    +      python: 3.7
    +      env: TOXENV=py37
     
     install: pip install docutils tox
     script: tox
    diff --git a/setup.py b/setup.py
    index d3527cc..9e90796 100644
    --- a/setup.py
    +++ b/setup.py
    @@ -22,7 +22,6 @@ setup(
             'Intended Audience :: Developers',
             'Operating System :: OS Independent',
             'Programming Language :: Python :: 3',
    -        'Programming Language :: Python :: 3.4',
             'Programming Language :: Python :: 3.5',
             'Programming Language :: Python :: 3.6',
             'Programming Language :: Python :: 3.7',
    diff --git a/tox.ini b/tox.ini
    index 7ed87a0..51a8ca1 100644
    --- a/tox.ini
    +++ b/tox.ini
    @@ -1,16 +1,18 @@
     [tox]
    -envlist = py34, py35, py36, py37
    +envlist = py35, py36, py37
     
     [testenv]
     passenv =
         LANG
         LC_ALL
    +; TODO: Sphinx 2.0.x raise No module named 'sphinxcontrib.serializinghtml'
     deps=
         nose
         mock
         flake8
         reportlab
         sphinx-testing
    +    Sphinx==1.8.5
     commands=
         nosetests -v
         flake8 setup.py sphinxcontrib/ tests/
    

Particular commit log

.. git::
    :revision: 33e6b629ed3d6ed63f64136661642f594b1f4d6f
    :with_ref_url:
    :include_diff:
  • initial commit by Tetsuya Morimoto at 2016-09-02 14:14:28

    33e6b629ed3d6ed63f64136661642f594b1f4d6f

    diff --git a/README.md b/README.md
    new file mode 100644
    index 0000000..b6f2af0
    --- /dev/null
    +++ b/README.md
    @@ -0,0 +1 @@
    +# Sphinxcontrib-vcs