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.bugs Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks Date: Sat, 12 Feb 2022 03:43:49 +0200 Message-ID: <36b963e4-5af7-dd9e-af92-4404541b9f4d@yandex.ru> References: <268cee0d-465d-b862-d1d6-f5da4d69e737@inventati.org> <9106387a-98cf-396f-bf45-ccb04581787b@yandex.ru> <864k7kfd56.fsf@mail.linkov.net> <86fsr3uen2.fsf@mail.linkov.net> <95d2d999-49ad-13c4-9f25-0935650a1e42@yandex.ru> <8635ktjfll.fsf@mail.linkov.net> 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="34268"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: 52349@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 12 02:44:33 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nIhSj-0008jm-2A for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Feb 2022 02:44:33 +0100 Original-Received: from localhost ([::1]:48660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIhSh-0002wj-PU for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Feb 2022 20:44:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIhSF-0002wN-1D for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 20:44:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIhSD-0000ec-QO for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 20:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nIhSD-0007WG-KW for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 20:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Feb 2022 01:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52349 X-GNU-PR-Package: emacs Original-Received: via spool by 52349-submit@debbugs.gnu.org id=B52349.164463023928889 (code B ref 52349); Sat, 12 Feb 2022 01:44:01 +0000 Original-Received: (at 52349) by debbugs.gnu.org; 12 Feb 2022 01:43:59 +0000 Original-Received: from localhost ([127.0.0.1]:33026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIhSA-0007Vt-Uu for submit@debbugs.gnu.org; Fri, 11 Feb 2022 20:43:59 -0500 Original-Received: from mail-wr1-f54.google.com ([209.85.221.54]:38538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIhS9-0007Vg-Qt for 52349@debbugs.gnu.org; Fri, 11 Feb 2022 20:43:58 -0500 Original-Received: by mail-wr1-f54.google.com with SMTP id d27so14109759wrb.5 for <52349@debbugs.gnu.org>; Fri, 11 Feb 2022 17:43:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=yfTSV7yQCbpP4/vlx3l6GzFZ7m4FuZKI/jCnk2dhYwk=; b=fAvQTid1Gq7FHLRkLEZ4x1zlNAZcCFc7Xqv1KTVFdeMXDmSEq9SCnZyrawrpbtx0iw MsRWI87T4heOUPszBrb5bhL2rvZlpudD5n4rULXLte1PaLXC8UUwNWaTBaBNKXilWoCq QU7F85Az+jukndYqpXDhEm0i97ufUC/qXgROJnxOtm4A8peYFBMOH1kNo2jqPIVmPRRd sBV6CrULSXErSqFyawhProOC+j1N5VcLJglS3U4jdfWRT09sgs13pXzclx0+8DFjIOLi gVyIUkX/gJO29fqYWcG8um7K+DazRDevJztOB7YRHN7ngM3B3Mg1MP1l9QFjARisJrfb KvHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=yfTSV7yQCbpP4/vlx3l6GzFZ7m4FuZKI/jCnk2dhYwk=; b=PyKnUa/Qdmmt8yEg/sGvs64c5FREykik58I5kNHdbrjPVv4F0valHMw9H/EKBQGpsb 9zoxbjRGDmmq1F/FNZDz7BQ+M9GVHkR6n4NQU7IKhvSmmyfdxdWkIeRHBJEBPy+0Y1hZ baDbnZUpneQntOmGDY1dRniOw3lttp5RxwwPuFGQxZ9YJn1bNjFqX5rCQZOtIJm8qjzW Effj/cn+nSGz4l9qxYW969F9zN+fBkewkJb7HxLgO75jSdWAdz+wgiHrgJwGenktsxuT e52ZTPBYP7wO1FITe8+0tTDN5OxyGykN8co/zSdqc+gXMoj8m+XjGApPQfF950i6aWFx 5PeA== X-Gm-Message-State: AOAM532+qDGq+ZOhrFtmGG8jGB9c5EVnF1yHKnWp9XN9w1Ia2NmeM0Fp fEksDeCBCBjgevj3KwIvhVw= X-Google-Smtp-Source: ABdhPJzC7Ztd7eLkjoTXZbfycBboR37SJzuNUCbw+86F4FUozqhLr4LduVXeYsC7ljWKID2eEdrGgg== X-Received: by 2002:a5d:4b8d:: with SMTP id b13mr3184709wrt.571.1644630231928; Fri, 11 Feb 2022 17:43:51 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id y14sm25264257wrd.91.2022.02.11.17.43.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 17:43:51 -0800 (PST) Content-Language: en-US In-Reply-To: <8635ktjfll.fsf@mail.linkov.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226685 Archived-At: Hi Juri! On 08.02.2022 21:57, Juri Linkov wrote: > This is implemented now, and I'm already using it without problems. > Please review this patch: Looking good. But could you explain the case when the changes to 'vc-diff-internal' are going to be used? If those are only for log-edit-show-diff, I think it'd be better if the new logic was implemented in the new value of log-edit-diff-function, rather than having it spliced into the common code path. Would that result in a lot of code duplication? It might also be worth it to thread the 'patch-buffer' value through the backend method arguments (the actual value will be the patch string), so that vc-git-checkin gets it in the 4th argument, rather than having it call (derived-mode-p 'diff-mode) (this feels a little brittle: I suppose which buffer is current during this call might change in the future). It would also automatically weed out backends which don't support this feature, rather than having an attempt to commit from a diff buffer using Hg fail silently. But the current method is decent too, up to you. Finally, we'd should probably have at least one test in vc-tests.el which exercises the new functionality. Though I guess it might be tricky to set up. > +;;;###autoload > +(defun diff-vc-deduce-fileset () > + (let ((backend (vc-responsible-backend default-directory)) > + files) > + (save-excursion > + (goto-char (point-min)) > + (while (progn (diff-file-next) (not (eobp))) > + (push (diff-find-file-name nil t) files))) > + (list backend (nreverse files) nil nil 'patch))) > + > + Very nitpicky nitpick: please drop the extra empty lines before and after this function.