Subject: bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs

From: Juri Linkov <[email-masked]>
Date: Tue, 24 Jan 2023 19:49:24 +0200

>> > 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."