From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50340: Fix remote-location in vc-git-log-incoming Date: Fri, 23 Sep 2022 18:52:50 +0300 Organization: LINKOV.NET Message-ID: <86o7v6bcd1.fsf@mail.linkov.net> References: <87k0jz9clq.fsf@mail.linkov.net> <87o89aaxhj.fsf@mail.linkov.net> <63fb440c-a393-541d-2f92-fe28130c899e@yandex.ru> <875yvfurkp.fsf@mail.linkov.net> <0073fec5-a6f7-1108-02ee-ab9d9ba38d33@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5194"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 50340@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 23 17:58:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obl4A-00017D-TX for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Sep 2022 17:58:15 +0200 Original-Received: from localhost ([::1]:58414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obl4A-0007T6-0F for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Sep 2022 11:58:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obl3y-0007OA-UV for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 11:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obl3y-0000KZ-M1 for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 11:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obl3y-00062h-7u for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 11:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Sep 2022 15:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50340 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 50340-submit@debbugs.gnu.org id=B50340.166394864323179 (code B ref 50340); Fri, 23 Sep 2022 15:58:02 +0000 Original-Received: (at 50340) by debbugs.gnu.org; 23 Sep 2022 15:57:23 +0000 Original-Received: from localhost ([127.0.0.1]:41486 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obl3K-00061m-M9 for submit@debbugs.gnu.org; Fri, 23 Sep 2022 11:57:23 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:36081) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obl3I-00061M-2f for 50340@debbugs.gnu.org; Fri, 23 Sep 2022 11:57:20 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 02695240011; Fri, 23 Sep 2022 15:57:10 +0000 (UTC) In-Reply-To: <0073fec5-a6f7-1108-02ee-ab9d9ba38d33@yandex.ru> (Dmitry Gutov's message of "Sun, 5 Sep 2021 22:28:39 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243475 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit >>> With your patch, I can pass some alternative upstream to the command, and >>> it fails at the end with something like: >>> >>> fatal: ambiguous argument 'HEAD..upstream': unknown revision or path not in >>> the working tree. >>> Use '--' to separate paths from revisions, like this: >>> 'git [...] -- [...]' >> But this means that my fix worked, because in vc-git-log-incoming >> I fixed the first command `git fetch`, but it fails in your case >> in the second command `git log HEAD..upstream`. > > If it works for you, go ahead. I just couldn't make the command work > (patched or not) with either of the projects I tried it on. Sorry for the delay, it took some time to realize that 'remote-location' in vc-log-incoming/outgoing is not a remote repository, but a remote branch name. In my tests remote repository and remote branch had the same name, so tests didn't fail when used remote repository names as remote branch names. The problem is that (info "(emacs) VC Change Log") contains wrong information: with a prefix argument, ‘vc-log-incoming’ prompts for a specific repository. Similarly, ‘C-x v O’ (‘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. A prefix argument reads not a repository, but a branch name. This patch fixes both problems: in vc-git-log-outgoing and in the documentation by using the same term 'remote-location' as the argument name in vc-log-incoming/outgoing: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=remote-location.patch diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 6ceda6d7a5..6857e67def 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1041,13 +1041,14 @@ VC Change Log (@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.el b/lisp/vc/vc.el index a45e0e0c52..e039095255 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2772,7 +2772,8 @@ vc-print-branch-log ;;;###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): ")))) @@ -2785,7 +2786,8 @@ vc-log-incoming ;;;###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): ")))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 2228cf8665..70505d0fbf 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1291,7 +1308,12 @@ vc-git-log-outgoing (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" --=-=-=--