comparison lisp/vc-bzr.el @ 93039:e48df1ee4371

Revert unintended change.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 17 Mar 2008 21:58:19 +0000
parents 5f4eb3149e6d
children 01d3fd1a2cfe
comparison
equal deleted inserted replaced
93038:a2c4bffe2b59 93039:e48df1ee4371
462 (defun vc-bzr-annotate-command (file buffer &optional revision) 462 (defun vc-bzr-annotate-command (file buffer &optional revision)
463 "Prepare BUFFER for `vc-annotate' on FILE. 463 "Prepare BUFFER for `vc-annotate' on FILE.
464 Each line is tagged with the revision number, which has a `help-echo' 464 Each line is tagged with the revision number, which has a `help-echo'
465 property containing author and date information." 465 property containing author and date information."
466 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" 466 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all"
467 (when revision (list "-r" revision)))) 467 (if revision (list "-r" revision)))
468 (with-current-buffer buffer
469 ;; Store the tags for the annotated source lines in a hash table
470 ;; to allow saving space by sharing the text properties.
471 (setq vc-bzr-annotation-table (make-hash-table :test 'equal))
472 (goto-char (point-min))
473 (while (re-search-forward "^\\( *[0-9]+\\) +\\(.+\\) +\\([0-9]\\{8\\}\\) |"
474 nil t)
475 (let* ((rev (match-string 1))
476 (author (match-string 2))
477 (date (match-string 3))
478 (key (match-string 0))
479 (tag (gethash key vc-bzr-annotation-table)))
480 (unless tag
481 (setq tag (propertize rev 'help-echo (concat "Author: " author
482 ", date: " date)
483 'mouse-face 'highlight))
484 (puthash key tag vc-bzr-annotation-table))
485 (replace-match "")
486 (insert tag " |")))))
468 487
469 (defun vc-bzr-annotate-time () 488 (defun vc-bzr-annotate-time ()
470 (when (re-search-forward "^[0-9]+.* \\([0-9]+ | \\)" nil t) 489 (when (re-search-forward "^ *[0-9]+ |" nil t)
471 (goto-char (match-end 1)) 490 (let ((prop (get-text-property (line-beginning-position) 'help-echo)))
472 (let ((str (buffer-substring-no-properties 491 (string-match "[0-9]+\\'" prop)
473 (match-beginning 1) (match-end 1))))
474 (vc-annotate-convert-time 492 (vc-annotate-convert-time
475 (encode-time 0 0 0 493 (encode-time 0 0 0
476 (string-to-number (substring str 6 8)) 494 (string-to-number (substring (match-string 0 prop) 6 8))
477 (string-to-number (substring str 4 6)) 495 (string-to-number (substring (match-string 0 prop) 4 6))
478 (string-to-number (substring str 0 4))))))) 496 (string-to-number (substring (match-string 0 prop) 0 4))
497 )))))
479 498
480 (defun vc-bzr-annotate-extract-revision-at-line () 499 (defun vc-bzr-annotate-extract-revision-at-line ()
481 "Return revision for current line of annoation buffer, or nil. 500 "Return revision for current line of annoation buffer, or nil.
482 Return nil if current line isn't annotated." 501 Return nil if current line isn't annotated."
483 (save-excursion 502 (save-excursion
484 (beginning-of-line) 503 (beginning-of-line)
485 (when (looking-at "\\([0-9.]+\\) ") 504 (if (looking-at " *\\([0-9]+\\) | ")
486 (match-string-no-properties 1)))) 505 (match-string-no-properties 1))))
487 506
488 (defun vc-bzr-command-discarding-stderr (command &rest args) 507 (defun vc-bzr-command-discarding-stderr (command &rest args)
489 "Execute shell command COMMAND (with ARGS); return its output and exitcode. 508 "Execute shell command COMMAND (with ARGS); return its output and exitcode.
490 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is 509 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is
491 the (numerical) exit code of the process, and OUTPUT is a string 510 the (numerical) exit code of the process, and OUTPUT is a string