From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a patch (bug#52349) Date: Wed, 31 Aug 2022 09:53:01 +0300 Organization: LINKOV.NET Message-ID: <86zgfknc9a.fsf@mail.linkov.net> References: <166171593185.16640.41619657947456727@vcs2.savannah.gnu.org> <20220828194533.23A6BC00889@vcs2.savannah.gnu.org> <87r10znm0y.fsf@gnus.org> <83fshfvvyn.fsf@gnu.org> <999d1cb2-6b7f-8020-5202-e919278d895e@yandex.ru> <877d2pnqup.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39584"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: Po Lu , "Alfred M. Szmidt" , eliz@gnu.org, larsi@gnus.org, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 31 08:56:05 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTHds-000A9H-ME for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Aug 2022 08:56:04 +0200 Original-Received: from localhost ([::1]:48546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTHdr-0004os-MB for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Aug 2022 02:56:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTHbr-0003zP-5p for emacs-devel@gnu.org; Wed, 31 Aug 2022 02:53:59 -0400 Original-Received: from relay11.mail.gandi.net ([2001:4b98:dc4:8::231]:38003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTHbm-0000J9-3q; Wed, 31 Aug 2022 02:53:58 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 66A95100002; Wed, 31 Aug 2022 06:53:43 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Wed, 31 Aug 2022 05:32:42 +0300") Received-SPF: pass client-ip=2001:4b98:dc4:8::231; envelope-from=juri@linkov.net; helo=relay11.mail.gandi.net X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, GAPPY_SUBJECT=0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294404 Archived-At: >>> I can look into adapting this approach for other VCS if nobody beats >>> me to it. As long as we fundamentally agree on the behavior. >> Thank you. > > This seems to work. > > Might use some extra polish, though, if people also encounter the one weird > error about "buffer already killed" that I saw a few times but then stopped > after a restart. Thanks, looks universal enough to handle all backends. I've tried it out, but it gets stuck asking the same question: Hunk has already been applied; undo it? (y or n) because of the infinite loop in: (while (not (eobp)) (diff-apply-hunk)) After removing the loop, everything works fine. > +(defun vc-default-checkin-patch (backend patch-string comment) > + (with-current-buffer (get-buffer-create " *vc-checkin-patch*") > + (erase-buffer) > + (insert patch-string) > + (diff-mode) > + (pcase-let ((`(,backend ,files) (diff-vc-deduce-fileset)) > + (root (vc-call-backend backend 'root default-directory)) > + (tmpdir (make-temp-file "vc-checkin-patch" t))) I'm worried that after a crash, reboot might wipe out the /tmp dir.