all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
@ 2023-01-05  7:58 Juri Linkov
  2023-01-18 17:39 ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2023-01-05  7:58 UTC (permalink / raw)
  To: 60569

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-05  7:58 bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs Juri Linkov
@ 2023-01-18 17:39 ` Juri Linkov
  2023-01-20  4:02   ` Richard Stallman
  2023-01-22  2:25   ` Dmitry Gutov
  0 siblings, 2 replies; 10+ messages in thread
From: Juri Linkov @ 2023-01-18 17:39 UTC (permalink / raw)
  To: 60569

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-pull-and-push.patch --]
[-- Type: text/x-diff, Size: 2354 bytes --]

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.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-18 17:39 ` Juri Linkov
@ 2023-01-20  4:02   ` Richard Stallman
  2023-01-22 17:28     ` Juri Linkov
  2023-01-22  2:25   ` Dmitry Gutov
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2023-01-20  4:02 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60569

[[[ 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)







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-18 17:39 ` Juri Linkov
  2023-01-20  4:02   ` Richard Stallman
@ 2023-01-22  2:25   ` Dmitry Gutov
  2023-01-22 17:27     ` Juri Linkov
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2023-01-22  2:25 UTC (permalink / raw)
  To: Juri Linkov, 60569

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-22  2:25   ` Dmitry Gutov
@ 2023-01-22 17:27     ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2023-01-22 17:27 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 60569

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-20  4:02   ` Richard Stallman
@ 2023-01-22 17:28     ` Juri Linkov
  2023-01-23 12:00       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2023-01-22 17:28 UTC (permalink / raw)
  To: 60569

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





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-22 17:28     ` Juri Linkov
@ 2023-01-23 12:00       ` Eli Zaretskii
  2023-01-24 17:49         ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2023-01-23 12:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60569

> From: Juri Linkov <juri@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-23 12:00       ` Eli Zaretskii
@ 2023-01-24 17:49         ` Juri Linkov
  2023-01-24 18:08           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2023-01-24 17:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 60569

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





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-24 17:49         ` Juri Linkov
@ 2023-01-24 18:08           ` Eli Zaretskii
  2023-01-24 18:29             ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2023-01-24 18:08 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60569

> From: Juri Linkov <juri@linkov.net>
> Cc: 60569@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
  2023-01-24 18:08           ` Eli Zaretskii
@ 2023-01-24 18:29             ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2023-01-24 18:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 60569

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-24 18:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05  7:58 bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs Juri Linkov
2023-01-18 17:39 ` Juri Linkov
2023-01-20  4:02   ` Richard Stallman
2023-01-22 17:28     ` Juri Linkov
2023-01-23 12:00       ` Eli Zaretskii
2023-01-24 17:49         ` Juri Linkov
2023-01-24 18:08           ` Eli Zaretskii
2023-01-24 18:29             ` Juri Linkov
2023-01-22  2:25   ` Dmitry Gutov
2023-01-22 17:27     ` 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.