From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#69220: [PATCH] smerge-mode: add a function to resolve all conflicts in a file Date: Mon, 19 Feb 2024 15:17:55 +0300 Message-ID: References: <865xykr79f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26645"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.50.3 Cc: 69220@debbugs.gnu.org To: Eli Zaretskii , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 19 13:19:03 2024 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 1rc2bu-0006jb-QK for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Feb 2024 13:19:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc2ba-0003He-TE; Mon, 19 Feb 2024 07:18:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc2bZ-0003H1-Dm for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 07:18:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rc2bZ-0001Zz-4J for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 07:18:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rc2bu-0006Xl-4g for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 07:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Feb 2024 12:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69220-submit@debbugs.gnu.org id=B69220.170834513625141 (code B ref 69220); Mon, 19 Feb 2024 12:19:02 +0000 Original-Received: (at 69220) by debbugs.gnu.org; 19 Feb 2024 12:18:56 +0000 Original-Received: from localhost ([127.0.0.1]:40530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc2bo-0006XQ-8q for submit@debbugs.gnu.org; Mon, 19 Feb 2024 07:18:56 -0500 Original-Received: from forward500a.mail.yandex.net ([178.154.239.80]:56808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc2bi-0006XE-Me for 69220@debbugs.gnu.org; Mon, 19 Feb 2024 07:18:55 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:5402:0:640:2835:0]) by forward500a.mail.yandex.net (Yandex) with ESMTPS id 8E2FA60F8D; Mon, 19 Feb 2024 15:17:57 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id tHPMJDuuBOs0-RTlr2oyO; Mon, 19 Feb 2024 15:17:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1708345077; bh=FS+m1i+qAh6k0EG2V4d+mzNAWklibjX5p4c4V4Se+GQ=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=aHZ3dVwCbhMNN/mQ/o6klzihd3uiFaFq7hLrZBatDaM6qvBocTbc/eOB8V+4/UUDp KyywzyFO8LHCoLSrguOQ7Lg+xAD/YFFIRiXQ3G/J+J5mLX62Uj9u5ZVW1L/bwMrqn6 VqVUU1gmYVZPJCLn1VKDxSpycd0p4CYUo6EtIV/o= Authentication-Results: mail-nwsmtp-smtp-production-main-69.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <865xykr79f.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280248 Archived-At: On Mon, 2024-02-19 at 14:03 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Date: Sat, 17 Feb 2024 13:16:14 +0300 > >=20 > > This implements a feature request from here=C2=B9 about having a > > function to > > resolve all conflicts simultaneously. Although question author > > didn't > > reply, but either way I think it's a useful functional. I needed it > > so > > many times, but before stumbling upon this question I just didn't > > know > > there are functions `smerge-keep-upper/base/lower`, and so ofc I > > never > > though of writing a new one that would apply them to all conflicts. >=20 > I use SMerge quite a lot, but never yet had a situation where the > same > resolution was applicable to all of the conflicts, let alone knew > that > in advance, before looking at each conflict. Well, in Emacs it is allowed to create large commits with many functional changes, which I think is why you never saw such functional to be necessary. Offhand I can tell at least two situations where it is needed; both imply you have more than one commit on the branch: 1. You got a commit that does two different functional changes to a hunk. So you want to split it. You do an interactive rebase to the previous commit, then do one of the changes and create a commit from it. Then you do a `git rebase --continue` and you get conflicts; but you know beforehand exactly that you want it to be solved in preference of the newer commit.=C2=B9 2. You noted, either yourself or as part of codereview, that one of the older commits on the branch has a bug; but you know the bug is non- existent in newer commits. So you fix it in the older commit, then upon `git rebase --continue` you again know exactly that you want just the newer version.=C2=B9 1: Actually, git provides a functional that should work for that usecase; but in my experience it is more confusing than it's useful. It is options `--theirs/ours`, i.e. `git checkout --theirs ./` and `git checkout --ours ./`. But these options are problematic because instead of resolving conflict in preference of `theirs` or `ours` they do a complete checkout of the code from either of the branches. I can't count how many times I was burned by trying to resolve conflicts with these options and then was getting wrong code because together with the conflicting part the options change everything else. > I'm also guessing one could have the same effect by giving a prefix > argument of suitable value to the conflict-resolution command. >=20 > Having said that, if this is deemed useful, why not?=C2=A0 Adding Stefan > to > the discussion, in case he has comments.=C2=A0 I'd also be interested in > Dmitry's opinions. >=20 > Thanks.