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-cvs.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-cvs.el,v
Date: Sun, 08 Jul 2007 19:34:21 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        07/07/08 19:34:20

Index: vc-cvs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-cvs.el,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- vc-cvs.el   21 Jan 2007 03:53:10 -0000      1.80
+++ vc-cvs.el   8 Jul 2007 19:34:19 -0000       1.81
@@ -368,60 +368,13 @@
         "-p"
         (vc-switches 'CVS 'checkout)))
 
-(defun vc-cvs-checkout (file &optional editable rev workfile)
-  "Retrieve a revision of FILE into a WORKFILE.
+(defun vc-cvs-checkout (file &optional editable rev)
+  "Checkout a revision of FILE into the working area.
 EDITABLE non-nil means that the file should be writable.
-REV is the revision to check out into WORKFILE."
-  (let ((filename (or workfile file))
-       (file-buffer (get-file-buffer file))
-       switches)
-    (message "Checking out %s..." filename)
-    (save-excursion
+REV is the revision to check out."
+  (message "Checking out %s..." file)
       ;; Change buffers to get local value of vc-checkout-switches.
-      (if file-buffer (set-buffer file-buffer))
-      (setq switches (vc-switches 'CVS 'checkout))
-      ;; Save this buffer's default-directory
-      ;; and use save-excursion to make sure it is restored
-      ;; in the same buffer it was saved in.
-      (let ((default-directory default-directory))
-       (save-excursion
-         ;; Adjust the default-directory so that the check-out creates
-         ;; the file in the right place.
-         (setq default-directory (file-name-directory filename))
-         (if workfile
-             (let ((failed t)
-                    (backup-name (if (string= file workfile)
-                                     (car (find-backup-file-name filename)))))
-                (when backup-name
-                  (copy-file filename backup-name
-                             'ok-if-already-exists 'keep-date)
-                  (unless (file-writable-p filename)
-                    (set-file-modes filename
-                                    (logior (file-modes filename) 128))))
-               (unwind-protect
-                   (progn
-                      (let ((coding-system-for-read 'no-conversion)
-                            (coding-system-for-write 'no-conversion))
-                        (with-temp-file filename
-                          (apply 'vc-cvs-command
-                                 (current-buffer) 0 file
-                                 "-Q"  ; suppress diagnostic output
-                                 "update"
-                                 (and (stringp rev)
-                                      (not (string= rev ""))
-                                      (concat "-r" rev))
-                                 "-p"
-                                 switches)))
-                     (setq failed nil))
-                 (if failed
-                      (if backup-name
-                          (rename-file backup-name filename
-                                       'ok-if-already-exists)
-                        (if (file-exists-p filename)
-                            (delete-file filename)))
-                    (and backup-name
-                         (not vc-make-backup-files)
-                         (delete-file backup-name)))))
+  (with-current-buffer (or (get-file-buffer file) (current-buffer))
            (if (and (file-exists-p file) (not rev))
                ;; If no revision was specified, just make the file writable
                ;; if necessary (using `cvs-edit' if requested).
@@ -429,15 +382,11 @@
                      (if vc-cvs-use-edit
                          (vc-cvs-command nil 0 file "edit")
                        (set-file-modes file (logior (file-modes file) 128))
-                       (if file-buffer (toggle-read-only -1))))
+               (if (equal file buffer-file-name) (toggle-read-only -1))))
               ;; Check out a particular version (or recreate the file).
               (vc-file-setprop file 'vc-workfile-version nil)
               (apply 'vc-cvs-command nil 0 file
-                     (and editable
-                          (or (not (file-exists-p file))
-                              (not (eq (vc-cvs-checkout-model file)
-                                       'implicit)))
-                          "-w")
+             (and editable "-w")
                      "update"
                      (when rev
                        (unless (eq rev t)
@@ -447,20 +396,17 @@
                          (if (string= rev "")
                              "-A"
                            (concat "-r" rev))))
-                     switches))))
-       (vc-mode-line file)
-       (message "Checking out %s...done" filename)))))
+             (vc-switches 'CVS 'checkout)))
+    (vc-mode-line file))
+  (message "Checking out %s...done" file))
 
 (defun vc-cvs-delete-file (file)
   (vc-cvs-command nil 0 file "remove" "-f")
   (vc-cvs-command nil 0 file "commit" "-mRemoved."))
 
 (defun vc-cvs-revert (file &optional contents-done)
-  "Revert FILE to the version it was based on."
-  (unless contents-done
-    ;; Check out via standard output (caused by the final argument
-    ;; FILE below), so that no sticky tag is set.
-    (vc-cvs-checkout file nil (vc-workfile-version file) file))
+  "Revert FILE to the version on which it was based."
+  (vc-default-revert 'CVS file contents-done)
   (unless (eq (vc-checkout-model file) 'implicit)
     (if vc-cvs-use-edit
         (vc-cvs-command nil 0 file "unedit")




reply via email to

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