From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id yNMRESFiTmQhSQEAkFu2QA (envelope-from ) for ; Sun, 30 Apr 2023 14:42:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 4HH3ECFiTmR+TgAA9RJhRA (envelope-from ) for ; Sun, 30 Apr 2023 14:42:09 +0200 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CDCAF14503 for ; Sun, 30 Apr 2023 14:42:05 +0200 (CEST) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A51F92400DB for ; Sun, 30 Apr 2023 14:42:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1682858524; bh=oSz/EGpoV7oBeqOpxqDXl/T+8IMD8QctJ767HHxBqic=; h=From:To:Subject:Date:From; b=Zd+j5vYBZMdr2SSC7OmB1Z08ILPcM+KJpkz3bViwKCpKUg0pNQgkumGpygc960sIq nVhJpSY++XowHyluL+w8egLxj2IryfCnb8oMZxQ77Q2h++SwEQ5DPRjCdHgXZL2uZY WHx9yeuxUAHbxDGYWsPlFcOl7i2jdQ2kmDq/lBfF7QAK1CynzkAiiXirJiYjBGLrmu nLUobjGtu+9yqXttejm3TRTZ81QECCS7E3e9nFd7/At2PvnUzGc07to49wWa4K/Tod GGATVNY8HEBDgRMy5KDK5uhL2kA+1FdXAlymZn2QpwCnEvA2RtoY0IdLxzNMWALGxI zO3AIpjUKPm/A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q8Qvv6xSPz9rxQ for ; Sun, 30 Apr 2023 14:42:03 +0200 (CEST) From: Ihor Radchenko To: piem@inbox.kyleam.com Subject: [PATCH] New customization: `piem-default-branch-prefix' Date: Sun, 30 Apr 2023 12:45:06 +0000 Message-ID: <87cz3lsfn1.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Seal: i=1; s=key1; d=kyleam.com; t=1682858529; a=rsa-sha256; cv=none; b=cUSd5yVMHjc9hVsurMUDvEwigecVqo5zzoJKbGqU0fQ50QA8olc/62BqQKQOivoBymsEOu AJzzAee1jdTUMAc7vYIqgrHedi4aGWFScvqky0E14IeFw+W1ptY2s6dOMZLIHcIeXEPKV1 z7Au07vO89p+lhG9F51FQnU5rm5F92sAe5USJXqeVfVJYeSYydu7kOAcL7hhFZJuFs3OEV 8E7T9mrEWUT3ZMVMp8ADQSmRoc7fNKx42eg0AgcguliC20BQTPM65BtQFVsS8EPhliJFQO lpEmhT6KFHjw8kXPMHrQxnvgxiexLuVD2FfmHsyQ8QuqXBh0u7nEn3GliLGD5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Zd+j5vYB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of yantar92@posteo.net designates 185.67.36.65 as permitted sender) smtp.mailfrom=yantar92@posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1682858529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=yU7kYJNtb++vd5oSCNQKlAujpPhmDHvaZEmKNUqsfjQ=; b=MPHwi3BR7mgKrSOw7BKf1Sn7ntmyFZuBgVEkZoV5qaOapD7e3m+fhdowjBLrXphUr+D1nI kZ0Sg1XBWsiAhnHdIVPzCw2bVRhThGyBnrlUFPi2QfocmvFLyNc2xsyFoAddE4WebMvBYo zyVgwB8lWy3TxbFOi55e7SkOO4BOLVWTQU0VEVePiLmmTy3qOg1cTu+K/E+xRVHJc9TxQ4 BXp1Qx0//xzXdZG2HIHEh7A/P33L1BeERhke+1UvmhkIzgaFK1HxxRNwU0GlOV4v3mnIUz QZhwDYva/EAwa9FRqLZw6uvgSienz5kC9grJ/vv6A6GIXDEXVVLjx0T66JDckg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Zd+j5vYB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of yantar92@posteo.net designates 185.67.36.65 as permitted sender) smtp.mailfrom=yantar92@posteo.net X-Migadu-Spam-Score: -7.02 X-Spam-Score: -7.02 X-Migadu-Queue-Id: CDCAF14503 X-TUID: +i+0l7GY/xis --=-=-= Content-Type: text/plain Hi, Upon using piem for some time, I am getting hundreds of generated branches in my repos. It gets inconvenient after some time, especially because the branches are not always clearly distinguishable. I'd like to add a new customization that adds a custom prefix string to the generated branch names. That way, I can easily see the branches generated by piem in the list of branches, nicely grouped when sorting alphabetically. The patch is attached. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-New-customization-piem-default-branch-prefix.patch >From de962c6566aeea1861151c07e2eb8fee1419373e Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Sun, 30 Apr 2023 14:36:14 +0200 Subject: [PATCH] New customization: `piem-default-branch-prefix' * piem.el (piem-default-branch-prefix): New custom option adding extra prefix to the generated default branch name. Only takes effect when the default `piem-name-branch-who-what-v' is used as `piem-default-branch-function'. (piem-name-branch-who-what-v): Use the new customization. --- piem.el | 9 ++++++++- tests/piem-tests.el | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/piem.el b/piem.el index 63c358a..2334a3d 100644 --- a/piem.el +++ b/piem.el @@ -189,6 +189,12 @@ (defcustom piem-default-branch-function The reported base commit of the patch, if any." :type 'function) +(defcustom piem-default-branch-prefix "" + "Optional prefix prepended to the generated branch name. +Takes effect when `piem-default-branch-function' is set to +`piem-name-branch-who-what-v'." + :type 'string) + (defcustom piem-am-create-worktree nil "Whether to create a dedicated worktree for applying patches." :type 'boolean) @@ -910,7 +916,8 @@ (defun piem-name-branch-who-what-v (info) (zero-or-one (group "v" (one-or-more digit)))) subject) (match-string 1 subject)))) - (concat initials "/" + (concat piem-default-branch-prefix + initials "/" (piem--shorten-subject subject) (and version (concat "__" version)))))) diff --git a/tests/piem-tests.el b/tests/piem-tests.el index 79d8591..ece762d 100644 --- a/tests/piem-tests.el +++ b/tests/piem-tests.el @@ -173,7 +173,13 @@ (ert-deftest piem-name-branch-who-what-v () :subject "[PATCH v3] Do a thing")) "fb/do-thing__v3")) (should-not (piem-name-branch-who-what-v - (list :from "Foo Bar ")))) + (list :from "Foo Bar "))) + ;; Test extra prefix. + (let ((piem-default-branch-prefix "prefix/")) + (should (equal (piem-name-branch-who-what-v + (list :from "Foo Bar " + :subject "[PATCH] Do a thing")) + "prefix/fb/do-thing")))) (ert-deftest piem--insert-message-id-header () (should-not -- 2.40.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--