Skip to contentSkip to conversation

vc-git.el: Switch to using git-blame instead of git-annotate.

PATCH In review Alexandre Julliard 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vc-git.el: Switch to using git-blame instead of git-annotate.

---
 contrib/emacs/vc-git.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
contrib/emacs/vc-git.el +2 -2
index 4a8f790..4189c4c 100644
@@ -119,10 +119,10 @@ (defun vc-git-checkout (file &optional e
 (defun vc-git-annotate-command (file buf &optional rev)
   ; FIXME: rev is ignored
   (let ((name (file-relative-name file)))
-    (call-process "git" nil buf nil "annotate" name)))
+    (call-process "git" nil buf nil "blame" name)))
 
 (defun vc-git-annotate-time ()
-  (and (re-search-forward "[0-9a-f]+\t(.*\t\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\)\t[0-9]+)" nil t)
+  (and (re-search-forward "[0-9a-f]+ (.* \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\) +[0-9]+)" nil t)
        (vc-annotate-convert-time
         (apply #'encode-time (mapcar (lambda (match) (string-to-number (match-string match))) '(6 5 4 3 2 1 7))))))
 
Signature · 5 lines
1.4.2.3.g1723

-- 
Alexandre Julliard
[email protected]
#1 lore raw
Quoted 10 lines · Alexandre Julliard
---
 contrib/emacs/vc-git.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
contrib/emacs/vc-git.el +0 -0
index 4a8f790..4189c4c 100644

contrib/emacs/vc-git.el (defun vc-git-checkout (file &optional e · line 122

Quoted 5 lines
contrib/emacs/vc-git.el +1 -1
@@ -119,10 +119,10 @@ (defun vc-git-checkout (file &optional e
 (defun vc-git-annotate-command (file buf &optional rev)
   ; FIXME: rev is ignored
   (let ((name (file-relative-name file)))
-    (call-process "git" nil buf nil "annotate" name)))
+    (call-process "git" nil buf nil "blame" name)))

"blame -c" is advertised to give the same format as "annotate", so I think you would not need other hunk if you did.

contrib/emacs/vc-git.el (defun vc-git-checkout (file &optional e · line 127

Quoted 5 lines
contrib/emacs/vc-git.el +1 -1
 (defun vc-git-annotate-time ()
-  (and (re-search-forward "[0-9a-f]+\t(.*\t\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\)\t[0-9]+)" nil t)
+  (and (re-search-forward "[0-9a-f]+ (.* \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\) +[0-9]+)" nil t)
        (vc-annotate-convert-time
         (apply #'encode-time (mapcar (lambda (match) (string-to-number (match-string match))) '(6 5 4 3 2 1 7))))))

Not that I am preferring the annotate output format over blame's native output format. I just wanted to know if the reason you did not do -c was because you tried and "blame -c" was not compatible as advertised (in which case we have one more thing to fix).

#2 lore raw
Quoted 5 lines · Junio C Hamano

Not that I am preferring the annotate output format over blame's native output format. I just wanted to know if the reason you did not do -c was because you tried and "blame -c" was not compatible as advertised (in which case we have one more thing to fix).

As far as I can tell, "blame -c" works fine. I switched because I find the default blame output nicer, it wastes less horizontal space and the file contents are properly aligned.

Signature · 2 lines
Alexandre Julliard
[email protected]