From patchwork Wed May 12 09:21:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 29263 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E491F27BC82; Wed, 12 May 2021 10:22:08 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 97A1A27BC81 for ; Wed, 12 May 2021 10:22:08 +0100 (BST) Received: from localhost ([::1]:41566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgl4B-0000S6-RC for patchwork@mira.cbaines.net; Wed, 12 May 2021 05:22:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgl46-0000Rq-Ah for guix-patches@gnu.org; Wed, 12 May 2021 05:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lgl46-0001iw-3L for guix-patches@gnu.org; Wed, 12 May 2021 05:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lgl45-0002d5-TP for guix-patches@gnu.org; Wed, 12 May 2021 05:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48232] [PATCH 0/2] Add mercurial-commitsigs and some changes to Mercurial. References: <87k0oecj3a.fsf@yoctocell.xyz> Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 May 2021 09:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48232 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: 48232@debbugs.gnu.org Received: via spool by 48232-submit@debbugs.gnu.org id=B48232.162081131710097 (code B ref 48232); Wed, 12 May 2021 09:22:01 +0000 Received: (at 48232) by debbugs.gnu.org; 12 May 2021 09:21:57 +0000 Received: from localhost ([127.0.0.1]:38175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgl41-0002cn-Gq for submit@debbugs.gnu.org; Wed, 12 May 2021 05:21:57 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:56270 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgl3z-0002cO-5R for 48232@debbugs.gnu.org; Wed, 12 May 2021 05:21:56 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1620811304; bh=4aeCUzwQ4NS+IMWblhKrIuhY6ms4FekX//3t7BCc1GI=; h=From:To:Cc:Subject:In-Reply-To:Date; b=IaULm6UhHBBIKfywMstiLmbKC9qT79GLx1WHCpWaAnAexLZ0u7g+2WppXg/eV2EO5 f9xgJEpiZ0+BOzcylm7qVtAY250nXJe3pKoO22HjlprYlkEwGbatnhLPUHcvK0W2rh UcPoJuhWh1UTZ7OpqAmSa0UG6QmJles1FpWbl69U= In-Reply-To: <877dk5h0kg.fsf@yoctocell.xyz> Date: Wed, 12 May 2021 11:21:43 +0200 Message-ID: <874kf8cno8.fsf@yoctocell.xyz> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches On Tue, May 11 2021, Xinglu Chen wrote: >> Let’s see if you can adjust hg to honor a new environment variable, >> and if not, we’ll see… > > Hmm, I will try to see what I can do. I am no Python expert, but Mercurial is able to load the commitsigs.py module when I applying the attached patch and putting the following in ~/.config/hg/hgrc. [extensions] commitsigs = However, two of the tests are failing, they are related to multiple people trying to push to the same repo at the same time. I don’t know why they would fail, and I don’t know if my patch will break things in the “real world”. This is needed to make Mercurial read the HGEXTENSIONPATH to detect third-party extensions. It is called HGEXTENSIONPATH and not HG_EXTENSION_PATH to keep it consistent with other environment variables for Mercurial, e.g. HGENCODINGAMBIGUOUS, HGEDITOR ... Hopefully I or someone else will get this into Mercurial proper. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -13,6 +13,7 @@ import imp import inspect import os +import sys from .i18n import ( _, @@ -108,6 +109,8 @@ def _importh(name): """import and return the module""" + # Read HGEXTENSIONPATH environment variable when import extensions. + sys.path.append(os.getenv("HGEXTENSIONPATH")) mod = __import__(pycompat.sysstr(name)) components = name.split(b'.') for comp in components[1:]: