summaryrefslogtreecommitdiff
path: root/lisp/vc-hg.el
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2009-10-19 05:04:22 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2009-10-19 05:04:22 +0000
commitd1e4c4037e88f3256db19813805d03f8ad0291fa (patch)
tree3acda1ed317ab3c77efdaae923779288b6ba2bc2 /lisp/vc-hg.el
parentd7306fe6b15ccdc49a066c05e5e86df8e005e859 (diff)
downloademacs-d1e4c4037e88f3256db19813805d03f8ad0291fa.tar.gz
Make vc-annotate work through copies and renames.
* vc-annotate.el (vc-annotate-extract-revision-at-line): Return the file name too. (vc-annotate-revision-at-line) (vc-annotate-find-revision-at-line) (vc-annotate-revision-previous-to-line) (vc-annotate-show-log-revision-at-line): Update to get the file name from vc-annotate-extract-revision-at-line. (vc-annotate-show-diff-revision-at-line-internal): Change the argument to mean whether to show a file diff or not. Get the file name from vc-annotate-extract-revision-at-line. (vc-annotate-show-diff-revision-at-line): Update vc-annotate-show-diff-revision-at-line call. (vc-annotate-warp-revision): Add an optional file argument. * vc-git.el (vc-git-annotate-command): Pass -C -C to the blame command. (vc-git-annotate-extract-revision-at-line): Also return the file name if found. * vc-hg.el (vc-hg-annotate-command): Pass --follow to the annotate command. Remove unused code. (vc-hg-annotate-re): Update to match --follow output. (vc-hg-annotate-extract-revision-at-line): Also return the file name if found. * vc.el: Update annotate-extract-revision-at-line documentation.
Diffstat (limited to 'lisp/vc-hg.el')
-rw-r--r--lisp/vc-hg.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 1dedff159ed..8443257efa2 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -313,12 +313,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(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 0 file "annotate" "-d" "-n"
- (when revision (concat "-r" revision)))
- (with-current-buffer buffer
- (goto-char (point-min))
- (re-search-forward "^[ \t]*[0-9]")
- (delete-region (point-min) (match-beginning 0))))
+ (vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow"
+ (when revision (concat "-r" revision))))
(declare-function vc-annotate-convert-time "vc-annotate" (time))
@@ -329,7 +325,7 @@ Optional arg REVISION is a revision to annotate from."
;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS
;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS
(defconst vc-hg-annotate-re
- "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)[^:\n]*\\(:[^ \n][^:\n]*\\)*: ")
+ "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)\\(?:\\(: \\)\\|\\(?: +\\(.+\\): \\)\\)")
(defun vc-hg-annotate-time ()
(when (looking-at vc-hg-annotate-re)
@@ -340,7 +336,11 @@ Optional arg REVISION is a revision to annotate from."
(defun vc-hg-annotate-extract-revision-at-line ()
(save-excursion
(beginning-of-line)
- (when (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
+ (when (looking-at vc-hg-annotate-re)
+ (if (match-beginning 3)
+ (match-string-no-properties 1)
+ (cons (match-string-no-properties 1)
+ (expand-file-name (match-string-no-properties 4)))))))
(defun vc-hg-previous-revision (file rev)
(let ((newrev (1- (string-to-number rev))))