From: Juri Linkov <juri@linkov.net>
To: 60569@debbugs.gnu.org
Subject: bug#60569: 29.0.60; vc-pull-and-push unsupported on non-git vcs
Date: Wed, 18 Jan 2023 19:39:46 +0200 [thread overview]
Message-ID: <861qnr4yet.fsf@mail.linkov.net> (raw)
In-Reply-To: <864jt58l8f.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 05 Jan 2023 09:58:00 +0200")
[-- 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.
next prev parent reply other threads:[~2023-01-18 17:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861qnr4yet.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=60569@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).