Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benoitzugmeyer/diff-annotate
Generate a HTML file from a diff file and some annotations.
https://github.com/benoitzugmeyer/diff-annotate
Last synced: 13 days ago
JSON representation
Generate a HTML file from a diff file and some annotations.
- Host: GitHub
- URL: https://github.com/benoitzugmeyer/diff-annotate
- Owner: BenoitZugmeyer
- Created: 2014-12-30T17:51:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-10T11:20:35.000Z (almost 9 years ago)
- Last Synced: 2024-11-14T02:07:32.325Z (2 months ago)
- Language: Python
- Size: 35.2 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
=============
diff-annotate
=============Generates a HTML file from a diff file and some annotations.
Example
=======We'll take two files as an example: :code:`filea` and :code:`fileb`.
.. code:: bash
$ 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
bazYou can start editing annotations with something like that (with a bash
compatible shell):.. code:: bash
$ diff-annotate <(diff -u filea fileb) review.html
A wild editor_ appears! Add something like :code:`> Oh noes, you **should not**
remove this line` below the line :code:`-some line to remove`.Once saved, you can then see the result in your favorite browser:
.. code:: bash
$ firefox review.html
.. image:: example.png
You can edit annotations by reexecuting the same command (annotations are
stored in the output file).. code:: bash
$ 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:.. code:: bash
$ diff-annotate my_diff.diff review.html
Or a :code:`git diff` command:
.. code:: bash
$ diff-annotate <(git diff -w HEAD^) review.html
Or even a git commit with a message:
.. code:: bash
$ 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:
.. code::
> This is a title
> ===============
>
> * list item, *this is important*
> * other item, **this is more important**
>
> `This `_ 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
.. _reStructuredText: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
Editor
======The editor spawned is your default editor. You can change it to anything you
like by setting the :code:`EDITOR` environment variable in your :code:`.bashrc`
(or whatever works for you). For example, to use sublime text::$ echo 'export EDITOR="subl -w"' >> ~/.bashrc