]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-bzr.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / vc-bzr.el
index c1be5e18bbc125953d077dd083deec62de1051e6..56fada271d9e26995885cc05723f1842b2db4f27 100644 (file)
@@ -15,7 +15,7 @@
 
 ;; This file is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-LC;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
@@ -92,6 +92,7 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and
     (apply 'vc-do-command buffer okstatus vc-bzr-program
            file-or-list bzr-command args)))
 
+
 ;;;###autoload
 (defconst vc-bzr-admin-dirname ".bzr"
   "Name of the directory containing Bzr repository status files.")
@@ -117,9 +118,8 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and
   "Return the root directory of the bzr repository containing FILE."
   ;; Cache technique copied from vc-arch.el.
   (or (vc-file-getprop file 'bzr-root)
-      (vc-file-setprop
-       file 'bzr-root
-       (vc-find-root file vc-bzr-admin-checkout-format-file))))
+      (let ((root (vc-find-root file vc-bzr-admin-checkout-format-file)))
+       (when root (vc-file-setprop file 'bzr-root root)))))
 
 (defun vc-bzr-registered (file)
   "Return non-nil if FILE is registered with bzr.
@@ -235,7 +235,7 @@ If any error occurred in running `bzr status', then return nil."
 (defun vc-bzr-workfile-unchanged-p (file)
   (eq 'unchanged (car (vc-bzr-status file))))
 
-(defun vc-bzr-workfile-version (file)
+(defun vc-bzr-working-revision (file)
   (lexical-let*
       ((rootdir (vc-bzr-root file))
        (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
@@ -285,7 +285,7 @@ If any error occurred in running `bzr status', then return nil."
   "Register FILE under bzr.
 Signal an error unless REV is nil.
 COMMENT is ignored."
-  (if rev (error "Can't register explicit version with bzr"))
+  (if rev (error "Can't register explicit revision with bzr"))
   (vc-bzr-command "add" nil 0 files))
 
 ;; Could run `bzr status' in the directory and see if it succeeds, but
@@ -314,7 +314,7 @@ or a superior directory.")
 (defun vc-bzr-checkin (files rev comment)
   "Check FILE in to bzr with log message COMMENT.
 REV non-nil gets an error."
-  (if rev (error "Can't check in a specific version with bzr"))
+  (if rev (error "Can't check in a specific revision with bzr"))
   (vc-bzr-command "commit" nil 0 files "-m" comment))
 
 (defun vc-bzr-find-version (file rev buffer)
@@ -377,11 +377,11 @@ EDITABLE is ignored."
   (unless (fboundp 'vc-default-log-view-mode)
     (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode)))
 
-(defun vc-bzr-show-log-entry (version)
-  "Find entry for patch name VERSION in bzr change log buffer."
+(defun vc-bzr-show-log-entry (revision)
+  "Find entry for patch name REVISION in bzr change log buffer."
   (goto-char (point-min))
   (let (case-fold-search)
-    (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t)
+    (if (re-search-forward (concat "^-+\nrevno: " revision "$") nil t)
         (beginning-of-line 0)
       (goto-char (point-min)))))
 
@@ -390,19 +390,17 @@ EDITABLE is ignored."
 (defun vc-bzr-diff (files &optional rev1 rev2 buffer)
   "VC bzr backend for diff."
   ;; `bzr diff' exits with code 1 if diff is non-empty
-    (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 1 files
-         "--diff-options" (mapconcat 'identity 
-                                     (vc-diff-switches-list bzr)
-                                       " ")
-         (list "-r" (format "%s..%s" 
-                            (or rev1 "revno:-1") 
-                            (or rev2 "")))))
-
-(defalias 'vc-bzr-diff-tree 'vc-bzr-diff)
+  (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 1 files
+       "--diff-options" (mapconcat 'identity 
+                                  (vc-diff-switches-list bzr)
+                                    " ")
+       (list "-r" (format "%s..%s" 
+                         (or rev1 "revno:-1") 
+                         (or rev2 "")))))
 
 
-;; FIXME: vc-{next,previous}-version need fixing in vc.el to deal with
-;; straight integer versions.
+;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with
+;; straight integer revisions.
 
 (defun vc-bzr-delete-file (file)
   "Delete FILE and delete it in the bzr repository."
@@ -419,12 +417,12 @@ EDITABLE is ignored."
   "Internal use.")
 (make-variable-buffer-local 'vc-bzr-annotation-table)
 
-(defun vc-bzr-annotate-command (file buffer &optional version)
+(defun vc-bzr-annotate-command (file buffer &optional revision)
   "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 "--long" "--all"
-         (if version (list "-r" version)))
+         (if revision (list "-r" revision)))
   (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.
@@ -479,7 +477,7 @@ stream.  Standard error output is discarded."
 ;; and implement a command to run ediff and `bzr resolve' once the 
 ;; changes have been merged.
 (defun vc-bzr-dir-state (dir &optional localp)
-  "Find the VC state of all files in DIR.
+  "Find the VC state of all files in DIR and its subdirectories.
 Optional argument LOCALP is always ignored."
   (let ((bzr-root-directory (vc-bzr-root dir))
         (at-start t)
@@ -492,7 +490,8 @@ Optional argument LOCALP is always ignored."
     ;; evidence of the contrary.
     (setq at-start t)
     (with-temp-buffer
-      (vc-bzr-command "ls" t 0 nil "--versioned" "--non-recursive")
+      (buffer-disable-undo)            ;; Because these buffers can get huge
+      (vc-bzr-command "ls" t 0 nil "--versioned")
       (goto-char (point-min))
       (while (or at-start
                  (eq 0 (forward-line)))
@@ -519,7 +518,7 @@ Optional argument LOCALP is always ignored."
         (setq at-start nil)
         (cond 
          ((looking-at "^added") 
-          (setq current-vc-state 'edited)
+          (setq current-vc-state 'added)
           (setq current-bzr-state 'added))
          ((looking-at "^kind changed") 
           (setq current-vc-state 'edited)
@@ -530,8 +529,11 @@ Optional argument LOCALP is always ignored."
          ((looking-at "^renamed") 
           (setq current-vc-state 'edited)
           (setq current-bzr-state 'renamed))
-         ((looking-at "^\\(unknown\\|ignored\\)")
-          (setq current-vc-state nil)
+         ((looking-at "^ignored")
+          (setq current-vc-state 'ignored)
+          (setq current-bzr-state 'not-versioned))
+         ((looking-at "^unknown")
+          (setq current-vc-state 'unregistered)
           (setq current-bzr-state 'not-versioned))
          ((looking-at "  ")
           ;; file names are indented by two spaces
@@ -543,7 +545,7 @@ Optional argument LOCALP is always ignored."
               (vc-file-setprop file 'vc-state current-vc-state)
               (vc-file-setprop file 'vc-bzr-state current-bzr-state)
               (when (eq 'added current-bzr-state)
-                (vc-file-setprop file 'vc-workfile-version "0"))))
+                (vc-file-setprop file 'vc-working-revision "0"))))
           (when (eq 'not-versioned current-bzr-state)
             (let ((file (expand-file-name
                          (buffer-substring-no-properties