emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/vc.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Tue, 29 Apr 2008 15:33:00 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/04/29 15:32:57

Index: vc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc.el,v
retrieving revision 1.593
retrieving revision 1.594
diff -u -b -r1.593 -r1.594
--- vc.el       29 Apr 2008 13:42:15 -0000      1.593
+++ vc.el       29 Apr 2008 15:32:56 -0000      1.594
@@ -228,9 +228,9 @@
 ;;   The default implementation always returns t, which means that
 ;;   working with non-current revisions is not supported by default.
 ;;
-;; * checkout-model (file)
+;; * checkout-model (files)
 ;;
-;;   Indicate whether FILE needs to be "checked out" before it can be
+;;   Indicate whether FILES need to be "checked out" before they can be
 ;;   edited.  See `vc-checkout-model' for a list of possible values.
 ;;
 ;; - workfile-unchanged-p (file)
@@ -1506,13 +1506,16 @@
       (unless (vc-backend buffer-file-name)
        (error "File %s is not under version control" buffer-file-name))))))
 
-;;; Support for the C-x v v command.  This is where all the 
single-file-oriented
-;;; code from before the fileset rewrite lives.
+;;; Support for the C-x v v command.
+;; This is where all the single-file-oriented code from before the fileset
+;; rewrite lives.
 
 (defsubst vc-editable-p (file)
   "Return non-nil if FILE can be edited."
-  (or (eq (vc-checkout-model file) 'implicit)
-      (memq (vc-state file) '(edited needs-merge conflict))))
+  (let ((backend (vc-backend file)))
+    (and backend
+         (or (eq (vc-checkout-model backend file) 'implicit)
+             (memq (vc-state file) '(edited needs-merge conflict))))))
 
 (defun vc-revert-buffer-internal (&optional arg no-confirm)
   "Revert buffer, keeping point and mark where user expects them.
@@ -1585,9 +1588,10 @@
 merge in the changes into your working copy."
   (interactive "P")
   (let* ((vc-fileset (vc-deduce-fileset nil t))
+         (backend (car vc-fileset))
         (files (cdr vc-fileset))
         state
-        model
+        (model (vc-checkout-model backend files))
         revision)
     ;; Check if there's at least one file present, and get `state' and
     ;; `model' from it.
@@ -1595,7 +1599,6 @@
     ;; present, or `files' is nil.
     (dolist (file files)
       (unless (file-directory-p file)
-       (setq model (vc-checkout-model (car files)))
        (setq state (vc-state file))
        (return)))
 
@@ -1605,7 +1608,7 @@
       (unless (file-directory-p file)
        (unless (vc-compatible-state (vc-state file) state)
          (error "Fileset is in a mixed-up state"))
-       (unless (eq (vc-checkout-model file) model)
+       (unless (eq (vc-checkout-model backend file) model)
          (error "Fileset has mixed checkout models"))))
     ;; Check for buffers in the fileset not matching the on-disk contents.
     (dolist (file files)
@@ -1932,23 +1935,23 @@
        (vc-call make-version-backups-p file)
        (vc-up-to-date-p file)
        (vc-make-version-backup file))
-  (with-vc-properties
-   (list file)
+  (let ((backend (vc-backend file)))
+    (with-vc-properties (list file)
    (condition-case err
-       (vc-call checkout file writable rev)
+          (vc-call-backend 'checkout file writable rev)
      (file-error
       ;; Maybe the backend is not installed ;-(
       (when writable
        (let ((buf (get-file-buffer file)))
          (when buf (with-current-buffer buf (toggle-read-only -1)))))
       (signal (car err) (cdr err))))
-   `((vc-state . ,(if (or (eq (vc-checkout-model file) 'implicit)
+      `((vc-state . ,(if (or (eq (vc-checkout-model backend file) 'implicit)
                          (not writable))
                      (if (vc-call latest-on-branch-p file)
                          'up-to-date
                        'needs-patch)
                    'edited))
-     (vc-checkout-time . ,(nth 5 (file-attributes file)))))
+        (vc-checkout-time . ,(nth 5 (file-attributes file))))))
   (vc-resynch-buffer file t t)
   (run-hooks 'vc-checkout-hook))
 
@@ -3769,7 +3772,7 @@
        (error "Please kill or save all modified buffers before updating."))
       (if (vc-up-to-date-p file)
          (vc-checkout file nil t)
-       (if (eq (vc-checkout-model file) 'locking)
+       (if (eq (vc-checkout-model backend file) 'locking)
            (if (eq (vc-state file) 'edited)
                (error "%s"
                       (substitute-command-keys
@@ -3896,7 +3899,7 @@
              (vc-call-backend new-backend 'receive-file file rev))
          (when modified-file
            (vc-switch-backend file new-backend)
-           (unless (eq (vc-checkout-model file) 'implicit)
+           (unless (eq (vc-checkout-model new-backend file) 'implicit)
              (vc-checkout file t nil))
            (rename-file modified-file file 'ok-if-already-exists)
            (vc-file-setprop file 'vc-checkout-time nil)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]