A Python tool for generating HTML reports for git repositories.
Thanks to reports generated by GITAG we can inspect which parts of our application were changed and to what degree. For example, it can provide great insights about the impact of changes made between versions during regression tests.
- First GITAG loads config file provided as an argument (explained below) and diffs two branches from git repository (using git diff under the hood)
- Then, in all new or changed files, it looks for lines that match the pattern defined by regex attribute. When found it strips the line from prefix defined by start and postfix defined by end attribute. Any characters defined in ignore array are omitted. Since one file can be used in many modules we can define multiple tags for one file and divider attribute defines a separator.
- Finally the HTML report is generated in GIT_PROJECT_PATH/gitag/report.
python gitag.py [GIT_PROJECT_PATH] [branch_without_changes] [branch_with_changes] [config_file]
example1: python gitag.py GIT_PROJECT_PATH master rc config.json
In order to configure GITAG we need to provide JSON config file in the following format:
{
"languages": [
{
"extension": "java",
"regex": "@Tag\\(([^\\)]+)\\)",
"divider": ",",
"start": "@Tag(",
"end": ")",
"ignore": [
"{",
"}"
]
}
]
}
Next, we need to tag files in your project with a TAG defined in config. In the example above we configured GITAG to work with java files define by the extension attribute. In order to tag a file we need to define custom annotation, for example:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Tag {
TagType[] value();
}
Finally we need to have tagged files in our project, like this one:
@Tag({TagType.VIEW, TagType.FUNCTIONALITY})
public class Foo {
...
}