diff options
Diffstat (limited to 'lisp/vc-bzr.el')
-rw-r--r-- | lisp/vc-bzr.el | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index c42a64969f2..18abed00939 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el @@ -5,7 +5,7 @@ ;; Author: Dave Love <fx@gnu.org>, Riccardo Murri <riccardo.murri@gmail.com> ;; Keywords: tools ;; Created: Sept 2006 -;; Version: 2007-08-03 +;; Version: 2007-09-05 ;; URL: http://launchpad.net/vc-bzr ;; This file is free software; you can redistribute it and/or modify @@ -105,6 +105,8 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment." (concat vc-bzr-admin-dirname "/branch/format")) (defconst vc-bzr-admin-revhistory (concat vc-bzr-admin-dirname "/branch/revision-history")) +(defconst vc-bzr-admin-lastrev + (concat vc-bzr-admin-dirname "/branch/last-revision")) ;;;###autoload (defun vc-bzr-registered (file) ;;;###autoload (if (vc-find-root file vc-bzr-admin-checkout-format-file) @@ -162,7 +164,7 @@ running `vc-bzr-state'." (lexical-let* ((filename* (expand-file-name filename)) (rootdir (vc-bzr-root (file-name-directory filename*)))) - (and rootdir + (when rootdir (file-relative-name filename* rootdir)))) ;; FIXME: Also get this in a non-registered sub-directory. @@ -198,13 +200,13 @@ If any error occurred in running `bzr status', then return nil." (if (file-directory-p file) "/?" "") "[ \t\n]*$") nil t) - (let ((status (match-string 1))) + (lexical-let ((statusword (match-string 1))) ;; Erase the status text that matched. (delete-region (match-beginning 0) (match-end 0)) (setq status (and (equal ret 0) ; Seems redundant. --Stef (intern (replace-regexp-in-string " " "" - status)))))) + statusword)))))) (when status (goto-char (point-min)) (skip-chars-forward " \n\t") ;Throw away spaces. @@ -239,12 +241,12 @@ If any error occurred in running `bzr status', then return nil." (defun vc-bzr-workfile-version (file) (lexical-let* ((rootdir (vc-bzr-root file)) - (branch-format-file (concat rootdir "/" vc-bzr-admin-branch-format-file)) - (revhistory-file (concat rootdir "/" vc-bzr-admin-revhistory)) - (lastrev-file (concat rootdir "/" "branch/last-revision"))) - ;; Count lines in .bzr/branch/revision-history to avoid forking a - ;; bzr process. This looks at internal files. May break if they - ;; change their format. + (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file + rootdir)) + (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) + (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) + ;; This looks at internal files to avoid forking a bzr process. + ;; May break if they change their format. (if (file-exists-p branch-format-file) (with-temp-buffer (insert-file-contents branch-format-file) @@ -259,7 +261,6 @@ If any error occurred in running `bzr status', then return nil." ((looking-at "Bazaar Branch Format 6 (bzr 0.15)") ;; revno is the first number in .bzr/branch/last-revision (insert-file-contents lastrev-file) - (goto-char (line-end-position)) (if (re-search-forward "[0-9]+" nil t) (buffer-substring (match-beginning 0) (match-end 0)))))) ;; fallback to calling "bzr revno" @@ -415,14 +416,14 @@ EDITABLE is ignored." "Prepare BUFFER for `vc-annotate' on FILE. Each line is tagged with the revision number, which has a `help-echo' property containing author and date information." - (apply #'vc-bzr-command "annotate" buffer 0 file "-l" "--all" + (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" (if version (list "-r" version))) (with-current-buffer buffer ;; Store the tags for the annotated source lines in a hash table ;; to allow saving space by sharing the text properties. (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) (goto-char (point-min)) - (while (re-search-forward "^\\( *[0-9]+\\) \\(.+\\) +\\([0-9]\\{8\\}\\) |" + (while (re-search-forward "^\\( *[0-9]+\\) +\\(.+\\) +\\([0-9]\\{8\\}\\) |" nil t) (let* ((rev (match-string 1)) (author (match-string 2)) @@ -430,9 +431,6 @@ property containing author and date information." (key (match-string 0)) (tag (gethash key vc-bzr-annotation-table))) (unless tag - (save-match-data - (string-match " +\\'" author) - (setq author (substring author 0 (match-beginning 0)))) (setq tag (propertize rev 'help-echo (concat "Author: " author ", date: " date) 'mouse-face 'highlight)) @@ -573,7 +571,6 @@ Optional argument LOCALP is always ignored." (eval-after-load "vc" '(add-to-list 'vc-directory-exclusion-list vc-bzr-admin-dirname t)) - (provide 'vc-bzr) ;; arch-tag: 8101bad8-4e92-4e7d-85ae-d8e08b4e7c06 ;;; vc-bzr.el ends here |