1
-;;; git-blame.el
2
-;; David Kågedal <davidk@lysator.liu.se>
1
+;;; git-blame.el --- Minor mode for incremental blame for Git -*- coding: utf-8 -*-
2
+;;
3
+;; Copyright (C) 2007 David Kågedal
4
+;;
5
+;; Authors: David Kågedal <davidk@lysator.liu.se>
6
+;; Created: 31 Jan 2007
7
;; Message-ID: <87iren2vqx.fsf@morpheus.local>
8
+;; License: GPL
9
+;; Keywords: git, version control, release management
10
+;;
11
+;; Compatibility: Emacs21
12
+
13
+
14
+;; This file is *NOT* part of GNU Emacs.
15
+;; This file is distributed under the same terms as GNU Emacs.
16
+
17
+;; This program is free software; you can redistribute it and/or
18
+;; modify it under the terms of the GNU General Public License as
19
+;; published by the Free Software Foundation; either version 2 of
20
+;; the License, or (at your option) any later version.
21
+
22
+;; This program is distributed in the hope that it will be
23
+;; useful, but WITHOUT ANY WARRANTY; without even the implied
24
+;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
25
+;; PURPOSE. See the GNU General Public License for more details.
26
+
27
+;; You should have received a copy of the GNU General Public
28
+;; License along with this program; if not, write to the Free
29
+;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30
+;; MA 02111-1307 USA
31
+
32
+;; http://www.fsf.org/copyleft/gpl.html
33
+
34
+
35
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
36
+;;
37
+;;; Commentary:
38
+;;
39
+;; Here is an Emacs implementation of incremental git-blame. When you
40
+;; turn it on while viewing a file, the editor buffer will be updated by
41
+;; setting the background of individual lines to a color that reflects
42
+;; which commit it comes from. And when you move around the buffer, a
43
+;; one-line summary will be shown in the echo area.
44
+
45
+;;; Installation:
46
+;;
47
+;; 1) Load into emacs: M-x load-file RET git-blame.el RET
48
+;; 2) Open a git-controlled file
49
+;; 3) Blame: M-x git-blame-mode
50
+
51
+;;; Compatibility:
52
+;;
53
+;; It requires GNU Emacs 21. If you'are using Emacs 20, try
54
+;; changing this:
55
+;;
56
+;; (overlay-put ovl 'face (list :background
57
+;; (cdr (assq 'color (cddddr info)))))
58
+;;
59
+;; to
60
+;;
61
+;; (overlay-put ovl 'face (cons 'background-color
62
+;; (cdr (assq 'color (cddddr info)))))
63
+
64
+
65
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
66
+;;
67
+;;; Code:
68
+
69
+(require 'cl) ; to use `push', `pop'
70
5
-(require 'cl)
71
(defun color-scale (l)
72
(let* ((colors ())
73
r g b)
243
(shell-command
244
(format "git log -1 --pretty=oneline %s" (or hash
245
(git-blame-current-commit)))))
246
+
247
+(provide 'git-blame)
248
+
249
+;;; git-blame.el ends here