From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov 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:05:10 +0300 Message-ID: References: <166171593185.16640.41619657947456727@vcs2.savannah.gnu.org> <20220828194533.23A6BC00889@vcs2.savannah.gnu.org> <87r10znm0y.fsf@gnus.org> <83fshfvvyn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33318"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: juri@jurta.org, emacs-devel@gnu.org To: Eli Zaretskii , Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 29 19:27:50 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 1oSiYA-0008Zz-IW for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 19:27:50 +0200 Original-Received: from localhost ([::1]:48948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSiY9-0006r0-IJ for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 13:27:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSiCv-0001zd-0G for emacs-devel@gnu.org; Mon, 29 Aug 2022 13:05:54 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSiCs-00012M-PQ; Mon, 29 Aug 2022 13:05:52 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id v16so8270033wrm.8; Mon, 29 Aug 2022 10:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=gff6Kx95IskZFpDmMZuVwJCwJhGnwtgLxfvMwiF20xo=; b=m01h3CdlfuCjFH+kDhwHhIAkkNXxARticvF/3hwQyYDV71n6n5CrzmxF800mBdzlUs hwl9S+5flbuFVOVT9wEXKJNKxq5yprDY6c3IlQKKLVScBK8QSvjUKuQK8yDU9XJvoAb+ pi1f7itxETBNruu8pM9+wvHEdWUJ8W9PsqFc7e3dBpKl3eoQkGrztDwGJacCrJsmuZo+ HDi69qdFiIQVFShRXyDvBm9iML0pz9/NNbIYpx/R//K4Sr52zhaKECPk16E+GPgNLsbs MvqN8tikMqdY1kCIGSiUaxo3fTCoOOTLjQ5cDGK9xEK829TDlfm+PW6lnZM5r0s9kG+Z 5jVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=gff6Kx95IskZFpDmMZuVwJCwJhGnwtgLxfvMwiF20xo=; b=gWFCAX4l0k4S4WsvuhOrttF7eZqCPvJt4UDVjk3Ic+sjrlquVkRdzQbzGWp6eDp0kX 8ZCgH+QSxVOUB/E1GNStkwuwVXXydD3X8hrvBp3d9LNLs4Ui0LaoxBP5ozSb7H8vCG3S Gd5exf8/RfQ8aB9SLJv9z0vgO5gPFg6NpuHatq2yLFp1dn5od6+Pz0vNAAh+kAWFneh/ EfWtyuUe+/5NjpLGhjGmngN8fHrpvwfF08XABUIfCgRoigm1Huoiuf14fEACCiUqaBaT piZGu9XQEsH2aGluB5sn56TzteDPxsmKEo1c0NmF8DjkgSooyFkiicRlBelkWtmfH6c3 YVWw== X-Gm-Message-State: ACgBeo2Ch7+Kt+vKOZ0GrzAso28ywqD7N0D4w0EVZE9Q315HPAoE5mpt 1iCy+8IFQcaEMMxxZaUyL7s29jhhrsk= X-Google-Smtp-Source: AA6agR4CXeaDNqeTbA4I89/zh4MvtES19x06O9Ba3Vnl3zccg3v26Glm5HOCdQ2Bor30bL8Dg8KIFA== X-Received: by 2002:a05:6000:1d98:b0:225:294:8150 with SMTP id bk24-20020a0560001d9800b0022502948150mr6807632wrb.169.1661792719129; Mon, 29 Aug 2022 10:05:19 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l6-20020adff486000000b0021e13efa17esm7759408wro.70.2022.08.29.10.05.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Aug 2022 10:05:16 -0700 (PDT) Content-Language: en-US In-Reply-To: <83fshfvvyn.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=raaahh@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, GAPPY_SUBJECT=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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:294290 Archived-At: On 29.08.2022 19:46, Eli Zaretskii wrote: > Why cannot this be implemented for every other VCS? It can. > 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. The best way to implement the latter is not obvious to me. I suppose simply copying the files to /tmp and then overwriting them back at the end might do the trick, but can cause problems if the user edits the file buffer between creating the diff and finishing the checkin. > Can we please implement this for other VCSes as well? 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. 'man hg' didn't give me enough clues, though.