У меня тоже была эта проблема, вот мое решение:
;; vc-mode
(defconst vc-hg-annotate-better-re
"^[ ]*\\(.+?\\) \\([0-9]+\\) \\([0-9a-f]+\\) \\(.+?\\+[0-9]+\\) +\\(.+?\\):\\([0-9]+\\):\\(.*\n?\\)")
(defconst vc-hg-annotate-result-re
"^[\t ]*\\([0-9]+\\) +\\(.+?\\) .*")
(eval-after-load "vc-hg"
'(defun vc-hg-annotate-command (file buffer &optional revision)
"Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
Optional arg REVISION is a revision to annotate from."
(vc-hg-command buffer 'async file "annotate" "-d" "-n" "-u" "-c" "-l" "--follow"
(when revision (concat "-r" revision)))
(lexical-let ((table (make-hash-table :test 'equal)))
(set-process-filter
(get-buffer-process buffer)
(lambda (proc string)
(when (process-buffer proc)
(with-current-buffer (process-buffer proc)
(setq string (concat (process-get proc :vc-left-over) string))
(while (string-match vc-hg-annotate-better-re string)
(let* ((author (match-string 1 string))
(rev (match-string 2 string))
(changeset (match-string 3 string))
(date (match-string 4 string))
(key (concat rev author date))
(file (match-string 5 string))
(lineno (match-string 6 string))
(content (match-string 7 string))
(tag (gethash key table))
(inhibit-read-only t))
(setq string (substring string (match-end 0)))
(unless tag
(setq tag
(propertize
(format "%-5s %-8.8s" rev author)
'help-echo (format "Revision: %d, author: %s, date: %s"
(string-to-number rev)
author date)
'mouse-face 'highlight))
(puthash key tag table))
(goto-char (process-mark proc))
(insert tag content)
(move-marker (process-mark proc) (point))))
(process-put proc :vc-left-over string))))))))
(eval-after-load "vc-hg"
'(defun vc-hg-annotate-time ()
(save-excursion
(beginning-of-line)
(when (looking-at vc-hg-annotate-result-re)
(let ((prop (get-text-property (line-beginning-position) 'help-echo)))
(string-match ", date: \\(.+\\)\\'" prop)
(let ((str (match-string-no-properties 1 prop)))
(vc-annotate-convert-time (date-to-time str))))))))
(eval-after-load "vc-hg"
'(defun vc-hg-annotate-extract-revision-at-line ()
(save-excursion
(beginning-of-line)
(when (looking-at vc-hg-annotate-result-re)
(match-string-no-properties 1)))))
Добавьте это в файл инициализации, и вы получите форматированный формат, аналогичный bzr annotate:
266 jimb@re | /* Window creation, deletion and examination for GNU Emacs.
266 jimb@re | Does not include redisplay.
102971 rgm@gnu | Copyright (C) 1985-1987, 1993-1998, 2000-2011
77438.1.2234 rgm@gnu | Free Software Foundation, Inc.
266 jimb@re |
266 jimb@re | This file is part of GNU Emacs.
К сожалению, фильтрация вывода аннотирования, подобного этой, замедляет аннотирование больших файлов, пока я не нашел способа обойти это (аннотирование файлов в bzr также медленное).