changeset 85495:a67741d41dc7

Restore vc-next-action functionality of registering files.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Sat, 20 Oct 2007 20:59:36 +0000
parents d045b8090f51
children faeaedde80db
files lisp/vc.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Sat Oct 20 20:21:42 2007 +0000
+++ b/lisp/vc.el	Sat Oct 20 20:59:36 2007 +0000
@@ -1244,7 +1244,7 @@
        node (lambda (f) (if (vc-backend f) (push f flattened)))))
     (nreverse flattened)))
 
-(defun vc-deduce-fileset (&optional allow-directory-wildcard)
+(defun vc-deduce-fileset (&optional allow-directory-wildcard allow-unregistered)
   "Deduce a set of files and a backend to which to apply an operation.
 
 If we're in VC-dired mode, the fileset is the list of marked files.
@@ -1252,6 +1252,8 @@
 the fileset is a singleton containing this file.
 If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on
 and we're in a dired buffer, select the current directory.
+If none of these conditions is met, but ALLOW_UNREGISTERED is in and the
+visited file is not registered, return a singletin fileset containing it.
 Otherwise, throw an error."
   (cond (vc-dired-mode
 	 (let ((marked (dired-map-over-marks (dired-get-filename) nil)))
@@ -1284,6 +1286,8 @@
 	   (message "All version-controlled files below %s selected."
 		    default-directory)
 	   (list default-directory)))
+	((and allow-unregistered (not (vc-registered buffer-file-name))) 
+	 (list buffer-file-name))
 	(t (error "No fileset is available here."))))
 
 (defun vc-ensure-vc-buffer ()
@@ -1369,7 +1373,7 @@
    If the repository file is changed, you are asked if you want to
 merge in the changes into your working copy."
   (interactive "P")
-  (let* ((files (vc-deduce-fileset))
+  (let* ((files (vc-deduce-fileset nil t))
 	 (state (vc-state (car files)))
 	 (model (vc-checkout-model (car files)))
 	 revision)