From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aLsLIa8BZGKBQAEAbAwnHQ (envelope-from ) for ; Sat, 23 Apr 2022 15:39:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qGMKIa8BZGICbwEAauVa8A (envelope-from ) for ; Sat, 23 Apr 2022 15:39:59 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3EE5CA067 for ; Sat, 23 Apr 2022 15:39:59 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id E0D5E5F78A; Sat, 23 Apr 2022 13:39:14 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 026D55F77C for ; Sat, 23 Apr 2022 13:39:12 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 87E6A5FC11; Sat, 23 Apr 2022 09:39:11 -0400 (EDT) Received: (nullmailer pid 3856545 invoked by uid 1000); Sat, 23 Apr 2022 13:38:57 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 03/16] notmuch-git: add --tag-prefix argument Date: Sat, 23 Apr 2022 10:38:35 -0300 Message-Id: <20220423133848.3852688-4-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220423133848.3852688-1-david@tethera.net> References: <20220423133848.3852688-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: YT3CANPFQNEWU2VFAQ7SNDX4ODJJGLGS X-Message-ID-Hash: YT3CANPFQNEWU2VFAQ7SNDX4ODJJGLGS X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650721199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=9lTjcdVh6TDPqWUE1j4s/ImOIjQediiCLd9Y/Yl6OSk=; b=BiWAB6igQPNTllYGB/+r2RWhO20hHNX36aD/KDQOYt+xF3Q4j8MOOaYLpAo/yImlbdVsDT qxP/SiT1ZJ8lallNoJvIwdZsHsDzHUVi+ZdhF4cPYklVHB6A6Q47nitRSbUcN4akB8RP+X soKFRz5pkmzFsqRmOUu1M/vWl4Wkc5e2Te2mq7oEGQ7Y6FFRC4kjojdNE/lb6hpnYrV1tl XVpNGAmPwMwYPjydzUfFwZ/ubAEsrd1TbRbDyDPW7jUvs2hluGY3zhnmZVrXD0A+Y8ZOFE 1GZ6B+GS3y8S2xPD57ZJAFJ13ExmLXPjGY3qkrcbmd9rdACRSjkVDDiHQAOaKg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650721199; a=rsa-sha256; cv=none; b=sw8zQ12bZdmYP4WDv4Bi+hx91wWaZLmRKSFqR66z+Hy4Qwx8K4omL6+GWGssXD7MHl6hTS ayhmjSY4aXqtm8G/t/BPJuG7HfuqztkHRKn/WcU4bW2Uvf2c8dYr6hjzTc7xiJZtLp5z0n 1HUTalBaKTbeqkOCgi145BhgmWksOmsNyuMGwbGJ16U5IVPN0g6F+HwilUt3fMXU21MlaT rS1oc9sUGPrYybjzflmUOxokvO7bRHGaLzEZ75oQwB+DXbIZoaO9YYcKrcHTtK/KATQly0 1MvlvSlzgjK+f+QbCb+XDlf2wOXGhv732WBRccYXSeqSWqSU/D+T+lHDUKBBmA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.77 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 3EE5CA067 X-Spam-Score: -0.77 X-Migadu-Scanner: scn0.migadu.com X-TUID: oUzsls3TqI5L The test suite will require setting the tag prefix (at least initially), and this commit will enable doing that without relying on environment variables (whose names are planned to change). --- notmuch-git.in | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/notmuch-git.in b/notmuch-git.in index 62889303..81d604bb 100755 --- a/notmuch-git.in +++ b/notmuch-git.in @@ -58,8 +58,8 @@ _LOG.setLevel(_logging.WARNING) _LOG.addHandler(_logging.StreamHandler()) NMBGIT = None +TAG_PREFIX = None -TAG_PREFIX = _os.getenv('NMBPREFIX', 'notmuch::') _HEX_ESCAPE_REGEX = _re.compile('%[0-9A-F]{2}') _TAG_DIRECTORY = 'tags/' _TAG_FILE_REGEX = _re.compile(_TAG_DIRECTORY + '(?P[^/]*)/(?P[^/]*)') @@ -105,10 +105,6 @@ def _hex_quote(string, safe='+@=:,'): lambda match: match.group(0).lower(), uppercase_escapes) - -_ENCODED_TAG_PREFIX = _hex_quote(TAG_PREFIX, safe='+@=,') # quote ':' - - def _xapian_quote(string): """ Quote a string for Xapian's QueryParser. @@ -717,6 +713,10 @@ if __name__ == '__main__': parser.add_argument( '-C', '--git-dir', metavar='REPO', help='Git repository to operate on.') + parser.add_argument( + '-p', '--tag-prefix', metavar='PREFIX', + default = _os.getenv('NMBPREFIX', 'notmuch::'), + help='Prefix of tags to operate on.') parser.add_argument( '-v', '--version', action='version', version='%(prog)s {}'.format(__version__)) @@ -838,6 +838,9 @@ if __name__ == '__main__': if _os.path.isdir(_NMBGIT): NMBGIT = _NMBGIT + TAG_PREFIX = args.tag_prefix + _ENCODED_TAG_PREFIX = _hex_quote(TAG_PREFIX, safe='+@=,') # quote ':' + if args.log_level: level = getattr(_logging, args.log_level.upper()) _LOG.setLevel(level) -- 2.35.2