* bug#50340: Fix remote-location in vc-git-log-incoming @ 2021-09-02 16:16 Juri Linkov 2021-09-02 23:29 ` Dmitry Gutov 0 siblings, 1 reply; 10+ messages in thread From: Juri Linkov @ 2021-09-02 16:16 UTC (permalink / raw) To: 50340 [-- Attachment #1: Type: text/plain, Size: 13 bytes --] Tags: patch [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: vc-git-log-incoming-remote-location.patch --] [-- Type: text/x-diff, Size: 480 bytes --] diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index a9856ee40d..2ed5bdffcd 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1218,7 +1218,8 @@ 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)) (vc-git-command buffer 'async nil "log" ^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-02 16:16 bug#50340: Fix remote-location in vc-git-log-incoming Juri Linkov @ 2021-09-02 23:29 ` Dmitry Gutov 2021-09-03 8:12 ` Juri Linkov 0 siblings, 1 reply; 10+ messages in thread From: Dmitry Gutov @ 2021-09-02 23:29 UTC (permalink / raw) To: Juri Linkov, 50340 On 02.09.2021 19:16, Juri Linkov wrote: > - (vc-git-command nil 0 nil "fetch") > + (vc-git-command nil 0 nil "fetch" (unless (string= remote-location "") > + remote-location)) I'm not sure which scenario this fixes (pressing RET after 'C-u C-x v I' works fine here), but it shouldn't hurt either. So if you have a stable repro (some alternative completing-read-function?), you can go ahead and install. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-02 23:29 ` Dmitry Gutov @ 2021-09-03 8:12 ` Juri Linkov 2021-09-04 1:50 ` Dmitry Gutov 0 siblings, 1 reply; 10+ messages in thread From: Juri Linkov @ 2021-09-03 8:12 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 50340 >> - (vc-git-command nil 0 nil "fetch") >> + (vc-git-command nil 0 nil "fetch" (unless (string= remote-location "") >> + remote-location)) > > I'm not sure which scenario this fixes (pressing RET after 'C-u C-x v I' > works fine here), but it shouldn't hurt either. It fixes the scenario with a non-default remote. Could you try 'C-u C-x v I' and typing the name of a non-default remote in a repo with two remotes? I wonder if it already worked, and maybe I have some misconfiguration. > So if you have a stable repro (some alternative completing-read-function?), > you can go ahead and install. Regarding the default completing-read-function, the prompt of 'C-u C-x v I' doesn't provide completion on remote names. Maybe this should be improved as well. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-03 8:12 ` Juri Linkov @ 2021-09-04 1:50 ` Dmitry Gutov 2021-09-05 16:36 ` Juri Linkov 0 siblings, 1 reply; 10+ messages in thread From: Dmitry Gutov @ 2021-09-04 1:50 UTC (permalink / raw) To: Juri Linkov; +Cc: 50340 On 03.09.2021 11:12, Juri Linkov wrote: >>> - (vc-git-command nil 0 nil "fetch") >>> + (vc-git-command nil 0 nil "fetch" (unless (string= remote-location "") >>> + remote-location)) >> >> I'm not sure which scenario this fixes (pressing RET after 'C-u C-x v I' >> works fine here), but it shouldn't hurt either. > > It fixes the scenario with a non-default remote. Could you try 'C-u C-x v I' > and typing the name of a non-default remote in a repo with two remotes? > I wonder if it already worked, and maybe I have some misconfiguration. Ah, I see what you are referring to. But does the feature work then? 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 <command> [<revision>...] -- [<file>...]' >> So if you have a stable repro (some alternative completing-read-function?), >> you can go ahead and install. > > Regarding the default completing-read-function, the prompt of 'C-u C-x v I' > doesn't provide completion on remote names. Maybe this should be improved > as well. I guess some new backend action ('remote-locations'?) could help with that. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-04 1:50 ` Dmitry Gutov @ 2021-09-05 16:36 ` Juri Linkov 2021-09-05 19:28 ` Dmitry Gutov 2021-10-19 18:56 ` Lars Ingebrigtsen 0 siblings, 2 replies; 10+ messages in thread From: Juri Linkov @ 2021-09-05 16:36 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 50340 >>>> - (vc-git-command nil 0 nil "fetch") >>>> + (vc-git-command nil 0 nil "fetch" (unless (string= remote-location "") >>>> + remote-location)) >>> >>> I'm not sure which scenario this fixes (pressing RET after 'C-u C-x v I' >>> works fine here), but it shouldn't hurt either. >> It fixes the scenario with a non-default remote. Could you try 'C-u C-x v I' >> and typing the name of a non-default remote in a repo with two remotes? >> I wonder if it already worked, and maybe I have some misconfiguration. > > Ah, I see what you are referring to. > > But does the feature work then? > > 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 <command> [<revision>...] -- [<file>...]' 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`. >>> So if you have a stable repro (some alternative completing-read-function?), >>> you can go ahead and install. >> Regarding the default completing-read-function, the prompt of 'C-u C-x v I' >> doesn't provide completion on remote names. Maybe this should be improved >> as well. > > I guess some new backend action ('remote-locations'?) could help with that. Would be nice. Maybe just 'vc-read-revision' can be used, but by removing branch names after the slash in "upstream/branch", then uniquify remaining upstream names. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-05 16:36 ` Juri Linkov @ 2021-09-05 19:28 ` Dmitry Gutov 2022-09-23 15:52 ` Juri Linkov 2021-10-19 18:56 ` Lars Ingebrigtsen 1 sibling, 1 reply; 10+ messages in thread From: Dmitry Gutov @ 2021-09-05 19:28 UTC (permalink / raw) To: Juri Linkov; +Cc: 50340 On 05.09.2021 19:36, Juri Linkov wrote: >> Ah, I see what you are referring to. >> >> But does the feature work then? >> >> 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 <command> [<revision>...] -- [<file>...]' > > 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. >>>> So if you have a stable repro (some alternative completing-read-function?), >>>> you can go ahead and install. >>> Regarding the default completing-read-function, the prompt of 'C-u C-x v I' >>> doesn't provide completion on remote names. Maybe this should be improved >>> as well. >> >> I guess some new backend action ('remote-locations'?) could help with that. > > Would be nice. Maybe just 'vc-read-revision' can be used, > but by removing branch names after the slash in "upstream/branch", > then uniquify remaining upstream names. I'm not sure. This should work for every backend where log-outgoing and log-incoming work, right? Do remotes feature in branch names the same way in Git, Hg and Bzr? ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-05 19:28 ` Dmitry Gutov @ 2022-09-23 15:52 ` Juri Linkov 2022-10-02 18:35 ` Juri Linkov 0 siblings, 1 reply; 10+ messages in thread From: Juri Linkov @ 2022-09-23 15:52 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 50340 [-- Attachment #1: Type: text/plain, Size: 1591 bytes --] >>> 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 <command> [<revision>...] -- [<file>...]' >> 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: [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: remote-location.patch --] [-- Type: text/x-diff, Size: 3162 bytes --] 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" ^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2022-09-23 15:52 ` Juri Linkov @ 2022-10-02 18:35 ` Juri Linkov 0 siblings, 0 replies; 10+ messages in thread From: Juri Linkov @ 2022-10-02 18:35 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 50340 close 50340 29.0.50 thanks >> 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. > > 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: So I pushed to master and closed. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-09-05 16:36 ` Juri Linkov 2021-09-05 19:28 ` Dmitry Gutov @ 2021-10-19 18:56 ` Lars Ingebrigtsen 2021-10-19 19:16 ` Juri Linkov 1 sibling, 1 reply; 10+ messages in thread From: Lars Ingebrigtsen @ 2021-10-19 18:56 UTC (permalink / raw) To: Juri Linkov; +Cc: 50340, Dmitry Gutov Juri Linkov <juri@linkov.net> writes: >> 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. [...] > I'm not sure. This should work for every backend where log-outgoing > and log-incoming work, right? > > Do remotes feature in branch names the same way in Git, Hg and Bzr? This was a month ago, and skimming it, it wasn't clear to me what the status here was -- whether this should be worked more on, or whether Juri's fix should be pushed. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#50340: Fix remote-location in vc-git-log-incoming 2021-10-19 18:56 ` Lars Ingebrigtsen @ 2021-10-19 19:16 ` Juri Linkov 0 siblings, 0 replies; 10+ messages in thread From: Juri Linkov @ 2021-10-19 19:16 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 50340, Dmitry Gutov > This was a month ago, and skimming it, it wasn't clear to me what the > status here was -- whether this should be worked more on, or whether > Juri's fix should be pushed. This requires more design decisions that could be implemented for Emacs 29 together with more vc features like new branch commands, in other feature requests, diff-goto-line, etc. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-10-02 18:35 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-02 16:16 bug#50340: Fix remote-location in vc-git-log-incoming Juri Linkov 2021-09-02 23:29 ` Dmitry Gutov 2021-09-03 8:12 ` Juri Linkov 2021-09-04 1:50 ` Dmitry Gutov 2021-09-05 16:36 ` Juri Linkov 2021-09-05 19:28 ` Dmitry Gutov 2022-09-23 15:52 ` Juri Linkov 2022-10-02 18:35 ` Juri Linkov 2021-10-19 18:56 ` Lars Ingebrigtsen 2021-10-19 19:16 ` Juri Linkov
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.