]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-rcs.el
(ucs-names): New internal variable.
[gnu-emacs] / lisp / vc-rcs.el
index 1125dae044dec17313fc671daea3a2665bf5afb7..06e06c503f343881cd156b712089821337a67985 100644 (file)
@@ -155,7 +155,8 @@ For a description of possible values, see `vc-check-master-templates'."
           ;; permissions can tell us whether locking is used for
           ;; the file or not.
           (if (and (eq state 'up-to-date)
-                   (not (vc-mistrust-permissions file)))
+                   (not (vc-mistrust-permissions file))
+                   (file-exists-p file))
               (cond
                ((string-match ".rw..-..-." (nth 8 (file-attributes file)))
                 (vc-file-setprop file 'vc-checkout-model 'implicit)
@@ -170,10 +171,10 @@ For a description of possible values, see `vc-check-master-templates'."
           (let* ((attributes  (file-attributes file 'string))
                  (owner-name  (nth 2 attributes))
                  (permissions (nth 8 attributes)))
-            (cond ((string-match ".r-..-..-." permissions)
+            (cond ((and permissions (string-match ".r-..-..-." permissions))
                    (vc-file-setprop file 'vc-checkout-model 'locking)
                    'up-to-date)
-                  ((string-match ".rw..-..-." permissions)
+                  ((and permissions (string-match ".rw..-..-." permissions))
                   (if (eq (vc-rcs-checkout-model file) 'locking)
                       (if (file-ownership-preserved-p file)
                           'edited
@@ -188,14 +189,21 @@ For a description of possible values, see `vc-check-master-templates'."
         (vc-rcs-state file)))))
 
 (defun vc-rcs-dir-status (dir update-function)
-  ;; Doing individual vc-state calls is painful but tgere
-  ;; is no better way in RCS-land. 
+  ;; FIXME: this function should be rewritten or `vc-expand-dirs'
+  ;; should be changed to take a backend parameter.  Using
+  ;; `vc-expand-dirs' is not TRTD because it returns files from
+  ;; multiple backends.  It should also return 'unregistered files.
+
+  ;; Doing individual vc-state calls is painful but there
+  ;; is no better way in RCS-land.
   (let ((flist (vc-expand-dirs (list dir)))
        (result nil))
     (dolist (file flist)
       (let ((state (vc-state file))
            (frel (file-relative-name file)))
-       (push (list frel state) result)))
+       (when (and (eq (vc-backend file) 'RCS)
+                  (not (eq state 'up-to-date)))
+         (push (list frel state) result))))
     (funcall update-function result)))
 
 (defun vc-rcs-working-revision (file)
@@ -229,12 +237,12 @@ When VERSION is given, perform check for that version."
   ;; do a double take and remember the fact for the future
   (let* ((version (concat "-r" (vc-working-revision file)))
          (status (if (eq vc-rcsdiff-knows-brief 'no)
-                     (vc-do-command nil 1 "rcsdiff" file version)
-                   (vc-do-command nil 2 "rcsdiff" file "--brief" version))))
+                     (vc-do-command "*vc*" 1 "rcsdiff" file version)
+                   (vc-do-command "*vc*" 2 "rcsdiff" file "--brief" version))))
     (if (eq status 2)
         (if (not vc-rcsdiff-knows-brief)
             (setq vc-rcsdiff-knows-brief 'no
-                  status (vc-do-command nil 1 "rcsdiff" file version))
+                  status (vc-do-command "*vc*" 1 "rcsdiff" file version))
           (error "rcsdiff failed"))
       (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes)))
     ;; The workfile is unchanged if rcsdiff found no differences.
@@ -277,7 +285,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
                                 nil ".*,v$" t))
           (yes-or-no-p "Create RCS subdirectory? ")
           (make-directory subdir))
-      (apply 'vc-do-command nil 0 "ci" file
+      (apply 'vc-do-command "*vc*" 0 "ci" file
             ;; if available, use the secure registering option
             (and (vc-rcs-release-p "5.6.4") "-i")
             (concat (if vc-keep-workfiles "-u" "-r") rev)
@@ -355,7 +363,7 @@ whether to remove it."
             (setq switches (cons "-f" switches)))
        (if (and (not rev) old-version)
            (setq rev (vc-branch-part old-version)))
-       (apply 'vc-do-command nil 0 "ci" (vc-name file)
+       (apply 'vc-do-command "*vc*" 0 "ci" (vc-name file)
               ;; if available, use the secure check-in option
               (and (vc-rcs-release-p "5.6.4") "-j")
               (concat (if vc-keep-workfiles "-u" "-r") rev)
@@ -387,18 +395,18 @@ whether to remove it."
          (if (not (vc-rcs-release-p "5.6.2"))
              ;; exit status of 1 is also accepted.
              ;; It means that the lock was removed before.
-             (vc-do-command nil 1 "rcs" (vc-name file)
+             (vc-do-command "*vc*" 1 "rcs" (vc-name file)
                             (concat "-u" old-version)))))))))
 
 (defun vc-rcs-find-revision (file rev buffer)
   (apply 'vc-do-command
-        buffer 0 "co" (vc-name file)
+        (or buffer "*vc*") 0 "co" (vc-name file)
         "-q" ;; suppress diagnostic output
         (concat "-p" rev)
         (vc-switches 'RCS 'checkout)))
 
 (defun vc-rcs-checkout (file &optional editable rev)
-  "Retrieve a copy of a saved version of FILE. If FILE is a directory, 
+  "Retrieve a copy of a saved version of FILE. If FILE is a directory,
 attempt the checkout for all registered files beneath it."
   (if (file-directory-p file)
       (mapc 'vc-rcs-checkout (vc-expand-dirs (list file)))
@@ -424,7 +432,7 @@ attempt the checkout for all registered files beneath it."
                   (vc-rcs-set-default-branch file nil))
              ;; now do the checkout
              (apply 'vc-do-command
-                    nil 0 "co" (vc-name file)
+                    "*vc*" 0 "co" (vc-name file)
                     ;; If locking is not strict, force to overwrite
                     ;; the writable workfile.
                     (if (eq (vc-rcs-checkout-model (list file)) 'implicit) "-f")
@@ -464,7 +472,7 @@ attempt the checkout for all registered files beneath it."
        (message "Checking out %s...done" file))))))
 
 (defun vc-rcs-rollback (files)
-  "Roll back, undoing the most recent checkins of FILES.  Directories are 
+  "Roll back, undoing the most recent checkins of FILES.  Directories are
 expanded to all regidtered subfuiles in them."
   (if (not files)
       (error "RCS backend doesn't support directory-level rollback."))
@@ -477,7 +485,7 @@ expanded to all regidtered subfuiles in them."
                                           discard file)))
                (error "Aborted"))
            (message "Removing revision %s from %s." discard file)
-           (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" discard))
+           (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-o" discard))
            ;; Check out the most recent remaining version.  If it
            ;; fails, because the whole branch got deleted, do a
            ;; double-take and check out the version where the branch
@@ -485,7 +493,7 @@ expanded to all regidtered subfuiles in them."
            (while (not done)
              (condition-case err
                  (progn
-                   (vc-do-command nil 0 "co" (vc-name file) "-f"
+                   (vc-do-command "*vc*" 0 "co" (vc-name file) "-f"
                                   (concat "-u" previous))
                    (setq done t))
                (error (set-buffer "*vc*")
@@ -501,18 +509,18 @@ expanded to all regidtered subfuiles in them."
                         (signal (car err) (cdr err)))))))))
 
 (defun vc-rcs-revert (file &optional contents-done)
-  "Revert FILE to the version it was based on.  If FILE is a directory, 
+  "Revert FILE to the version it was based on.  If FILE is a directory,
 revert all registered files beneath it."
   (if (file-directory-p file)
       (mapc 'vc-rcs-revert (vc-expand-dirs (list file)))
-    (vc-do-command nil 0 "co" (vc-name file) "-f"
+    (vc-do-command "*vc*" 0 "co" (vc-name file) "-f"
                   (concat (if (eq (vc-state file) 'edited) "-u" "-r")
                           (vc-working-revision file)))))
 
 (defun vc-rcs-merge (file first-version &optional second-version)
   "Merge changes into current working copy of FILE.
 The changes are between FIRST-VERSION and SECOND-VERSION."
-  (vc-do-command nil 1 "rcsmerge" (vc-name file)
+  (vc-do-command "*vc*" 1 "rcsmerge" (vc-name file)
                 "-kk"                  ; ignore keyword conflicts
                 (concat "-r" first-version)
                 (if second-version (concat "-r" second-version))))
@@ -523,16 +531,16 @@ If FUILEis a directory, steal the lock on all registered files beneath it.
 Needs RCS 5.6.2 or later for -M."
   (if (file-directory-p file)
       (mapc 'vc-rcs-steal-lock (vc-expand-dirs (list file)))
-    (vc-do-command nil 0 "rcs" (vc-name file) "-M" (concat "-u" rev))
+    (vc-do-command "*vc*" 0 "rcs" (vc-name file) "-M" (concat "-u" rev))
     ;; Do a real checkout after stealing the lock, so that we see
     ;; expanded headers.
-    (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev))))
+    (vc-do-command "*vc*" 0 "co" (vc-name file) "-f" (concat "-l" rev))))
 
 (defun vc-rcs-modify-change-comment (files rev comment)
   "Modify the change comments change on FILES on a specified REV.  If FILE is a
 directory the operation is applied to all registered files beneath it."
   (dolist (file (vc-expand-dirs files))
-    (vc-do-command nil 0 "rcs" (vc-name file)
+    (vc-do-command "*vc*" 0 "rcs" (vc-name file)
                   (concat "-m" rev ":" comment))))
 
 \f
@@ -543,7 +551,7 @@ directory the operation is applied to all registered files beneath it."
 (defun vc-rcs-print-log (files &optional buffer)
   "Get change log associated with FILE.  If FILE is a
 directory the operation is applied to all registered files beneath it."
-  (vc-do-command buffer 0 "rlog" (mapcar 'vc-name (vc-expand-dirs files))))
+  (vc-do-command (or buffer "*vc*") 0 "rlog" (mapcar 'vc-name (vc-expand-dirs files))))
 
 (defun vc-rcs-diff (files &optional oldvers newvers buffer)
   "Get a difference report using RCS between two sets of files."
@@ -761,6 +769,8 @@ Optional arg REVISION is a revision to annotate from."
       (insert (gethash (get-text-property (point) :vc-rcs-r/d/a) ht))
       (forward-line 1))))
 
+(declare-function vc-annotate-convert-time "vc-annotate" (time))
+
 (defun vc-rcs-annotate-current-time ()
   "Return the current time, based at midnight of the current day, and
 encoded as fractional days."
@@ -780,12 +790,19 @@ systime, or nil if there is none.  Also, reposition point."
 
 \f
 ;;;
-;;; Snapshot system
+;;; Tag system
 ;;;
 
-(defun vc-rcs-assign-name (file name)
-  "Assign to FILE's latest version a given NAME."
-  (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":")))
+(defun vc-rcs-create-tag (backend dir name branchp)
+  (when branchp
+    (error "RCS backend %s does not support module branches" backend))
+  (let ((result (vc-tag-precondition dir)))
+    (if (stringp result)
+       (error "File %s is not up-to-date" result)
+      (vc-file-tree-walk
+       dir
+       (lambda (f)
+        (vc-do-command "*vc*" 0 "rcs" (vc-name f) (concat "-n" name ":")))))))
 
 \f
 ;;;
@@ -1056,18 +1073,18 @@ If the user has not set variable `vc-rcs-release' and it is nil,
 variable `vc-rcs-release' is set to the returned value."
   (or vc-rcs-release
       (setq vc-rcs-release
-           (or (and (zerop (vc-do-command nil nil "rcs" nil "-V"))
+           (or (and (zerop (vc-do-command "*vc*" nil "rcs" nil "-V"))
                     (with-current-buffer (get-buffer "*vc*")
                       (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1)))
                'unknown))))
 
 (defun vc-rcs-set-non-strict-locking (file)
-  (vc-do-command nil 0 "rcs" file "-U")
+  (vc-do-command "*vc*" 0 "rcs" file "-U")
   (vc-file-setprop file 'vc-checkout-model 'implicit)
   (set-file-modes file (logior (file-modes file) 128)))
 
 (defun vc-rcs-set-default-branch (file branch)
-  (vc-do-command nil 0 "rcs" (vc-name file) (concat "-b" branch))
+  (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-b" branch))
   (vc-file-setprop file 'vc-rcs-default-branch branch))
 
 (defun vc-rcs-parse (&optional buffer)