comparison lisp/vc-bzr.el @ 80340:756c7bbc9664

(vc-bzr-log-view-mode, vc-bzr-annotate-command) (vc-bzr-annotate-time, vc-bzr-annotate-extract-revision-at-line): Revision numbers can include ".".
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 18 Mar 2008 20:52:17 +0000
parents 5818a522c583
children 3c75e19e7ec9
comparison
equal deleted inserted replaced
80339:448b3f1d280a 80340:756c7bbc9664
355 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 355 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
356 (require 'add-log) 356 (require 'add-log)
357 ;; Don't have file markers, so use impossible regexp. 357 ;; Don't have file markers, so use impossible regexp.
358 (set (make-local-variable 'log-view-file-re) "\\'\\`") 358 (set (make-local-variable 'log-view-file-re) "\\'\\`")
359 (set (make-local-variable 'log-view-message-re) 359 (set (make-local-variable 'log-view-message-re)
360 "^ *-+\n *\\(?:revno: \\([0-9]+\\)\\|merged: .+\\)") 360 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)")
361 (set (make-local-variable 'log-view-font-lock-keywords) 361 (set (make-local-variable 'log-view-font-lock-keywords)
362 ;; log-view-font-lock-keywords is careful to use the buffer-local 362 ;; log-view-font-lock-keywords is careful to use the buffer-local
363 ;; value of log-view-message-re only since Emacs-23. 363 ;; value of log-view-message-re only since Emacs-23.
364 (append `((,log-view-message-re . 'log-view-message-face)) 364 (append `((,log-view-message-re . 'log-view-message-face))
365 ;; log-view-font-lock-keywords 365 ;; log-view-font-lock-keywords
434 (with-current-buffer buffer 434 (with-current-buffer buffer
435 ;; Store the tags for the annotated source lines in a hash table 435 ;; Store the tags for the annotated source lines in a hash table
436 ;; to allow saving space by sharing the text properties. 436 ;; to allow saving space by sharing the text properties.
437 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) 437 (setq vc-bzr-annotation-table (make-hash-table :test 'equal))
438 (goto-char (point-min)) 438 (goto-char (point-min))
439 (while (re-search-forward "^\\( *[0-9]+ *\\) \\([^\n ]+\\) +\\([0-9]\\{8\\}\\) |" 439 (while (re-search-forward "^\\( *[0-9.]+ *\\) \\([^\n ]+\\) +\\([0-9]\\{8\\}\\) |"
440 nil t) 440 nil t)
441 (let* ((rev (match-string 1)) 441 (let* ((rev (match-string 1))
442 (author (match-string 2)) 442 (author (match-string 2))
443 (date (match-string 3)) 443 (date (match-string 3))
444 (key (match-string 0)) 444 (key (match-string 0))
450 (puthash key tag vc-bzr-annotation-table)) 450 (puthash key tag vc-bzr-annotation-table))
451 (replace-match "") 451 (replace-match "")
452 (insert tag " |"))))) 452 (insert tag " |")))))
453 453
454 (defun vc-bzr-annotate-time () 454 (defun vc-bzr-annotate-time ()
455 (when (re-search-forward "^ *[0-9]+ +|" nil t) 455 (when (re-search-forward "^ *[0-9.]+ +|" nil t)
456 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) 456 (let ((prop (get-text-property (line-beginning-position) 'help-echo)))
457 (string-match "[0-9]+\\'" prop) 457 (string-match "[0-9]+\\'" prop)
458 (vc-annotate-convert-time 458 (vc-annotate-convert-time
459 (encode-time 0 0 0 459 (encode-time 0 0 0
460 (string-to-number (substring (match-string 0 prop) 6 8)) 460 (string-to-number (substring (match-string 0 prop) 6 8))
465 (defun vc-bzr-annotate-extract-revision-at-line () 465 (defun vc-bzr-annotate-extract-revision-at-line ()
466 "Return revision for current line of annoation buffer, or nil. 466 "Return revision for current line of annoation buffer, or nil.
467 Return nil if current line isn't annotated." 467 Return nil if current line isn't annotated."
468 (save-excursion 468 (save-excursion
469 (beginning-of-line) 469 (beginning-of-line)
470 (if (looking-at " *\\([0-9]+\\) | ") 470 (if (looking-at " *\\([0-9.]+\\) | ")
471 (match-string-no-properties 1)))) 471 (match-string-no-properties 1))))
472 472
473 (defun vc-bzr-command-discarding-stderr (command &rest args) 473 (defun vc-bzr-command-discarding-stderr (command &rest args)
474 "Execute shell command COMMAND (with ARGS); return its output and exitcode. 474 "Execute shell command COMMAND (with ARGS); return its output and exitcode.
475 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is 475 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is