]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/vc/vc.el (vc-deduce-fileset): Change error message.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 11 Jun 2013 22:14:30 +0000 (18:14 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 11 Jun 2013 22:14:30 +0000 (18:14 -0400)
(vc-read-backend): New function.
(vc-next-action): Use it.

lisp/ChangeLog
lisp/vc/vc.el

index ddb0d0badc2c88df0db398a22466c817d32bfbe0..10d706ad81c54ec4b6407675f77c5d1ba3bd4081 100644 (file)
@@ -1,5 +1,9 @@
 2013-06-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * vc/vc.el (vc-deduce-fileset): Change error message.
+       (vc-read-backend): New function.
+       (vc-next-action): Use it.
+
        * subr.el (function-arity): Remove (mistakenly added) (bug#14590).
 
        * progmodes/prolog.el (prolog-make-keywords-regexp): Remove.
index 5e1d27c0ea336cb7895aab20e1a44c281bba4a95..0308dd1ebd424ec7278e8f8945eda03a1d216fca 100644 (file)
 ;;   Return non-nil if FILE is registered in this backend.  Both this
 ;;   function as well as `state' should be careful to fail gracefully
 ;;   in the event that the backend executable is absent.  It is
-;;   preferable that this function's body is autoloaded, that way only
+;;   preferable that this function's *body* is autoloaded, that way only
 ;;   calling vc-registered does not cause the backend to be loaded
 ;;   (all the vc-FOO-registered functions are called to try to find
-;;   the controlling backend for FILE.
+;;   the controlling backend for FILE).
 ;;
 ;; * state (file)
 ;;
 ;;   The implementation should pass the value of vc-register-switches
 ;;   to the backend command.  (Note: in older versions of VC, this
 ;;   command took a single file argument and not a list.)
+;;   The REV argument is a historical leftover and is never used.
 ;;
 ;; - init-revision (file)
 ;;
@@ -999,7 +1000,7 @@ current buffer."
                nil)
        (list (vc-backend-for-registration (buffer-file-name))
              (list buffer-file-name))))
-     (t (error "No fileset is available here")))))
+     (t (error "File is not under version control")))))
 
 (defun vc-dired-deduce-fileset ()
   (let ((backend (vc-responsible-backend default-directory)))
@@ -1041,6 +1042,11 @@ current buffer."
    (eq p q)
    (and (member p '(edited added removed)) (member q '(edited added removed)))))
 
+(defun vc-read-backend (prompt)
+  (intern
+   (completing-read prompt (mapcar 'symbol-name vc-handled-backends)
+                    nil 'require-match)))
+
 ;; Here's the major entry point.
 
 ;;;###autoload
@@ -1099,8 +1105,9 @@ For old-style locking-based version control systems, like RCS:
      ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update)))
       (cond
        (verbose
-       ;; go to a different revision
+       ;; Go to a different revision.
        (let* ((revision
+                ;; FIXME: Provide completion.
                 (read-string "Branch, revision, or backend to move to: "))
                (revision-downcase (downcase revision)))
          (if (member
@@ -1161,15 +1168,10 @@ For old-style locking-based version control systems, like RCS:
            (message "No files remain to be committed")
          (if (not verbose)
              (vc-checkin ready-for-commit backend)
-           (let* ((revision (read-string "New revision or backend: "))
-                   (revision-downcase (downcase revision)))
-             (if (member
-                  revision-downcase
-                  (mapcar (lambda (arg) (downcase (symbol-name arg)))
-                          vc-handled-backends))
-                 (let ((vsym (intern revision-downcase)))
-                   (dolist (file files) (vc-transfer-file file vsym)))
-               (vc-checkin ready-for-commit backend revision)))))))
+            (let ((new-backend (vc-read-backend "New backend: ")))
+             (if new-backend
+                  (dolist (file files)
+                    (vc-transfer-file file new-backend))))))))
      ;; locked by somebody else (locking VCSes only)
      ((stringp state)
       ;; In the old days, we computed the revision once and used it on