From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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: Mon, 29 Aug 2022 20:41:34 +0300 Message-ID: <83bks3vtf5.fsf@gnu.org> References: <166171593185.16640.41619657947456727@vcs2.savannah.gnu.org> <20220828194533.23A6BC00889@vcs2.savannah.gnu.org> <87r10znm0y.fsf@gnus.org> <83fshfvvyn.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30385"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, juri@jurta.org, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 29 19:50:16 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 1oSitr-0007lz-P0 for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 19:50:15 +0200 Original-Received: from localhost ([::1]:52676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSitl-0000bR-V0 for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 13:50:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSilD-0002uM-HZ for emacs-devel@gnu.org; Mon, 29 Aug 2022 13:41:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSil8-0006lX-QU; Mon, 29 Aug 2022 13:41:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RP88a56UKLcJ6pYVBL671oG0QPp7GnypPOJli3ZsxZM=; b=Uf86tMeEJkKM 2xbLerxnUb9rfSbUHCAbFfoAal/o/IMOOzAZbrkvL2zJcirctSYGBDhH1xzayPmQkons6JduzMJHR u8VtrPQs9k26sATLf79eC+/uqKrdC2HTJppj38CYh2hCDhX9dpFHIfk0K8pa4dmSDTMOXAnY/eTzt 33puoD/QxLR692N2S0zAYyNIWBlxSJVoUj9iXAVqV8BhY2l3x+nMGyaRMJwW6v/TOspxJOWS9SuDk Q4BvmYfyz8mBMYjgSb1McjD4FR1w1e9Xk/HbfFNaRXjWpPUm91VTU6MO/EyLc7CifioHiFUQyV9Xm h7WIhmnbEgQAMsXWY6GF4g==; Original-Received: from [87.69.77.57] (port=4415 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSil7-0006eV-DV; Mon, 29 Aug 2022 13:41:14 -0400 In-Reply-To: (message from Dmitry Gutov on Mon, 29 Aug 2022 20:05:10 +0300) 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:294293 Archived-At: > Date: Mon, 29 Aug 2022 20:05:10 +0300 > Cc: juri@jurta.org, emacs-devel@gnu.org > From: Dmitry Gutov > > > Given diffs in a > > buffer, it should be as simple as running the Patch utility via > > shell-command-on-region, then committing the results. Git has a > > special command for that, but we don't need a special command for > > other VCSes, if they don't have the equivalent of "git apply". (I'm > > guessing that "git apply" simply runs Patch under the hood.) > > No, 'git apply' puts the patch in a different place (index area), which > means our implementation doesn't need to bother with moving all existing > changes in the selected files somewhere else, then committing, and then > restoring the previously-hidden changes. I don't follow, sorry. The implementation in vc-git.el does this, AFAICT: . creates a temporary file . inserts the patch into the temporary file . calls "git apply --cached" on the patch in the temporary file . deletes the temporary file This doesn't seem to be very different from invoking Patch on the diffs. (And using shell-command-on-region avoids the need to explicitly create a temporary file.) > Personally I hope we discover some popular extension to Mercurial which > we'll be able to use in the same way as we do Git's index area here. And > then say job well done and keep the less-popular and outdated backends > unsupported. The index thing being the problem because Git needs to have the changes in the index before you can commit? Or is there any other reason? IOW, why cannot we simply patch the files, and then run the equivalent of vc-checkin?