GNU bug report logs -
#50340
Fix remote-location in vc-git-log-incoming
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 2 Sep 2021 16:18:02 UTC
Severity: normal
Tags: patch
Fixed in version 29.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50340 in the body.
You can then email your comments to 50340 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Thu, 02 Sep 2021 16:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 02 Sep 2021 16:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
[vc-git-log-incoming-remote-location.patch (text/x-diff, inline)]
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"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Thu, 02 Sep 2021 23:30:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 50340 <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Fri, 03 Sep 2021 08:20:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 50340 <at> debbugs.gnu.org (full text, mbox):
>> - (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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Sat, 04 Sep 2021 01:51:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 50340 <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Sun, 05 Sep 2021 16:42:04 GMT)
Full text and
rfc822 format available.
Message #17 received at 50340 <at> debbugs.gnu.org (full text, mbox):
>>>> - (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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Sun, 05 Sep 2021 19:29:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 50340 <at> debbugs.gnu.org (full text, mbox):
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?
Added tag(s) moreinfo.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Tue, 21 Sep 2021 15:47:07 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Tue, 19 Oct 2021 18:57:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 50340 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Tue, 19 Oct 2021 19:20:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 50340 <at> debbugs.gnu.org (full text, mbox):
> 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.
Removed tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 18 Nov 2021 10:48:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Fri, 23 Sep 2022 15:58:02 GMT)
Full text and
rfc822 format available.
Message #33 received at 50340 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>>> 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:
[remote-location.patch (text/x-diff, inline)]
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"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50340
; Package
emacs
.
(Sun, 02 Oct 2022 18:37:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 50340 <at> debbugs.gnu.org (full text, mbox):
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.
bug marked as fixed in version 29.0.50, send any further explanations to
50340 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Sun, 02 Oct 2022 18:37:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 31 Oct 2022 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.