Home

Awesome

gitk-class-diagram

Extends gitk to show a class diagram based on all files that were modified in a given commit, highlighting any changes.

javagitk showing some Java classes from mockito

cC may not have classes, but putting together structs, enums, and functions per file can still make a useful diagram (htop)

pythonPython: comparing two minor releases of flake8

Usage

Interaction

Visual aspects

Language support

How well a language works depends on its support in universal-ctags. See:

ctags --list-languages
ctags --list-kinds-full=<language>

List of what is recognized in popular languages:

How to get more associations between classes

Put a file like classref.ctags in $HOME/.ctags.d/ to produce associations based on regular expressions. The example file will instruct ctags to record any words in Java source code starting with an upper-case letter (and containing lower-case letters). These words will automatically be interpreted as references to other classes. This works pretty well with some languages. Of course, it's not as reliable as a parser that understands the language. It's also slower.

How to add your own language

Use ctags' optlib and create the tag kinds class, field and function.

Installation

pip install gitk-class-diagram

Your existing gitk binary remains as it is. Start the extended version with:

gitk-cl

Dependencies

If you are on Windows, make sure that graphviz, python and ctags are in your PATH.

Configuration

Open gitk's preferences dialog. At the bottom there is an input field which accepts python code. Copy any settings from config.py in there and change the values.

Unfortunately, due to gitk's saving mechanism, the configuration is lost every time you start the original gitk without the extension.