vc-svn.el で --use-merge-history を使う

Emacs で vc.el (vc-svn.el) を利用して Subversion を利用する際に、デフォルトではマージ情報を表示してくれないので少々改造してみました。以下のコマンドに効果があります。

  • vc-print-log (C-x v l)
  • vc-annotate (C-x v g)
(defadvice vc-svn-command
  (before vc-svn-command--use-merge-history first
          (buffer okstatus file-or-list &rest flags))
  "vc-svn-command with --use-merge-history"
  (if (and (consp flags)
           (stringp (car flags))
           (member (car flags) '("log" "blame" "annotate")))
      (setq flags (cons "-g" flags))))

(defvar vc-svn-annotate-re--use-merge-history
  "G?[ \t]*\\([0-9]+\\)[ \t]+[^\t ]+ "
  "vc-svn-annotate-re with --use-merge-history")

(defadvice vc-svn-annotate-time
  (around vc-svn-annotate-time--use-merge-history)
  "vc-svn-annotate-time with --use-merge-history"
  (let ((vc-svn-annotate-re vc-svn-annotate-re--use-merge-history))
    ad-do-it))

(defadvice vc-svn-annotate-extract-revision-at-line
  (around vc-svn-annotate-extract-revision-at-line--use-merge-history)
  "vc-svn-annotate-extract-revision-at-line with --use-merge-history"
  (let ((vc-svn-annotate-re vc-svn-annotate-re--use-merge-history))
    ad-do-it))