Mercurial > emacs
comparison lisp/vc-bzr.el @ 80333:5818a522c583
(vc-bzr-registered): Fail if `bzr' is not installed.
(vc-bzr-annotate-command): Preserve line alignment.
(vc-bzr-annotate-time): Accept space used to preserve alignment.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 14 Mar 2008 19:38:46 +0000 |
parents | f62e87c6eb20 |
children | 756c7bbc9664 |
comparison
equal
deleted
inserted
replaced
80332:d10c1f589bb2 | 80333:5818a522c583 |
---|---|
144 (goto-char (point-min)) | 144 (goto-char (point-min)) |
145 (if (not (looking-at "#bazaar dirstate flat format 3")) | 145 (if (not (looking-at "#bazaar dirstate flat format 3")) |
146 (vc-bzr-state file) ; Some other unknown format? | 146 (vc-bzr-state file) ; Some other unknown format? |
147 (let* ((relfile (file-relative-name file root)) | 147 (let* ((relfile (file-relative-name file root)) |
148 (reldir (file-name-directory relfile))) | 148 (reldir (file-name-directory relfile))) |
149 (re-search-forward | 149 (when (re-search-forward |
150 (concat "^\0" | 150 (concat "^\0" |
151 (if reldir (regexp-quote (directory-file-name reldir))) | 151 (if reldir (regexp-quote |
152 "\0" | 152 (directory-file-name reldir))) |
153 (regexp-quote (file-name-nondirectory relfile)) | 153 "\0" |
154 "\0") | 154 (regexp-quote (file-name-nondirectory relfile)) |
155 nil t))))))))) | 155 "\0") |
156 nil t) | |
157 ;; Make sure `bzr' agrees that this file is under Bzr's | |
158 ;; control. This is important because if `bzr' is not | |
159 ;; installed vc-find-file may otherwise get an error in | |
160 ;; the subsequent call to `vc-state'. | |
161 (vc-bzr-state file)))))))))) | |
156 | 162 |
157 (defconst vc-bzr-state-words | 163 (defconst vc-bzr-state-words |
158 "added\\|ignored\\|kind changed\\|modified\\|removed\\|renamed\\|unknown" | 164 "added\\|ignored\\|kind changed\\|modified\\|removed\\|renamed\\|unknown" |
159 "Regexp matching file status words as reported in `bzr' output.") | 165 "Regexp matching file status words as reported in `bzr' output.") |
160 | 166 |
428 (with-current-buffer buffer | 434 (with-current-buffer buffer |
429 ;; 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 |
430 ;; to allow saving space by sharing the text properties. | 436 ;; to allow saving space by sharing the text properties. |
431 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) | 437 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) |
432 (goto-char (point-min)) | 438 (goto-char (point-min)) |
433 (while (re-search-forward "^\\( *[0-9]+\\) +\\(.+\\) +\\([0-9]\\{8\\}\\) |" | 439 (while (re-search-forward "^\\( *[0-9]+ *\\) \\([^\n ]+\\) +\\([0-9]\\{8\\}\\) |" |
434 nil t) | 440 nil t) |
435 (let* ((rev (match-string 1)) | 441 (let* ((rev (match-string 1)) |
436 (author (match-string 2)) | 442 (author (match-string 2)) |
437 (date (match-string 3)) | 443 (date (match-string 3)) |
438 (key (match-string 0)) | 444 (key (match-string 0)) |
444 (puthash key tag vc-bzr-annotation-table)) | 450 (puthash key tag vc-bzr-annotation-table)) |
445 (replace-match "") | 451 (replace-match "") |
446 (insert tag " |"))))) | 452 (insert tag " |"))))) |
447 | 453 |
448 (defun vc-bzr-annotate-time () | 454 (defun vc-bzr-annotate-time () |
449 (when (re-search-forward "^ *[0-9]+ |" nil t) | 455 (when (re-search-forward "^ *[0-9]+ +|" nil t) |
450 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) | 456 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) |
451 (string-match "[0-9]+\\'" prop) | 457 (string-match "[0-9]+\\'" prop) |
452 (vc-annotate-convert-time | 458 (vc-annotate-convert-time |
453 (encode-time 0 0 0 | 459 (encode-time 0 0 0 |
454 (string-to-number (substring (match-string 0 prop) 6 8)) | 460 (string-to-number (substring (match-string 0 prop) 6 8)) |