From c37fda9e3117c8948ee691c79ccf747d45137d97 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 2 Oct 2022 21:34:57 +0300 Subject: [PATCH] In vc-git-log-incoming use the repository in the command "fetch" (bug#50340) * lisp/vc/vc-git.el (vc-git-log-incoming): Use repository part from non-nil remote-location in the command "fetch". * lisp/vc/vc.el (vc-log-incoming, vc-log-outgoing): Mention in docstrings and prompts that REMOTE-LOCATION can be a remote branch name. * doc/emacs/maintaining.texi (VC Change Log): For commands vc-log-incoming and vc-log-outgoing, use the term "remote location" instead of "repository". --- doc/emacs/maintaining.texi | 9 +++++---- lisp/vc/vc-git.el | 7 ++++++- lisp/vc/vc.el | 10 ++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 6ceda6d7a5c..6857e67def9 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1041,13 +1041,14 @@ revision at point. A second @key{RET} hides it again. (@code{vc-log-incoming}) command displays a log buffer showing the changes that will be applied, the next time you run the version control system's pull command to get new revisions from another -repository (@pxref{Pulling / Pushing}). This other repository is the default +remote location (@pxref{Pulling / Pushing}). This other remote location is the default one from which changes are pulled, as defined by the version control system; with a prefix argument, @code{vc-log-incoming} prompts for a -specific repository. Similarly, @kbd{C-x v O} +specific remote location. Similarly, @kbd{C-x v O} (@code{vc-log-outgoing}) shows the changes that will be sent to -another repository, the next time you run the push command; with a -prefix argument, it prompts for a specific destination repository. +another remote location, the next time you run the push command; with a +prefix argument, it prompts for a specific destination that +in case of some version control system can be a branch name. @cindex VC log buffer, commands in @cindex vc-log buffer diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 87f6a5a37c8..9cc1aee6747 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1322,7 +1322,12 @@ If LIMIT is a revision string, use it as an end-revision." (defun vc-git-log-incoming (buffer remote-location) (vc-setup-buffer buffer) - (vc-git-command nil 0 nil "fetch") + (vc-git-command nil 0 nil "fetch" + (unless (string= remote-location "") + ;; `remote-location' is in format "repository/branch", + ;; so remove everything except a repository name. + (replace-regexp-in-string + "/.*" "" remote-location))) (vc-git-command buffer 'async nil "log" diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 25bb0c848d8..787dd51d073 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2765,10 +2765,11 @@ with its diffs (if the underlying VCS supports that)." ;;;###autoload (defun vc-log-incoming (&optional remote-location) "Show log of changes that will be received with pull from REMOTE-LOCATION. -When called interactively with a prefix argument, prompt for REMOTE-LOCATION." +When called interactively with a prefix argument, prompt for REMOTE-LOCATION. +In some version control systems REMOTE-LOCATION can be a remote branch name." (interactive (when current-prefix-arg - (list (read-string "Remote location (empty for default): ")))) + (list (read-string "Remote location/branch (empty for default): ")))) (let ((backend (vc-deduce-backend))) (unless backend (error "Buffer is not version controlled")) @@ -2778,10 +2779,11 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." ;;;###autoload (defun vc-log-outgoing (&optional remote-location) "Show log of changes that will be sent with a push operation to REMOTE-LOCATION. -When called interactively with a prefix argument, prompt for REMOTE-LOCATION." +When called interactively with a prefix argument, prompt for REMOTE-LOCATION. +In some version control systems REMOTE-LOCATION can be a remote branch name." (interactive (when current-prefix-arg - (list (read-string "Remote location (empty for default): ")))) + (list (read-string "Remote location/branch (empty for default): ")))) (let ((backend (vc-deduce-backend))) (unless backend (error "Buffer is not version controlled")) -- 2.39.2