In C-x v L and C-x v D, prompt for directory if there is no default backend.

* lisp/vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a
directory if vc-deduce-backend returns nil.

Fixes: debbugs:7350
This commit is contained in:
Chong Yidong 2012-07-28 22:18:51 +08:00
parent 69c3b839f8
commit 1eee634131
2 changed files with 19 additions and 6 deletions

View file

@ -12,6 +12,9 @@
2012-07-28 Chong Yidong <cyd@gnu.org>
* vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a
directory if vc-deduce-backend returns nil (Bug#7350).
* simple.el (delete-trailing-lines): New option.
(delete-trailing-whitespace): Obey it (Bug#11879).

View file

@ -1757,10 +1757,15 @@ saving the buffer."
(call-interactively 'vc-version-diff)
(when buffer-file-name (vc-buffer-sync not-urgent))
(let ((backend (vc-deduce-backend))
(default-directory default-directory)
rootdir working-revision)
(unless backend
(error "Buffer is not version controlled"))
(setq rootdir (vc-call-backend backend 'root default-directory))
(if backend
(setq rootdir (vc-call-backend backend 'root default-directory))
(setq rootdir (read-directory-name "Directory for VC root-diff: "))
(setq backend (vc-responsible-backend rootdir))
(if backend
(setq default-directory rootdir)
(error "Directory is not version controlled")))
(setq working-revision (vc-working-revision rootdir))
;; VC diff for the root directory produces output that is
;; relative to it. Bind default-directory to the root directory
@ -2213,10 +2218,15 @@ When called interactively with a prefix argument, prompt for LIMIT."
(t
(list (when (> vc-log-show-limit 0) vc-log-show-limit)))))
(let ((backend (vc-deduce-backend))
(default-directory default-directory)
rootdir working-revision)
(unless backend
(error "Buffer is not version controlled"))
(setq rootdir (vc-call-backend backend 'root default-directory))
(if backend
(setq rootdir (vc-call-backend backend 'root default-directory))
(setq rootdir (read-directory-name "Directory for VC root-log: "))
(setq backend (vc-responsible-backend rootdir))
(if backend
(setq default-directory rootdir)
(error "Directory is not version controlled")))
(setq working-revision (vc-working-revision rootdir))
(vc-print-log-internal backend (list rootdir) working-revision nil limit)))