Giter Club home page Giter Club logo

diff-annotate's Introduction

diff-annotate

Generates a HTML file from a diff file and some annotations.

Example

We'll take two files as an example: filea and fileb.

$ diff -u filea fileb
--- filea       2014-12-30 18:39:18.682725526 +0100
+++ fileb       2014-12-30 18:39:30.212509006 +0100
@@ -1,5 +1,4 @@
 foo
 bar
-some line to remove
-this one too
+this is a new line
 baz

You can start editing annotations with something like that (with a bash compatible shell):

$ diff-annotate <(diff -u filea fileb) review.html

A wild editor appears! Add something like > Oh noes, you **should not** remove this line below the line -some line to remove.

Once saved, you can then see the result in your favorite browser:

$ firefox review.html

image

You can edit annotations by reexecuting the same command (annotations are stored in the output file)

$ diff-annotate <(diff -u filea fileb) review.html

Of course, this is not limited to the 'diff' command. diff-annotate should handle any unified diff you give as first argument. For example, you can pass a plain diff file:

$ diff-annotate my_diff.diff review.html

Or a git diff command:

$ diff-annotate <(git diff -w HEAD^) review.html

Or even a git commit with a message:

$ diff-annotate <(git show HEAD) review.html

Annotations syntax

All annotation lines should start with a 'greater than' character.

Comments are formated with reStructuredText. Example:

> This is a title
> ===============
>
> * list item, *this is important*
> * other item, **this is more important**
>
> `This <https://github.com>`_ is a link to github.

Annotations should always be either:

  • below a diff source line
  • or at the very beginning of the diff file

Elsewhere, annotations won't be saved.

Installation

With pip and python 3:

$ pip install https://github.com/BenoitZugmeyer/diff-annotate/archive/master.zip

Editor

The editor spawned is your default editor. You can change it to anything you like by setting the EDITOR environment variable in your .bashrc (or whatever works for you). For example, to use sublime text:

$ echo 'export EDITOR="subl -w"' >> ~/.bashrc

diff-annotate's People

Contributors

benoitzugmeyer avatar veselov avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

veselov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.