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, 17 Oct 2022 02:53:26 +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> <999d1cb2-6b7f-8020-5202-e919278d895e@yandex.ru> <877d2pnqup.fsf@yahoo.com> <86zgfknc9a.fsf@mail.linkov.net> <7b11b61f-c70d-7079-9bb2-7069a6e0170b@yandex.ru> <86ler4laek.fsf@mail.linkov.net> <83k06os741.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="37200"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cc: juri@linkov.net, luangruo@yahoo.com, ams@gnu.org, larsi@gnus.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 17 01:54:41 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 1okDSq-0009Uq-RT for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 01:54:40 +0200 Original-Received: from localhost ([::1]:54840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okDSp-000414-9i for ged-emacs-devel@m.gmane-mx.org; Sun, 16 Oct 2022 19:54:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okDS9-0003Kj-5T for emacs-devel@gnu.org; Sun, 16 Oct 2022 19:53:57 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:45948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okDS7-0004f8-Ae; Sun, 16 Oct 2022 19:53:56 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id a10so15982847wrm.12; Sun, 16 Oct 2022 16:53:30 -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:subject:date:message-id:reply-to; bh=nPxQUxAzb1Wh7aASYMl4JDeW0z57p6Zk2gPfQsP7Zxs=; b=e2GwdmUbf0dYVqmOGkIo9m9pjBUBrAgNQWjh0QCxIUm27W7B2x86i0rAouF1cGpdnA xEBKQHl3xO1szNcJyh5GFxVfuYZVYuYEVPNE4cyC6xgCLONpgVsUBTPgOzRGadJlqBEc UAT1hTqJfR5sd0MTaVHq12pO/P0M7I3cVHaWxiPKi85aEaIii3PiJ/Cw4vj7P7xVwzQ2 1vmty3+F0DOoDN164ZQ2VZrn+3cnC3G8BRJZBHiYrohy+A15TYnhqAZquQlD3HiH5aZK ABPyJYGyOjlQJh0RlvlHkoeionoQzkTMBnZLvNkYH2NSfN1gx1K1MD5qkji3L4CHqLpB 0w5w== 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:subject:date:message-id :reply-to; bh=nPxQUxAzb1Wh7aASYMl4JDeW0z57p6Zk2gPfQsP7Zxs=; b=6LgQWUNfN+ccwILJYA0NkJ+WzTZV+o0+BYfquLt+tSd8BXLBw1AGGzJVMa8pyhxh6F i/nW+yhhoO7w37kiQH2cYBz5pi9yMR8HdempG8S61HHMjCuGWWeiRLqwq5ItHAzh0eR5 F7PwhB6AJXIwJNtBgI6uS38UhPnod5CPVZtFrjTC1unGNkiQrQaugF6mYeVJY/zFWe3C 5Umd8tXm+2QfWQgbOzSKAvWWYyx9HCtKPtSOgEO22OjpP4yGDbyQCLWsKXaR6+8cEs7g Rx72lwpxw73h9PLiqKWkkN7O5MSU9Lnc9lgbrysofDHCr9Pk16KGUBCEGDKvpYi/bAm+ pF8A== X-Gm-Message-State: ACrzQf2CRopAj2EqE37A01wXG0VZwfSAn6k9SeMcQKypI9w/cBhyoPG9 AAi78l+Sh6wYOESkWYJs1yQf9+54GNI= X-Google-Smtp-Source: AMsMyM64T5dFWk+8d7XMar/qvvaYJc081giF18yrWYJdL0BG4tbUNaUdqZnu/20Dv705+ppCMomnOQ== X-Received: by 2002:adf:c582:0:b0:22b:3c72:6b81 with SMTP id m2-20020adfc582000000b0022b3c726b81mr4601778wrg.320.1665964409488; Sun, 16 Oct 2022 16:53:29 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id c1-20020a5d4141000000b002238ea5750csm8765201wrq.72.2022.10.16.16.53.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Oct 2022 16:53:29 -0700 (PDT) Content-Language: en-US In-Reply-To: <83k06os741.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=raaahh@gmail.com; helo=mail-wr1-x429.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.25, FREEMAIL_FROM=0.001, GAPPY_SUBJECT=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:297893 Archived-At: On 31.08.2022 19:36, Eli Zaretskii wrote: >> Date: Wed, 31 Aug 2022 19:21:12 +0300 >> Cc: Po Lu, "Alfred M. Szmidt", >> eliz@gnu.org,larsi@gnus.org,emacs-devel@gnu.org >> From: Dmitry Gutov >> >> On 31.08.2022 19:06, Juri Linkov wrote: >>>> But a loop is necessary because the diff can have more than one hunk, isn't >>>> it? >>> A loop is necessary indeed. The problem is that I tried it with Bzr, >>> but it has such a bug that `bzr diff` adds an extra line at the end, >>> so it's not (eobp) after the last diff hunk. After removing the >>> final newline in the*vc-diff* buffer the loop can be finished. >> Hmm, so how do we apply the full diff in a backend-agnostic fashion? >> >> Should we delegate to 'patch', then? And require it to be installed. > Shouldn't the code which looks for hunks be resilient to such minor > differences? Why does it fail if there's an extra line at the end? > Does that line look anything like another hunk? I'm not sure how that line is supposed to look (I haven't been able to reproduce it with the one Bzr repo I had), but it should be possible to use a loop like (while (or (bobp) (looking-at diff-hunk-header-re) (diff-apply-hunk)) Anyway, I went ahead with using 'patch' for now. At least it will show simpler errors if user tries to commit patch with broken syntax.