]> code.delx.au - gnu-emacs/blobdiff - lisp/pcvs.el
Add 2008 to copyright years.
[gnu-emacs] / lisp / pcvs.el
index e7139d9cfbacdff8abbabd8efab945599579f27d..f464455973990f3333c4f2ac82e6bcc291cff630 100644 (file)
@@ -1,7 +1,7 @@
 ;;; pcvs.el --- a front-end to CVS
 
 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;;   2000, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com
 ;;     (Per Cederqvist) ceder@lysator.liu.se
@@ -19,7 +19,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -29,8 +29,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
          (when (re-search-forward
                 (concat "^" cmd "\\(\\s-+\\(.*\\)\\)?$") nil t)
            (let* ((sym (intern (concat "cvs-" cmd "-flags")))
-                  (val (cvs-string->strings (or (match-string 2) ""))))
+                  (val (split-string-and-unquote (or (match-string 2) ""))))
              (cvs-flags-set sym 0 val))))
        ;; ensure that cvs doesn't have -q or -Q
        (cvs-flags-set 'cvs-cvs-flags 0
                             nil        ;don't update display while running
                             "status"
                             "-v"
-                            (cvs-fileinfo->full-path (car marked)))
+                            (cvs-fileinfo->full-name (car marked)))
               (goto-char (point-min))
               (let ((tags (cvs-status-get-tags)))
                 (when (listp tags) tags)))))))
@@ -392,7 +392,11 @@ from the current buffer."
     (with-current-buffer buf
       (setq buffer-read-only nil)
       (setq default-directory dir)
-      (unless nosetup (erase-buffer))
+      (unless nosetup
+        ;; Disable undo before calling erase-buffer since it may generate
+        ;; a very large and unwanted undo record.
+        (buffer-disable-undo)
+        (erase-buffer))
       (set (make-local-variable 'cvs-buffer) cvs-buf)
       ;;(cvs-minor-mode 1)
       (let ((lbd list-buffers-directory))
@@ -400,7 +404,8 @@ from the current buffer."
        (when lbd (set (make-local-variable 'list-buffers-directory) lbd)))
       (cvs-minor-mode 1)
       ;;(set (make-local-variable 'cvs-buffer) cvs-buf)
-      (unless normal
+      (if normal
+          (buffer-enable-undo)
        (setq buffer-read-only t)
        (buffer-disable-undo))
       buf)))
@@ -467,7 +472,7 @@ If non-nil, NEW means to create a new buffer no matter what."
         (cvs-mode)
         (set (make-local-variable 'list-buffers-directory) buffer-name)
         ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer))
-        (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n" "")))
+        (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n" t)))
           (set (make-local-variable 'cvs-cookies) cookies)
           (add-hook 'kill-buffer-hook
                     (lambda ()
@@ -512,7 +517,7 @@ If non-nil, NEW means to create a new buffer no matter what."
       (let* ((dir+files+rest
              (if (or (null fis) (not single-dir))
                  ;; not single-dir mode: just process the whole thing
-                 (list "" (mapcar 'cvs-fileinfo->full-path fis) nil)
+                 (list "" (mapcar 'cvs-fileinfo->full-name fis) nil)
                ;; single-dir mode: extract the same-dir-elements
                (let ((dir (cvs-fileinfo->dir (car fis))))
                  ;; output the concerned dir so the parser can translate paths
@@ -607,18 +612,17 @@ If non-nil, NEW means to create a new buffer no matter what."
                          (t arg)))
                       args)))
     (concat cvs-program " "
-           (cvs-strings->string
+           (combine-and-quote-strings
             (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
                     (if cvs-cvsroot (list "-d" cvs-cvsroot))
                     args
-                    (mapcar 'cvs-fileinfo->full-path fis))))))
+                    (mapcar 'cvs-fileinfo->full-name fis))))))
 
 (defun cvs-update-header (cmd add)
   (let* ((hf (ewoc-get-hf cvs-cookies))
         (str (car hf))
         (done "")
         (tin (ewoc-nth cvs-cookies 0)))
-    (if (eq (length str) 1) (setq str ""))
     ;; look for the first *real* fileinfo (to determine emptyness)
     (while
        (and tin
@@ -626,13 +630,17 @@ If non-nil, NEW means to create a new buffer no matter what."
                   '(MESSAGE DIRCHANGE)))
       (setq tin (ewoc-next cvs-cookies tin)))
     (if add
-       (setq str (concat "-- Running " cmd " ...\n" str))
+        (progn
+          ;; Remove the default empty line, if applicable.
+          (if (not (string-match "." str)) (setq str "\n"))
+          (setq str (concat "-- Running " cmd " ...\n" str)))
       (if (not (string-match
                (concat "^-- Running " (regexp-quote cmd) " \\.\\.\\.\n") str))
          (error "Internal PCL-CVS error while removing message")
        (setq str (replace-match "" t t str))
-       (if (zerop (length str)) (setq str "\n"))
-       (setq done (concat "-- last cmd: " cmd " --"))))
+        ;; Re-add the default empty line, if applicable.
+        (if (not (string-match "." str)) (setq str "\n\n"))
+       (setq done (concat "-- last cmd: " cmd " --\n"))))
     ;; set the new header and footer
     (ewoc-set-hf cvs-cookies
                 str (concat "\n--------------------- "
@@ -647,34 +655,38 @@ This is responsible for parsing the output from the cvs update when
 it is finished."
   (when (memq (process-status proc) '(signal exit))
     (let ((cvs-postproc (process-get proc 'cvs-postprocess))
-         (cvs-buf (process-get proc 'cvs-buffer)))
+         (cvs-buf (process-get proc 'cvs-buffer))
+          (procbuf (process-buffer proc)))
+      (unless (buffer-live-p cvs-buf) (setq cvs-buf nil))
+      (unless (buffer-live-p procbuf) (setq procbuf nil))
       ;; Since the buffer and mode line will show that the
       ;; process is dead, we can delete it now.  Otherwise it
       ;; will stay around until M-x list-processes.
       (process-put proc 'postprocess nil)
       (delete-process proc)
       ;; Don't do anything if the main buffer doesn't exist any more.
-      (when (buffer-live-p cvs-buf)
+      (when cvs-buf
        (with-current-buffer cvs-buf
          (cvs-update-header (process-get proc 'cvs-header) nil)
          (setq cvs-mode-line-process (symbol-name (process-status proc)))
          (force-mode-line-update)
          (when cvs-postproc
-           (if (null (buffer-live-p (process-buffer proc)))
+           (if (null procbuf)
                ;;(set-process-buffer proc nil)
                (error "cvs' process buffer was killed")
-             (with-current-buffer (process-buffer proc)
-               ;; do the postprocessing like parsing and such
-               (save-excursion (eval cvs-postproc))
-               ;; check whether something is left
-               (unless (get-buffer-process (current-buffer))
-                 ;; IIRC, we enable undo again once the process is finished
-                 ;; for cases where the output was inserted in *vc-diff* or
-                 ;; in a file-like buffer.  --Stef
-                 (buffer-enable-undo)
-                 (with-current-buffer cvs-buffer
-                   (message "CVS process has completed in %s"
-                            (buffer-name))))))))))))
+             (with-current-buffer procbuf
+               ;; Do the postprocessing like parsing and such.
+               (save-excursion (eval cvs-postproc)))))))
+      ;; Check whether something is left.
+      (when (and procbuf (not (get-buffer-process procbuf)))
+        (with-current-buffer procbuf
+          ;; IIRC, we enable undo again once the process is finished
+          ;; for cases where the output was inserted in *vc-diff* or
+          ;; in a file-like buffer.  --Stef
+          (buffer-enable-undo)
+          (with-current-buffer (or cvs-buf (current-buffer))
+            (message "CVS process has completed in %s"
+                     (buffer-name))))))))
 
 (defun cvs-parse-process (dcd &optional subdir old-fis)
   "Parse the output of a cvs process.
@@ -771,6 +783,7 @@ clear what alternative to use.
 For interactive use, use `" (symbol-name fun) "' instead.")
             ,interact
             ,@body)
+          (put ',fun-1 'definition-name ',fun)
           (defun ,fun ()
             ,(concat line1 "\nWrapper function that switches to a *cvs* buffer
 before calling the real function `" (symbol-name fun-1) "'.\n")
@@ -831,7 +844,7 @@ the problem."
   (and (or (eq (cvs-fileinfo->type fi) 'REMOVED)
           (and (eq (cvs-fileinfo->type fi) 'CONFLICT)
                (eq (cvs-fileinfo->subtype fi) 'REMOVED)))
-       (file-exists-p (cvs-fileinfo->full-path fi))))
+       (file-exists-p (cvs-fileinfo->full-name fi))))
 
 ;; called at the following times:
 ;; - postparse  ((eq cvs-auto-remove-handled t) cvs-auto-remove-directories nil)
@@ -928,7 +941,8 @@ With a prefix argument, prompt for cvs FLAGS to use."
    (let ((root (cvs-get-cvsroot)))
      (if (or (null root) current-prefix-arg)
         (setq root (read-string "CVS Root: ")))
-     (list (cvs-string->strings (read-string "Module(s): " (cvs-get-module)))
+     (list (split-string-and-unquote
+           (read-string "Module(s): " (cvs-get-module)))
           (read-directory-name "CVS Checkout Directory: "
                                nil default-directory nil)
           (cvs-add-branch-prefix
@@ -944,14 +958,14 @@ With a prefix argument, prompt for cvs FLAGS to use."
 (defun-cvs-mode (cvs-mode-checkout . NOARGS) (dir)
   "Run cvs checkout against the current branch.
 The files are stored to DIR."
-  (interactive 
+  (interactive
    (let* ((branch (cvs-prefix-get 'cvs-branch-prefix))
-         (prompt (format "CVS Checkout Directory for `%s%s': " 
+         (prompt (format "CVS Checkout Directory for `%s%s': "
                         (cvs-get-module)
                         (if branch (format " (branch: %s)" branch)
                           ""))))
      (list (read-directory-name prompt nil default-directory nil))))
-  (let ((modules (cvs-string->strings (cvs-get-module)))
+  (let ((modules (split-string-and-unquote (cvs-get-module)))
        (flags (cvs-add-branch-prefix
                (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
        (cvs-cvsroot (cvs-get-cvsroot)))
@@ -967,13 +981,13 @@ The files are stored to DIR."
   (interactive)
   (cvs-examine default-directory t))
 
-(defun cvs-query-directory (msg)
-  ;; last-command-char = ?\r hints that the command was run via M-x
+(defun cvs-query-directory (prompt)
+  "Read directory name, prompting with PROMPT.
+If in a *cvs* buffer, don't prompt unless a prefix argument is given."
   (if (and (cvs-buffer-p)
-          (not current-prefix-arg)
-          (not (eq last-command-char ?\r)))
+          (not current-prefix-arg))
       default-directory
-    (read-directory-name msg nil default-directory nil)))
+    (read-directory-name prompt nil default-directory nil)))
 
 ;;;###autoload
 (defun cvs-quickdir (dir &optional flags noshow)
@@ -1123,7 +1137,7 @@ Full documentation is in the Texinfo file."
                                      ("->" cvs-secondary-branch-prefix))))
          " " cvs-mode-line-process))
   (if buffer-file-name
-      (error "Use M-x cvs-quickdir to get a *cvs* buffer."))
+      (error "Use M-x cvs-quickdir to get a *cvs* buffer"))
   (buffer-disable-undo)
   ;;(set (make-local-variable 'goal-column) cvs-cursor-column)
   (set (make-local-variable 'revert-buffer-function) 'cvs-mode-revert-buffer)
@@ -1171,7 +1185,7 @@ Full documentation is in the Texinfo file."
   (interactive)
   (if (eq last-command 'cvs-help)
       (describe-function 'cvs-mode)   ; would need minor-mode for log-edit-mode
-    (message
+    (message "%s"
      (substitute-command-keys
       "`\\[cvs-help]':help `\\[cvs-mode-add]':add `\\[cvs-mode-commit]':commit \
 `\\[cvs-mode-diff-map]':diff* `\\[cvs-mode-log]':log \
@@ -1406,7 +1420,7 @@ If FILE is non-nil, directory entries won't be selected."
 (defun cvs-mode-files (&rest -cvs-mode-files-args)
   (cvs-mode!
    (lambda ()
-     (mapcar 'cvs-fileinfo->full-path
+     (mapcar 'cvs-fileinfo->full-name
             (apply 'cvs-mode-marked -cvs-mode-files-args)))))
 
 ;;
@@ -1438,12 +1452,10 @@ The POSTPROC specified there (typically `log-edit') is then called,
   ;; displayed in the wrong minibuffer).
   (cvs-mode!)
   (let ((buf (cvs-temp-buffer "message" 'normal 'nosetup))
-       (lbd list-buffers-directory)
        (setupfun (or (nth 2 (cdr (assoc "message" cvs-buffer-name-alist)))
                      'log-edit)))
     (funcall setupfun 'cvs-do-commit setup 'cvs-commit-filelist buf)
     (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-commit-minor-wrap)
-    (set (make-local-variable 'list-buffers-directory) lbd)
     (run-hooks 'cvs-mode-commit-hook)))
 
 (defun cvs-commit-minor-wrap (buf f)
@@ -1480,11 +1492,16 @@ The POSTPROC specified there (typically `log-edit') is then called,
         (point))))))
 
 (defvar cvs-edit-log-revision)
-(defun cvs-mode-edit-log (rev &optional text)
+(defvar cvs-edit-log-files) (put 'cvs-edit-log-files 'permanent-local t)
+(defun cvs-mode-edit-log (file rev &optional text)
   "Edit the log message at point.
 This is best called from a `log-view-mode' buffer."
   (interactive
    (list
+    (or (cvs-mode! (lambda ()
+                     (car (cvs-mode-files nil nil
+                                          :read-only t :file t :noquery t))))
+        (read-string "File name: "))
     (or (cvs-mode! (lambda () (cvs-prefix-get 'cvs-branch-prefix)))
        (read-string "Revision to edit: "))
     (cvs-edit-log-text-at-point)))
@@ -1494,30 +1511,40 @@ This is best called from a `log-view-mode' buffer."
   ;; displayed in the wrong minibuffer).
   (cvs-mode!)
   (let ((buf (cvs-temp-buffer "message" 'normal 'nosetup))
-       (lbd list-buffers-directory)
        (setupfun (or (nth 2 (cdr (assoc "message" cvs-buffer-name-alist)))
                      'log-edit)))
+    (with-current-buffer buf
+      ;; Set the filename before, so log-edit can correctly setup its
+      ;; log-edit-initial-files variable.
+      (set (make-local-variable 'cvs-edit-log-files) (list file)))
     (funcall setupfun 'cvs-do-edit-log nil 'cvs-edit-log-filelist buf)
     (when text (erase-buffer) (insert text))
     (set (make-local-variable 'cvs-edit-log-revision) rev)
-    (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-edit-log-minor-wrap)
-    (set (make-local-variable 'list-buffers-directory) lbd)
+    (set (make-local-variable 'cvs-minor-wrap-function)
+         'cvs-edit-log-minor-wrap)
     ;; (run-hooks 'cvs-mode-commit-hook)
     ))
 
 (defun cvs-edit-log-minor-wrap (buf f)
-  (let ((cvs-ignore-marks-modif (cvs-mode-mark-get-modif "commit")))
+  (let ((cvs-branch-prefix (with-current-buffer buf cvs-edit-log-revision))
+        (cvs-minor-current-files
+         (with-current-buffer buf cvs-edit-log-files))
+        ;; FIXME:  I need to force because the fileinfos are UNKNOWN
+        (cvs-force-command "/F"))
     (funcall f)))
 
 (defun cvs-edit-log-filelist ()
-  (cvs-mode-files nil nil :read-only t :file t :noquery t))
+  (if cvs-minor-wrap-function
+      (cvs-mode-files nil nil :read-only t :file t :noquery t)
+    cvs-edit-log-files))
 
 (defun cvs-do-edit-log (rev)
   "Do the actual commit, using the current buffer as the log message."
   (interactive (list cvs-edit-log-revision))
   (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
-    (cvs-mode!)
-    (cvs-mode-do "admin" (list (concat "-m" rev ":" msg)) nil)))
+    (cvs-mode!
+     (lambda ()
+       (cvs-mode-do "admin" (list (concat "-m" rev ":" msg)) nil)))))
 
 
 ;;;;
@@ -1564,7 +1591,7 @@ With prefix argument, prompt for cvs flags."
     ;; find directories and look for fis needing a description
     (dolist (fi fis)
       (cond
-       ((file-directory-p (cvs-fileinfo->full-path fi)) (push fi dirs))
+       ((file-directory-p (cvs-fileinfo->full-name fi)) (push fi dirs))
        ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t))))
     ;; prompt for description if necessary
     (let* ((msg (if (and needdesc
@@ -1642,8 +1669,8 @@ or \"Conflict\" in the *cvs* buffer."
 Signal an error if there is no backup file."
   (let ((backup-file (cvs-fileinfo->backup-file fileinfo)))
     (unless backup-file
-      (error "%s has no backup file" (cvs-fileinfo->full-path fileinfo)))
-    (list backup-file (cvs-fileinfo->full-path fileinfo))))
+      (error "%s has no backup file" (cvs-fileinfo->full-name fileinfo)))
+    (list backup-file (cvs-fileinfo->full-name fileinfo))))
 
 ;;
 ;; Emerge support
@@ -1697,23 +1724,31 @@ Signal an error if there is no backup file."
 
 (defun cvs-retrieve-revision (fileinfo rev)
   "Retrieve the given REVision of the file in FILEINFO into a new buffer."
-  (let* ((file (cvs-fileinfo->full-path fileinfo))
+  (let* ((file (cvs-fileinfo->full-name fileinfo))
         (buffile (concat file "." rev)))
     (or (find-buffer-visiting buffile)
        (with-current-buffer (create-file-buffer buffile)
          (message "Retrieving revision %s..." rev)
          ;; Discard stderr output to work around the CVS+SSH+libc
          ;; problem when stdout and stderr are the same.
-         (let ((res (apply 'call-process cvs-program nil '(t nil) nil
-                           "-q" "update" "-p"
-                           ;; If `rev' is HEAD, don't pass it at all:
-                           ;; the default behavior is to get the head
-                           ;; of the current branch whereas "-r HEAD"
-                           ;; stupidly gives you the head of the trunk.
-                           (append (unless (equal rev "HEAD") (list "-r" rev))
-                                   (list file)))))
+         (let ((res
+                 (let ((coding-system-for-read 'binary))
+                   (apply 'call-process cvs-program nil '(t nil) nil
+                          "-q" "update" "-p"
+                          ;; If `rev' is HEAD, don't pass it at all:
+                          ;; the default behavior is to get the head
+                          ;; of the current branch whereas "-r HEAD"
+                          ;; stupidly gives you the head of the trunk.
+                          (append (unless (equal rev "HEAD") (list "-r" rev))
+                                  (list file))))))
            (when (and res (not (and (equal 0 res))))
              (error "Something went wrong retrieving revision %s: %s" rev res))
+            ;; Figure out the encoding used and decode the byte-sequence
+            ;; into a sequence of chars.
+            (decode-coding-inserted-region
+             (point-min) (point-max) file t nil nil t)
+            ;; Set buffer-file-coding-system.
+            (after-insert-file-set-coding (buffer-size) t)
            (set-buffer-modified-p nil)
            (let ((buffer-file-name (expand-file-name file)))
              (after-find-file))
@@ -1729,7 +1764,7 @@ Signal an error if there is no backup file."
   (interactive)
   (let ((fi (cvs-mode-marked 'merge nil :one t :file t)))
     (let ((merge (cvs-fileinfo->merge fi))
-         (file (cvs-fileinfo->full-path fi))
+         (file (cvs-fileinfo->full-name fi))
          (backup-file (cvs-fileinfo->backup-file fi)))
       (if (not (and merge backup-file))
          (let ((buf (find-file-noselect file)))
@@ -1760,7 +1795,7 @@ Signal an error if there is no backup file."
      (list (or rev1 (cvs-flags-query 'cvs-idiff-version))
           rev2)))
   (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t)))
-    (let* ((file (cvs-fileinfo->full-path fi))
+    (let* ((file (cvs-fileinfo->full-name fi))
           (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE")))
           (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2)))
           ;; this binding is used by cvs-ediff-startup-hook
@@ -1778,13 +1813,13 @@ Signal an error if there is no backup file."
       (error "idiff-other cannot be applied to more than 2 files at a time"))
     (let* ((fi1 (car fis))
           (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1)
-                      (find-file-noselect (cvs-fileinfo->full-path fi1))))
+                      (find-file-noselect (cvs-fileinfo->full-name fi1))))
           rev2-buf)
       (if (cdr fis)
          (let ((fi2 (nth 1 fis)))
            (setq rev2-buf
                  (if rev2 (cvs-retrieve-revision fi2 rev2)
-                   (find-file-noselect (cvs-fileinfo->full-path fi2)))))
+                   (find-file-noselect (cvs-fileinfo->full-name fi2)))))
        (error "idiff-other doesn't know what other file/buffer to use"))
       (let* (;; this binding is used by cvs-ediff-startup-hook
             (cvs-transient-buffers (list rev1-buf rev2-buf)))
@@ -1799,7 +1834,7 @@ Signal an error if there is no backup file."
     (let (ret)
       (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
        (when (cvs-string-prefix-p
-              (expand-file-name (cvs-fileinfo->full-path fi) dir)
+              (expand-file-name (cvs-fileinfo->full-name fi) dir)
               buffer-file-name)
          (setq ret t)))
       ret)))
@@ -1869,7 +1904,7 @@ With prefix argument, prompt for cvs flags."
   (interactive (list (cvs-flags-query 'cvs-status-flags "cvs status flags")))
   (cvs-mode-do "status" flags nil :dont-change-disc t :show t
               :postproc (when (eq cvs-auto-remove-handled 'status)
-                          '((with-current-buffer ,(current-buffer)
+                          `((with-current-buffer ,(current-buffer)
                               (cvs-mode-remove-handled))))))
 
 (defun-cvs-mode (cvs-mode-tree . SIMPLE) (flags)
@@ -1984,7 +2019,7 @@ With a prefix, opens the buffer in an OTHER window."
   (when (and (/= (point) (progn (posn-set-point (event-end e)) (point)))
             (not (memq (get-text-property (1- (line-end-position))
                                            'font-lock-face)
-                        '(cvs-header-face cvs-filename-face))))
+                        '(cvs-header cvs-filename))))
     (error "Not a file name"))
   (cvs-mode!
    (lambda (&optional rev)
@@ -2002,7 +2037,7 @@ With a prefix, opens the buffer in an OTHER window."
             (set-buffer cvs-buf)
             (setq default-directory odir))
         (let ((buf (if rev (cvs-retrieve-revision fi rev)
-                     (find-file-noselect (cvs-fileinfo->full-path fi)))))
+                     (find-file-noselect (cvs-fileinfo->full-name fi)))))
           (funcall (cond ((eq other 'dont-select) 'display-buffer)
                          (other
                           (if view 'view-buffer-other-window
@@ -2093,14 +2128,14 @@ Returns a list of FIS that should be `cvs remove'd."
         (silent (or (not cvs-confirm-removals)
                     (cvs-every (lambda (fi)
                                  (or (not (file-exists-p
-                                           (cvs-fileinfo->full-path fi)))
+                                           (cvs-fileinfo->full-name fi)))
                                      (cvs-applicable-p fi 'safe-rm)))
                                files)))
         (tmpbuf (cvs-temp-buffer)))
     (when (and (not silent) (equal cvs-confirm-removals 'list))
       (with-current-buffer tmpbuf
        (let ((inhibit-read-only t))
-         (cvs-insert-strings (mapcar 'cvs-fileinfo->full-path fis))
+         (cvs-insert-strings (mapcar 'cvs-fileinfo->full-name fis))
          (cvs-pop-to-buffer-same-frame (current-buffer))
          (shrink-window-if-larger-than-buffer))))
     (if (not (or silent
@@ -2119,7 +2154,7 @@ Returns a list of FIS that should be `cvs remove'd."
        (progn (message "Aborting") nil)
       (dolist (fi files)
        (let* ((type (cvs-fileinfo->type fi))
-              (file (cvs-fileinfo->full-path fi)))
+              (file (cvs-fileinfo->full-name fi)))
          (when (or all (eq type 'UNKNOWN))
            (when (file-exists-p file) (delete-file file))
            (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t))))
@@ -2166,7 +2201,7 @@ With prefix argument, prompt for cvs flags."
   (interactive)
   (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile"))))
     (dolist (fi marked)
-      (let ((filename (cvs-fileinfo->full-path fi)))
+      (let ((filename (cvs-fileinfo->full-name fi)))
        (when (string-match "\\.el\\'" filename)
          (byte-compile-file filename))))))
 
@@ -2175,9 +2210,21 @@ With prefix argument, prompt for cvs flags."
 (defun-cvs-mode cvs-mode-add-change-log-entry-other-window ()
   "Add a ChangeLog entry in the ChangeLog of the current directory."
   (interactive)
+  ;; Require `add-log' explicitly, because if it gets autoloaded when we call
+  ;; add-change-log-entry-other-window below, the
+  ;; add-log-buffer-file-name-function ends up unbound when we leave the `let'.
+  (require 'add-log)
   (dolist (fi (cvs-mode-marked nil nil))
     (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
-          (buffer-file-name (expand-file-name (cvs-fileinfo->file fi))))
+          (add-log-buffer-file-name-function
+            (lambda ()
+              (let ((file (expand-file-name (cvs-fileinfo->file fi))))
+                (if (file-directory-p file)
+                    ;; Be careful to use a directory name, otherwise add-log
+                    ;; starts looking for a ChangeLog file in the
+                    ;; parent dir.
+                    (file-name-as-directory file)
+                  file)))))
       (kill-local-variable 'change-log-default-name)
       (save-excursion (add-change-log-entry-other-window)))))
 
@@ -2215,7 +2262,7 @@ With prefix argument, prompt for cvs flags."
       (let* ((args (append constant-args arg-list)))
 
        (insert (format "=== %s %s\n\n"
-                       program (cvs-strings->string args)))
+                       program (split-string-and-unquote args)))
 
        ;; FIXME: return the exit status?
        (apply 'call-process program nil t t args)
@@ -2237,7 +2284,7 @@ this file, or a list of arguments to send to the program."
 \f
 (defun cvs-revert-if-needed (fis)
   (dolist (fileinfo fis)
-    (let* ((file (cvs-fileinfo->full-path fileinfo))
+    (let* ((file (cvs-fileinfo->full-name fileinfo))
           (buffer (find-buffer-visiting file)))
       ;; For a revert to happen the user must be editing the file...
       (unless (or (null buffer)
@@ -2262,7 +2309,7 @@ this file, or a list of arguments to send to the program."
   (interactive "DNew repository: ")
   (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
          (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
-                           " Change cvs-cvsroot anyhow?")))
+                           " Change cvs-cvsroot anyhow? ")))
       (setq cvs-cvsroot newroot)))
 
 ;;;;
@@ -2286,7 +2333,7 @@ Sensible values are `cvs-examine', `cvs-status' and `cvs-quickdir'."
 ;;;###autoload
 (defcustom cvs-dired-use-hook '(4)
   "Whether or not opening a CVS directory should run PCL-CVS.
-nil means never do it.
+A value of nil means never do it.
 ALWAYS means to always do it unless a prefix argument is given to the
   command that prompted the opening of the directory.
 Anything else means to do it only if the prefix arg is equal to this value."