From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58383: 29.0.50; Make it easier to invert vc-prepare-patches-separately Date: Sun, 13 Nov 2022 13:56:38 +0000 Message-ID: <87a64vvtyh.fsf@posteo.net> References: <87mta6b3yu.fsf@melete.silentflame.com> <87edvh2m3o.fsf@posteo.net> <87v8nq4b62.fsf@melete.silentflame.com> <87cz9xgpd9.fsf@posteo.net> <87sfityxe8.fsf@melete.silentflame.com> <87sfisedkk.fsf@posteo.net> <87educytij.fsf@melete.silentflame.com> <87iljo9g1h.fsf@posteo.net> <875yfnzw14.fsf@melete.silentflame.com> <87v8nm5zzp.fsf@posteo.net> <87pmduwdzs.fsf@melete.silentflame.com> <87bkpexaqh.fsf@posteo.net> <87wn81us9q.fsf@melete.silentflame.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11776"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58383@debbugs.gnu.org To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 13 14:57:18 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 1ouDU5-0002qb-R7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Nov 2022 14:57:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouDTs-0006i9-Sg; Sun, 13 Nov 2022 08:57:04 -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 1ouDTq-0006hg-MM for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 08:57:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ouDTq-0000bW-8H for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 08:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ouDTp-0004cx-Vb for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 08:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2022 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58383 X-GNU-PR-Package: emacs Original-Received: via spool by 58383-submit@debbugs.gnu.org id=B58383.166834781617773 (code B ref 58383); Sun, 13 Nov 2022 13:57:01 +0000 Original-Received: (at 58383) by debbugs.gnu.org; 13 Nov 2022 13:56:56 +0000 Original-Received: from localhost ([127.0.0.1]:50235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ouDTj-0004ca-9S for submit@debbugs.gnu.org; Sun, 13 Nov 2022 08:56:55 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:49105) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ouDTf-0004c8-Fg for 58383@debbugs.gnu.org; Sun, 13 Nov 2022 08:56:53 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1CE74240027 for <58383@debbugs.gnu.org>; Sun, 13 Nov 2022 14:56:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1668347805; bh=yJzWpvKOEMyf57WSlup1u/Qfm12pzB//VosuE4QB8U8=; h=From:To:Cc:Subject:Date:From; b=FKDlMg7RW1YBevvJaE4286Z2ZOkLPYjBq/lgXAPwNokGgCI/XmIlEbcQKTUYHjt6q aKKyx0aZ3V3Qa9y0Zgg745mz4zSjHru5jyt8fgmlWaQxghA/NykDmUGaJo19jgNjOR +UHgkUfPGnBe8fH/McsH0h0C8jXGdHnnAUEiKspDzKot3JkAVtPAb2XvpHIznJa7QB lKf9s+mDceNsOp9MOoy1Pur7eUs6/C7z8PH4+E6t3LlqRbVofc+Nuk0F6ZUtVH/Chu uHghNh3vBHzJzoTphqysq8jaxgNfzOoh+AWV4T1kG34CpefphsPTJkmx7tmH6q80jD 2wsLGIZ0RK/pQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N9DWc1T0Yz9rxP; Sun, 13 Nov 2022 14:56:44 +0100 (CET) In-Reply-To: <87wn81us9q.fsf@melete.silentflame.com> (Sean Whitton's message of "Fri, 11 Nov 2022 13:53:53 -0700") 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:247774 Archived-At: --=-=-= Content-Type: text/plain Sean Whitton writes: > Hello, > > On Fri 11 Nov 2022 at 06:32AM GMT, Philip Kaludercic wrote: > >> Sean Whitton writes: >> >>>>> Typically you wouldn't want to format patches across a merge, so I would >>>>> suggest raising an error. >>>> >>>> And this is something I don't think can be /expressed/ using vc, because >>>> while I can collect a number of revisions using `previous-revision', >>>> there is no general way to verify if a commit is a merge commit. >>> >>> Can we do that part on a VCS-by-VCS basis? Default to just calling >>> previous-revision and hoping for the best, but giving vc-git.el a chance >>> to raise an error. >> >> I guess that would be possible, though it will probably require a new >> VC method :/ The new `prepare-patch' takes a revision, so it doesn't >> make sense to pass it a number and have it return multiple patches. >> >> Perhaps it will be easier/cleaner to just accept that avoiding merge >> revisions is the users responsibility. > > Sounds reasonable -- it can always be enhanced later in a way that's > backwards-compatible. > >> But just to have mentioned it: Do you know that you can mark revisions >> in log-view and then vc-prepare-patches will use these as the default >> input when prompting for revisions? > > Yeah, but marking in those buffers is way more awkward than marking in, > e.g., dired, and I usually know how many commits I want to send without > looking at the log. How does the following look like: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 513fbb23fe..0b8a8d83e3 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3391,14 +3391,24 @@ vc-prepare-patch as the default subject for the message (and it will be prompted for when called interactively). Otherwise a separate message will be composed for each revision, with SUBJECT derived from the -invidividual commits. - -When invoked interactively in a Log View buffer with marked -revisions, those revisions will be used." +invidividual commits. When invoked with a numerical prefix +argument, the last N revisions will be used. When invoked +interactively in a Log View buffer with marked revisions, those +revisions will be used." (interactive (let ((revs (vc-read-multiple-revisions "Revisions: " nil nil nil - (or (and-let* ((revs (log-view-get-marked))) + (or (and-let* ((arg current-prefix-arg) + (fs (vc-deduce-fileset t))) + (cl-loop with file = (caadr fs) + repeat (prefix-numeric-value arg) + for rev = (vc-working-revision file) + then (vc-call-backend + (car fs) 'previous-revision + file rev) + when rev collect it into revs + finally return (mapconcat #'identity revs ","))) + (and-let* ((revs (log-view-get-marked))) (mapconcat #'identity revs ",")) (and-let* ((file (buffer-file-name))) (vc-working-revision file))))) --=-=-=--