Mercurial 动态用户名扩展
项目描述
按目录树使用不同的提交用户名。
使用此扩展,您可以在以下存储库中作为 John Smith <john.smith@serious.com> 提交,在以下代码 ~/hobby 中作为 Johny <fastjohny@fantasy.net> 提交 - 并且只需在 ~/.hgrc 中设置此规则一次。
第1节 示例
按照以下说明安装扩展。
在您的 ~/.hgrc 中编写。
[extensions] mercurial_dynamic_username = [dynamic_username] work.location = ~/work work.username = John Smith <john.smith@serious.com> hobby.location = ~/hobby ~/blogging hobby.username = Johny <fastjohny@fantasy.net>
只需提交即可。在位于~/work以下任何仓库中,您将以John Smith身份提交,在~/hobby以下仓库中以Johny身份提交,其他地方将使用默认设置(来自[ui]的username)。
第2节 配置语法
所有设置都在[dynamic_username]部分定义,并具有以下形式
«somelabel».location = «list of directory names» «somelabel».username = «username used there»
标签仅用于将成对的设置组合在一起。
.location中指定的目录名称由空格或冒号分隔,并且可以加引号。如果仓库属于此处指定的目录树,则与规则匹配。波浪号(~/..和~john/...)将正确展开。
用户名与标准username具有相同的语法。
在没有成对.username的情况下定义.location会要求扩展程序恢复到标准用户名,例如
[ui] username = Jake <jake@loose.net> [dynamic_username] work.location = ~/work work.username = John Smith <john.smith@serious.com> open.location = ~/work/open-source
将在~/work/libs/veryimportant中以John Smith身份提交,但在~/work/open-source/libshared中将恢复到默认的Jake。
第3节 匹配优先级
如果多个位置与仓库匹配,则使用最长的一个(如上面open-source示例中所示)。最长的选择使用实际的规范路径(在波浪号展开后,~/work/sth比/home/littlejohny/work长)。
动态用户名目前总是比[ui]-部分的username优先,即使后者在特定仓库的.hg/hgrc中定义。我很乐意优先考虑后者,但我不知道如何在重新解析配置之前检测到这一点。
第4节 测试配置
您可以通过调用来测试您的配置
hg showconfig ui.username
(结果应取决于当前工作目录)。方便的比较方式
hg --cwd ~/work/libs/acme showconfig ui.username hg --cwd ~/hobby/blogging showconfig ui.username
第5节 安装
第5.1节 Linux/Unix (来自PyPI)
如果您有工作pip或easy_install
pip install --user mercurial_dynamic_username
或可能
sudo pip install mercurial_dynamic_username
(或者用easy_install代替pip)。然后通过以下方式激活
[extensions] mercurial_dynamic_username =
要升级,请使用带有--upgrade选项的相同命令,例如
pip install --user --upgrade mercurial_dynamic_username
第5.2节 Linux/Unix (来自源)
如果您没有pip,或者希望更紧密地跟踪开发
同时克隆此仓库和mercurial_extension_utils,并将它们放在同一目录中,例如
cd ~/sources hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/ hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/
更新到最新标签
通过以下方式激活
[extensions] mercurial_dynamic_username = ~/sources/mercurial-dynamic_username/mercurial_dynamic_username.py
要升级,请拉取并更新。
请注意,目录名称很重要。有关此类安装的更详细说明,请参阅mercurial_extension_utils。
第5.3节 Windows
如果您已安装任何Python,您可以使用pip安装
pip install mercurial_dynamic_username
然而,由于Mercurial(无论是从TortoiseHg还是自己的包)使用它自己的捆绑Python,您必须通过指定路径来激活
[extensions] mercurial_dynamic_username = C:/Python27/Lib/site-packages/mercurial_dynamic_username.py ;; Or wherever pip installed it
要升级到新版本
pip --upgrade mercurial_dynamic_username
如果您没有任何Python,克隆仓库
cd c:\hgplugins hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/ hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/
更新到标记版本,并通过路径激活
[extensions] mercurial_dynamic_username = C:/hgplugins/mercurial-dynamic_username/mercurial_dynamic_username.py ;; Or wherever you cloned
有关Windows安装的更多详细信息,请参阅mercurial_extension_utils文档。
第6节 历史
请参阅HISTORY.rst
第7节 存储库,错误报告,增强建议
开发跟踪在HeptaPod上,请参阅https://foss.heptapod.net/mercurial/mercurial-dynamic_username/
使用该处的问题跟踪器进行错误报告和增强建议。
感谢Octobus和Clever Cloud提供此服务托管。
第8节 其他说明
有关此扩展的信息也可在Mercurial Wiki上找到:http://mercurial.selenic.com/wiki/DynamicUsernameExtension
还可以查看我编写的其他Mercurial扩展。
项目详情
mercurial_dynamic_username-1.1.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1449ce6878e826e77352b96b2b8b407287ddf2b075e77a4a490cd9671aed7962 |
|
MD5 | 9c408610d104da8a5c3f630a2022ef80 |
|
BLAKE2b-256 | d6cdc19f822c946f34d459965a184bc467a8bb6fcb7e2b8bdb865c57de1ebb15 |