GNU bug report logs -
#60569
29.0.60; vc-pull-and-push unsupported on non-git vcs
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 5 Jan 2023 08:03:02 UTC
Severity: normal
Fixed in version 29.0.60
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 60569 in the body.
You can then email your comments to 60569 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#60569
; Package
emacs
.
(Thu, 05 Jan 2023 08:03: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, 05 Jan 2023 08:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Isn't it so that as a general rule we don't add a vc command
when it's not supported by more than 1 backend?
It seems fine to add a git-specific 'vc-git-pull-and-push',
but why to add 'vc-pull-and-push' supported only by git?
It's more strange that the docstring of 'vc-pull-and-push' says:
"It also signals an error in a Bazaar bound branch."
whereas in fact it's not implemented for Bazaar at all.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Wed, 18 Jan 2023 17:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 60569 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Isn't it so that as a general rule we don't add a vc command
> when it's not supported by more than 1 backend?
>
> It seems fine to add a git-specific 'vc-git-pull-and-push',
> but why to add 'vc-pull-and-push' supported only by git?
>
> It's more strange that the docstring of 'vc-pull-and-push' says:
>
> "It also signals an error in a Bazaar bound branch."
>
> whereas in fact it's not implemented for Bazaar at all.
We can't release this with such uncalled api changes.
So here is the fix:
[vc-pull-and-push.patch (text/x-diff, inline)]
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 412598d084c..ef93edd1616 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1303,25 +1303,6 @@ vc-git-push
for the Git command to run."
(vc-git--pushpull "push" prompt nil))
-(defun vc-git-pull-and-push (prompt)
- "Pull changes into the current Git branch, and then push.
-The push will only be performed if the pull was successful.
-
-Normally, this runs \"git pull\". If PROMPT is non-nil, prompt
-for the Git command to run."
- (let ((proc (vc-git--pushpull "pull" prompt '("--stat"))))
- (when (process-buffer proc)
- (with-current-buffer (process-buffer proc)
- (if (and (eq (process-status proc) 'exit)
- (zerop (process-exit-status proc)))
- (let ((vc--inhibit-async-window t))
- (vc-git-push nil))
- (vc-exec-after
- (lambda ()
- (let ((vc--inhibit-async-window t))
- (vc-git-push nil)))
- proc))))))
-
(defun vc-git-merge-branch ()
"Merge changes into the current Git branch.
This prompts for a branch to merge from."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 13124509c27..0890b63d417 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3071,9 +3071,20 @@ vc-pull-and-push
(interactive "P")
(let* ((vc-fileset (vc-deduce-fileset t))
(backend (car vc-fileset)))
- (if (vc-find-backend-function backend 'pull-and-push)
- (vc-call-backend backend 'pull-and-push arg)
- (user-error "VC pull-and-push is unsupported for `%s'" backend))))
+ (if (vc-find-backend-function backend 'pull)
+ (let ((proc (vc-call-backend backend 'pull arg)))
+ (when (and (processp proc) (process-buffer proc))
+ (with-current-buffer (process-buffer proc)
+ (if (and (eq (process-status proc) 'exit)
+ (zerop (process-exit-status proc)))
+ (let ((vc--inhibit-async-window t))
+ (vc-push arg))
+ (vc-exec-after
+ (lambda ()
+ (let ((vc--inhibit-async-window t))
+ (vc-push arg)))
+ proc)))))
+ (user-error "VC pull is unsupported for `%s'" backend))))
(defun vc-version-backup-file (file &optional rev)
"Return name of backup file for revision REV of FILE.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Fri, 20 Jan 2023 04:04:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 60569 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Thanks for keeping VC generic.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Sun, 22 Jan 2023 02:26:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 60569 <at> debbugs.gnu.org (full text, mbox):
On 18/01/2023 19:39, Juri Linkov wrote:
> We can't release this with such uncalled api changes.
> So here is the fix:
This indeed looks much better, thank you.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Sun, 22 Jan 2023 17:30:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 60569 <at> debbugs.gnu.org (full text, mbox):
close 60569 29.0.60
thanks
>> We can't release this with such uncalled api changes.
>> So here is the fix:
>
> This indeed looks much better, thank you.
This is fixed now since it doesn't affect other vc commands.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Sun, 22 Jan 2023 17:30:03 GMT)
Full text and
rfc822 format available.
Message #20 received at 60569 <at> debbugs.gnu.org (full text, mbox):
> Thanks for keeping VC generic.
Here is a one-line patch that adds support for vc-bzr.
Eli, is it ok to install this on the emacs-29 branch?
I briefly tested it on bzr, so it should be quite safe.
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 6443f6d57aa..404800cb208 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -381,7 +381,8 @@ vc-bzr--pushpull
(setq-local compile-command
(concat vc-bzr-program " " command " "
(if args (mapconcat #'identity args " ") "")))))
- (vc-set-async-update buf))))
+ (vc-set-async-update buf)
+ (get-buffer-process buf))))
(defun vc-bzr-pull (prompt)
"Pull changes into the current Bzr branch.
bug marked as fixed in version 29.0.60, send any further explanations to
60569 <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, 22 Jan 2023 17:30:04 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Mon, 23 Jan 2023 12:01:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 60569 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Date: Sun, 22 Jan 2023 19:28:03 +0200
>
> > Thanks for keeping VC generic.
>
> Here is a one-line patch that adds support for vc-bzr.
>
> Eli, is it ok to install this on the emacs-29 branch?
> I briefly tested it on bzr, so it should be quite safe.
>
> diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
> index 6443f6d57aa..404800cb208 100644
> --- a/lisp/vc/vc-bzr.el
> +++ b/lisp/vc/vc-bzr.el
> @@ -381,7 +381,8 @@ vc-bzr--pushpull
> (setq-local compile-command
> (concat vc-bzr-program " " command " "
> (if args (mapconcat #'identity args " ") "")))))
> - (vc-set-async-update buf))))
> + (vc-set-async-update buf)
> + (get-buffer-process buf))))
Looks OK to me, but could you add some details regarding why this
change is needed? Did we change our requirements from the return
value of the pushpull method? Or did vc-set-async-update change its
behavior and no longer returns the process object? Or something else?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Tue, 24 Jan 2023 17:52:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 60569 <at> debbugs.gnu.org (full text, mbox):
>> > Thanks for keeping VC generic.
>>
>> Here is a one-line patch that adds support for vc-bzr.
>>
>> diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
>> @@ -381,7 +381,8 @@ vc-bzr--pushpull
>> (setq-local compile-command
>> (concat vc-bzr-program " " command " "
>> (if args (mapconcat #'identity args " ") "")))))
>> - (vc-set-async-update buf))))
>> + (vc-set-async-update buf)
>> + (get-buffer-process buf))))
>
> Looks OK to me, but could you add some details regarding why this
> change is needed? Did we change our requirements from the return
> value of the pushpull method?
Yes, to support vc-pull-and-push now the backend should return the
process for the pull operation. Here is the improved documentation:
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 6443f6d57aa..f66e37fffa4 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -381,7 +381,9 @@ vc-bzr--pushpull
(setq-local compile-command
(concat vc-bzr-program " " command " "
(if args (mapconcat #'identity args " ") "")))))
- (vc-set-async-update buf))))
+ (vc-set-async-update buf)
+ ;; Return the process for `vc-pull-and-push'
+ (get-buffer-process buf))))
(defun vc-bzr-pull (prompt)
"Pull changes into the current Bzr branch.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index ef93edd1616..e551a243c80 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1289,6 +1289,7 @@ vc-git--pushpull
(lambda (_name-of-mode) buffer)
nil))))
(vc-set-async-update buffer)
+ ;; Return the process for `vc-pull-and-push'
proc))
(defun vc-git-pull (prompt)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0890b63d417..72160c35f57 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3064,7 +3064,8 @@ vc-pull-and-push
operation on the current branch, prompting for the precise
command if required. Optional prefix ARG non-nil forces a prompt
for the VCS command to run. If this is successful, a \"push\"
-operation will then be done.
+operation will then be done. This is supported only in backends
+where the pull operation returns a process.
On a non-distributed version control system, this signals an error.
It also signals an error in a Bazaar bound branch."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Tue, 24 Jan 2023 18:09:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 60569 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Cc: 60569 <at> debbugs.gnu.org
> Date: Tue, 24 Jan 2023 19:49:24 +0200
>
> > Looks OK to me, but could you add some details regarding why this
> > change is needed? Did we change our requirements from the return
> > value of the pushpull method?
>
> Yes, to support vc-pull-and-push now the backend should return the
> process for the pull operation. Here is the improved documentation:
Thanks, this is okay for the emacs-29 branch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60569
; Package
emacs
.
(Tue, 24 Jan 2023 18:31:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 60569 <at> debbugs.gnu.org (full text, mbox):
close 60569 29.0.60
quit
>> > Looks OK to me, but could you add some details regarding why this
>> > change is needed? Did we change our requirements from the return
>> > value of the pushpull method?
>>
>> Yes, to support vc-pull-and-push now the backend should return the
>> process for the pull operation. Here is the improved documentation:
>
> Thanks, this is okay for the emacs-29 branch.
Now pushed and closed.
bug marked as fixed in version 29.0.60, send any further explanations to
60569 <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
.
(Tue, 24 Jan 2023 18:31: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
.
(Wed, 22 Feb 2023 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 62 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.