diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ca4c66a06d..3b977aa1f4 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1160,7 +1159,9 @@ vc-git-print-log (list (concat start-revision ".." (if (equal limit "") "HEAD" limit))) - (list start-revision))) + (if (eq limit 1) + (list "-p" start-revision) + (list start-revision)))) '("--"))))))) (defun vc-git-log-outgoing (buffer remote-location) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d29c80d02..90603541b5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2475,13 +2475,26 @@ vc-print-log (vc-print-log-internal backend files working-revision nil limit))) ;;;###autoload -(defun vc-print-root-log (&optional limit) +(defun vc-print-root-log (&optional limit revision) "List the change log for the current VC controlled tree in a window. If LIMIT is non-nil, it should be a number specifying the maximum number of revisions to show; the default is `vc-log-show-limit'. -When called interactively with a prefix argument, prompt for LIMIT." +When called interactively with a prefix argument, prompt for LIMIT. +When the prefix argument is a number, use it as LIMIT. +A special case is when the prefix argument is 1, in this case +it asks for the revision and shows it with its diff." (interactive (cond + ((eq current-prefix-arg 1) + (let* ((default (thing-at-point 'word)) + (revision (vc-read-revision + (if default + (format "Revision to show (default %s): " default) + "Revision to show: ") + nil nil default))) + (list 1 revision))) + ((numberp current-prefix-arg) + (list current-prefix-arg)) (current-prefix-arg (let ((lim (string-to-number (read-from-minibuffer @@ -2494,6 +2507,8 @@ vc-print-root-log (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) (let ((backend (vc-deduce-backend)) (default-directory default-directory) + (vc-log-short-style (unless (and (eq limit 1) revision) + vc-log-short-style)) rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) @@ -2502,7 +2517,9 @@ vc-print-root-log (unless backend (error "Directory is not version controlled"))) (setq default-directory rootdir) - (vc-print-log-internal backend (list rootdir) nil nil limit))) + (vc-print-log-internal backend (list rootdir) revision revision limit) + (when (and (eq limit 1) revision) + (vc-git-region-history-mode)))) ;;;###autoload (defun vc-print-branch-log (branch)