comparison lisp/vc-hg.el @ 80585:8c0cc53e8234

(vc-hg-annotate-re): Recognize the output of --follow.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 18 May 2008 07:22:25 +0000
parents 7c7ae81f80df
children a55ebc729fea
comparison
equal deleted inserted replaced
80584:770802ff7ac3 80585:8c0cc53e8234
316 316
317 317
318 ;; The format for one line output by "hg annotate -d -n" looks like this: 318 ;; The format for one line output by "hg annotate -d -n" looks like this:
319 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS 319 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS
320 ;; i.e: VERSION_NUMBER DATE: CONTENTS 320 ;; i.e: VERSION_NUMBER DATE: CONTENTS
321 (defconst vc-hg-annotate-re "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\): ") 321 ;; If the user has set the "--follow" option, the output looks like:
322 ;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS
323 ;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS
324 (defconst vc-hg-annotate-re
325 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)[^:\n]*\\(:[^ \n][^:\n]*\\)*: ")
322 326
323 (defun vc-hg-annotate-time () 327 (defun vc-hg-annotate-time ()
324 (when (looking-at vc-hg-annotate-re) 328 (when (looking-at vc-hg-annotate-re)
325 (goto-char (match-end 0)) 329 (goto-char (match-end 0))
326 (vc-annotate-convert-time 330 (vc-annotate-convert-time
327 (date-to-time (match-string-no-properties 2))))) 331 (date-to-time (match-string-no-properties 2)))))
328 332
329 (defun vc-hg-annotate-extract-revision-at-line () 333 (defun vc-hg-annotate-extract-revision-at-line ()
330 (save-excursion 334 (save-excursion
331 (beginning-of-line) 335 (beginning-of-line)
332 (if (looking-at vc-hg-annotate-re) (match-string-no-properties 1)))) 336 (when (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
333 337
334 (defun vc-hg-previous-version (file rev) 338 (defun vc-hg-previous-version (file rev)
335 (let ((newrev (1- (string-to-number rev)))) 339 (let ((newrev (1- (string-to-number rev))))
336 (when (>= newrev 0) 340 (when (>= newrev 0)
337 (number-to-string newrev)))) 341 (number-to-string newrev))))