]> git.eshelyaron.com Git - emacs.git/commitdiff
(vc-functions): Clear up the cache when reloading the file.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 28 Jun 2007 02:01:54 +0000 (02:01 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 28 Jun 2007 02:01:54 +0000 (02:01 +0000)
(vc-bzr-workfile-version, vc-bzr-could-register): Don't hardcode point-min == 1.

lisp/ChangeLog
lisp/vc-bzr.el

index c20c546db3cd85035e8866de118111d801ea60cc..e7b0dee39e12e50390b85fdc7e822de263b1a95a 100644 (file)
@@ -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.
 
index b6a432970b02fd20a8765c805b029c0f31fff5bb..23ce0d9c17a180e18d48e10f0fa8ffe0a17350c2 100644 (file)
   (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 @@ Return nil if there isn't one."
       ;; 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 @@ Return nil if there isn't one."
         ;; 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 @@ Return nil if there isn't one."
   (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 @@ or a superior directory.")
              (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))))