changeset 81649:e40762570726

(vc-functions): Clear up the cache when reloading the file. (vc-bzr-workfile-version, vc-bzr-could-register): Don't hardcode point-min == 1.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 28 Jun 2007 02:01:54 +0000
parents 7697a0ec17f2
children b6aa03e14a51
files lisp/ChangeLog lisp/vc-bzr.el
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Jun 28 01:39:09 2007 +0000
+++ b/lisp/ChangeLog	Thu Jun 28 02:01:54 2007 +0000
@@ -1,7 +1,13 @@
+2007-06-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-bzr.el (vc-functions): Clear up the cache when reloading the file.
+	(vc-bzr-workfile-version, vc-bzr-could-register): Don't hardcode
+	point-min == 1.
+
 2007-06-28  Nick Roberts  <nickrob@snap.net.nz>
 
-	* pcvs-util.el (cvs-strings->string, cvs-string->strings): Rename
-	and move to...
+	* pcvs-util.el (cvs-strings->string, cvs-string->strings):
+	Rename and move to...
 
 	* subr.el (strings->string, string->strings): ...here.
 
--- a/lisp/vc-bzr.el	Thu Jun 28 01:39:09 2007 +0000
+++ b/lisp/vc-bzr.el	Thu Jun 28 02:01:54 2007 +0000
@@ -61,6 +61,10 @@
   (require 'cl)
   (require 'vc))                        ; for vc-exec-after
 
+;; Clear up the cache to force vc-call to check again and discover
+;; new functions when we reload this file.
+(put 'BZR 'vc-functions nil)
+
 (defgroup vc-bzr nil
   "VC bzr backend."
 ;;   :version "22"
@@ -194,15 +198,15 @@
       ;; the file to be up-to-date.
       (goto-char (point-min))
       (when
-          (re-search-forward 
-           (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" 
+          (re-search-forward
+           (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+"
                    (file-name-nondirectory file) "[ \t\n]*$")
            (point-max) t)
         (let ((start (match-beginning 0))
               (end (match-end 0)))
           (goto-char start)
           (setq state
-                (cond 
+                (cond
                  ((not (equal ret 0)) nil)
                  ((looking-at "added\\|renamed\\|modified\\|removed") 'edited)
                  ((looking-at "unknown\\|ignored") nil)))
@@ -216,7 +220,7 @@
         ;; left in the buffer after removing the above status
         ;; keywords, let us just presume that any other message from
         ;; "bzr" is a user warning, and display it.
-        (message "Warnings in `bzr' output: %s" 
+        (message "Warnings in `bzr' output: %s"
                (buffer-substring (point-min) (point-max))))
       (when state
         (vc-file-setprop file 'vc-workfile-version
@@ -228,10 +232,12 @@
   (eq 'up-to-date (vc-bzr-state file)))
 
 (defun vc-bzr-workfile-version (file)
+  ;; Looks like this could be obtained via counting lines in
+  ;; .bzr/branch/revision-history.
   (with-temp-buffer
     (vc-bzr-command "revno" t 0 file)
-    (goto-char 1)
-    (buffer-substring 1 (line-end-position))))
+    (goto-char (point-min))
+    (buffer-substring (point) (line-end-position))))
 
 (defun vc-bzr-checkout-model (file)
   'implicit)
@@ -258,7 +264,7 @@
              (vc-bzr-command "add" t 0 file "--dry-run")
              ;; The command succeeds with no output if file is
              ;; registered (in bzr 0.8).
-             (goto-char 1)
+             (goto-char (point-min))
              (looking-at "added "))
          (error))))