Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OO refactoring and git-blame preloading #12

Merged
merged 28 commits into from
Mar 4, 2020

Commits on Mar 1, 2020

  1. Remove GitPython dependency

    Create a Git repository abstraction with just what we need.
    
    This will be continued with a Book class holding/storing the info
    about the whole book, its size and its authors.
    uliska committed Mar 1, 2020
    Configuration menu
    Copy the full SHA
    b41e299 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2020

  1. Object oriented refactoring

    Have dedicated objects:
    - Repo
    - Author
    - Page
    - Commit
    handle all the data and responsibilities.
    uliska committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    f90ef72 View commit details
    Browse the repository at this point in the history
  2. Preload git blame data

    This commit creates the Page objects within the on_files
    MkDocs event.
    
    As a result the lines/contribution statistics for the whole book
    are now available from within *every* Markdown page.
    uliska committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    558dfc3 View commit details
    Browse the repository at this point in the history
  3. Merge remote-tracking branch 'origin/master' into preload-blame

    # Conflicts:
    #	mkdocs_git_authors_plugin/plugin.py
    #	mkdocs_git_authors_plugin/util.py
    uliska committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    7dbec73 View commit details
    Browse the repository at this point in the history
  4. Handle uncommitted changes

    The 00000 "commit" shown by git blame for uncommitted lines
    caused the plugin to crash when trying to execute "git show" on it.
    Therefore uncommitted stuff is attributed to a fake author whose
    display characteristics are configurable.
    uliska committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    f37c9f8 View commit details
    Browse the repository at this point in the history
  5. Document uncommitted_changes

    uliska committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    98bffc3 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. Add {{ git_authors_list }} (book-level summary)

    Inserting {{ git_authors_list }} in any Markdown file
    will insert a list of all authors along with their contribution
    to the whole site.
    
    Adds configuration options:
    - show_lines (default: false)
      also show the line count in the list
      (but not on a page's summary)
    - label_lines (for localization)
    
    TODO: Provide *real* configurability of the resulting HTML
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    2739240 View commit details
    Browse the repository at this point in the history
  2. Make sort order configurable

    Adds configuration options
    - sort_by (choice: 'name', 'contribution')
    - sort_reverse (bool, default: False)
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    0869525 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bc2fa53 View commit details
    Browse the repository at this point in the history
  4. Add option count_empty_lines

    There may be users not interested in counting empty lines
    as content.
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    ca06d20 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bac88c0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    251adc3 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0da9409 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e5c54ed View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bbba457 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    7b178dc View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    270cc1f View commit details
    Browse the repository at this point in the history
  12. Use repo argument directly in Commit.__init__

    We don't have to go through the member accessor function
    when we have the repo reference as a function argument.
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    7f1726c View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    422653b View commit details
    Browse the repository at this point in the history
  14. Remove Commit.sha()

    This method is only used once and can easily be avoided by
    directly passing the sha argument to Commit._populate.
    
    Incidentally: Move the handling of uncommitted lines
    *into* Commit._populate
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    acd4506 View commit details
    Browse the repository at this point in the history
  15. Factor out commit_datetime function

    This is not related to the actual object but a simple conversion
    function and therefore an optimal candidate for a generic "util" module
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    71eeae2 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    d5f6159 View commit details
    Browse the repository at this point in the history
  17. Rename Repo.commit() to Repo.get_commit()

    The previous name raised concerns about users being worried
    "commit" might be used as a verb (i.e. creating commits in the
    actual repository).
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    709b0e0 View commit details
    Browse the repository at this point in the history
  18. Remove localization config variables

    The configuration variables intended for localization have to
    be removed because the functionality will at one point be
    handled by localization. See timvink#14
    uliska committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    e6c6a8b View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2020

  1. Wrap authors list in a <span>

    This is necessary to get a hold on the whole element
    through CSS, for example to make it invisible (in certain
    contexts).
    uliska committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    65d1779 View commit details
    Browse the repository at this point in the history
  2. Clarify event order in on_files

    It should be clear to any future contributor that when the
    on_page event stage is reached all pages have already been
    parsed and the repo-wide statistics are available.
    uliska committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    4a208dc View commit details
    Browse the repository at this point in the history
  3. Format repo_authors list in util

    This is to separate concerns: Move the formatting of the
    list of authors to the repo not in the Git classes but separately.
    uliska committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    ba91edd View commit details
    Browse the repository at this point in the history
  4. Use --porcelain version of git blame

    Closes timvink#20
    
    While parsing the --porcelain output of git blame is more complicated
    than that of git blame -lts
    
    * it should be considered more robust
    * it provides substantially more information:
      - we can get all information about the commits that we need
      - this makes it obsolete to call `git show` on the commits
    
    The format of the commit timestamp is different in this command,
    therfore this had to modify the datetime processing functions,
    which were moved to util.py at the same time.
    uliska committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    6f5822c View commit details
    Browse the repository at this point in the history