Skip to content

CodeReview is a Git GUI tool to perform code review (Diff Viewer) written in Python3 and Qt5.

Notifications You must be signed in to change notification settings

FabriceSalvaire/CodeReview

Repository files navigation

CodeReview

CodeReview license CodeReview python version

CodeReview last version

CodeReview Home Page is located at http://fabricesalvaire.github.io/CodeReview

https://raw.github.com/FabriceSalvaire/CodeReview/master/doc/sphinx/source/images/code-review-log.png

https://raw.github.com/FabriceSalvaire/CodeReview/master/doc/sphinx/source/images/code-review-diff.png

Credits

Authors: Fabrice Salvaire

News

V1.1 2022-25-10

  • Updated install process

V1 2017-12-20

  • Redesigned INotify support

Introduction

I code using the venerable Emacs editor and the extension Magit which is a powerfull text-based user interface to Git. Despite, I am happy with Magit for most tasks, I dislike the diff view rendering in Emacs.

Thus the goal of CodeReview is to provide a more convenient tool for code review tasks on local Git repositories. Unlike software like Gerrit, CodeReview is not designed to do team-level code review, but to check the stage before a commit and show the difference between two versions. In particular, CodeReview fills the gap with IDEs that don't provide a nice side-by-side diff view.

Historically, I wrote this tool as a replacement of qbzr for Git.

How to use CodeReview ?

CodeReview provides two applications pyqgit and diff-viewer.

Disclaimer

This tool was written 10 years ago (late 2011) and I am using it for my own needs, thus it works as is.

I tried to implement a file watching feature but it is a nightmare to debug.

The Qt code is now a bit out dated, but the actual diff viewer implementation would require some works to be ported to QML.

Features

The main features of CodeReview are:

  • display and browse the log and paches of a Git repository
  • diff side by side using Patience algorithm
  • watch for file system changes

Diff viewer features:

  • stage/unstage file
  • number of context lines
  • font size
  • line number mode
  • align mode
  • complete mode
  • highlight mode

Installation

CodeReview is written in Python and uses the GUI framework PyQt5 and the Git library pygit2. Thus, CodeReview is operating system agnostic and should work on Linux, Windows and OSX.

To install CodeReview from source code, you need a working Python environment and a C compiler.

On Linux

To summarise, you can easily install CodeReview on Linux with just pip install CodeReview but read the followings.

First you need to verify that Python is installed on your distribution.

If you install CodeReview from source, you will also need the GCC C compiler.

You can create a Python virtual environment to install CodeReview in its own container:

# create the venv
python3.10 -m venv $HOME/codereview
# enter in the venv
source $HOME/codereview/bin/activate

This is not mandatory, but it is a good practice if you don't know exactly what you are doing. Especially, if you don't want to spoil your distribution.

Notice, you can later create a shell script to wrap the venv activation and the pyqgit command.

Then install CodeReview either from PyPI (official Python package repository) or from source:

# source .tar.gz or wheel/binary from PyPI (can require a GCC C compiler)
pip install CodeReview

# from Git repository (require a GCC C compiler)
pip install git+https://github.com/FabriceSalvaire/CodeReview

If the pip command is not available, you must install the corresponding package of your distribution.

Finally, run CodeReview to verify that the installation was successful:

pyqgit --help
diff-viewer --help

pyqgit git_repository_path
diff-viewer a.txt b.txt

cd git_repository_path
pyqgit

Example of shell wrapper:

#! /usr/bin/bash
PY_ENV=${HOME}/codereview
source ${PY_ENV}/bin/activate
CodeReviewLogLevel='WARNING' ${PY_ENV}/bin/pyqgit $1 &

You can also clone the repository and install it using theses commands:

git clone git@github.com:FabriceSalvaire/CodeReview.git
python setup.py build
python setup.py install

On Windows

Actually there is no installer available, but it is welcome.

You must follow the same procedure that for Linux. However it is a bit more difficult to achieve.

A suggestion is to install the Anaconda Python Distribution and got a working compiler.

On OSX

An up to date installation procedure is welcome.

Dependencies

CodeReview requires the dependencies listed in requirements.txt

How to help

  • test it on Windows and OSX
  • fix bugs: look at issues
  • sometime pyqgit is slow: profile code to find issues

About

CodeReview is a Git GUI tool to perform code review (Diff Viewer) written in Python3 and Qt5.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published