]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-sccs.el
Resurrect the ability to specify a revision in vc-next-action
[gnu-emacs] / lisp / vc / vc-sccs.el
index c7144c0a223916ee92ec23bd73e47832b82af73a..a3facc56d5dd24c9908f509ecf013a08a0fcc0b8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-sccs.el --- support for SCCS version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
@@ -149,13 +149,14 @@ For a description of possible values, see `vc-check-master-templates'."
 
 (defun vc-sccs-working-revision (file)
   "SCCS-specific version of `vc-working-revision'."
-  (with-temp-buffer
-    ;; The working revision is always the latest revision number.
-    ;; To find this number, search the entire delta table,
-    ;; rather than just the first entry, because the
-    ;; first entry might be a deleted ("R") revision.
-    (vc-insert-file (vc-master-name file) "^\001e\n\001[^s]")
-    (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))
+  (when (and (file-regular-p file) (vc-master-name file))
+    (with-temp-buffer
+      ;; The working revision is always the latest revision number.
+      ;; To find this number, search the entire delta table,
+      ;; rather than just the first entry, because the
+      ;; first entry might be a deleted ("R") revision.
+      (vc-insert-file (vc-master-name file) "^\001e\n\001[^s]")
+      (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))))
 
 ;; Cf vc-sccs-find-revision.
 (defun vc-sccs-write-revision (file outfile &optional rev)
@@ -195,12 +196,10 @@ Optional string REV is a revision."
 
 (defun vc-sccs-register (files &optional comment)
   "Register FILES into the SCCS version-control system.
+Automatically retrieve a read-only version of the files with keywords expanded.
 COMMENT can be used to provide an initial description of FILES.
 Passes either `vc-sccs-register-switches' or `vc-register-switches'
-to the SCCS command.
-
-Automatically retrieve a read-only version of the files with keywords
-expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
+to the SCCS command."
   (dolist (file files)
     (let* ((dirname (or (file-name-directory file) ""))
           (basename (file-name-nondirectory file))
@@ -214,8 +213,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
               (and comment (concat "-y" comment))
               (vc-switches 'SCCS 'register)))
       (delete-file file)
-      (if vc-keep-workfiles
-         (vc-sccs-do-command nil 0 "get" (vc-master-name file))))))
+      (vc-sccs-do-command nil 0 "get" (vc-master-name file)))))
 
 (defun vc-sccs-responsible-p (file)
   "Return non-nil if SCCS thinks it would be responsible for registering FILE."
@@ -224,14 +222,14 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
       (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
                                           (file-name-nondirectory file)))))
 
-(defun vc-sccs-checkin (files comment)
+(defun vc-sccs-checkin (files comment &optional rev)
   "SCCS-specific version of `vc-backend-checkin'."
   (dolist (file (vc-expand-dirs files 'SCCS))
     (apply 'vc-sccs-do-command nil 0 "delta" (vc-master-name file)
+           (if rev (concat "-r" rev))
           (concat "-y" comment)
           (vc-switches 'SCCS 'checkin))
-    (if vc-keep-workfiles
-       (vc-sccs-do-command nil 0 "get" (vc-master-name file)))))
+       (vc-sccs-do-command nil 0 "get" (vc-master-name file))))
 
 (defun vc-sccs-find-revision (file rev buffer)
   (apply 'vc-sccs-do-command
@@ -275,22 +273,6 @@ locked.  REV is the revision to check out."
                   switches))))
       (message "Checking out %s...done" file))))
 
-(defun vc-sccs-rollback (files)
-  "Roll back, undoing the most recent checkins of FILES.  Directories
-are expanded to all version-controlled subfiles."
-  (setq files (vc-expand-dirs files 'SCCS))
-  (if (not files)
-      (error "SCCS backend doesn't support directory-level rollback"))
-  (dolist (file files)
-         (let ((discard (vc-working-revision file)))
-           (if (null (yes-or-no-p (format "Remove version %s from %s history? "
-                                          discard file)))
-               (error "Aborted"))
-           (message "Removing revision %s from %s..." discard file)
-           (vc-sccs-do-command nil 0 "rmdel"
-                                (vc-master-name file) (concat "-r" discard))
-           (vc-sccs-do-command nil 0 "get" (vc-master-name file) nil))))
-
 (defun vc-sccs-revert (file &optional _contents-done)
   "Revert FILE to the version it was based on. If FILE is a directory,
 revert all subfiles."
@@ -336,7 +318,7 @@ Remaining arguments are ignored."
 (defvar w32-quote-process-args)
 
 ;; FIXME use sccsdiff if present?
-(defun vc-sccs-diff (files &optional _async oldvers newvers buffer)
+(defun vc-sccs-diff (files &optional oldvers newvers buffer _async)
   "Get a difference report using SCCS between two filesets."
   (setq files (vc-expand-dirs files 'SCCS))
   (setq oldvers (vc-sccs-lookup-triple (car files) oldvers))