Mercurial OnRemote 扩展
项目描述
在远程仓库(ssh/本地仓库)上执行某些Mercurial命令。
1 示例
我的两个主要用例
推送后更新远程目录
hg push staging hg onremote staging update -r tip
检查状态并在远程目录中进行提交(如有必要)
hg onremote rhdevel status hg onremote rhdevel commit -m 'Forgotten typo'
在这些示例中,staging和rhdevel是远程路径,映射到类似于ssh://some.machine.net/repos/myrepo(本地路径也可以)的URL。
显式路径也可以,但不太方便
hg onremote ssh://euler.mydev.net/repos/myrepo status
2 参数
通用命令语法
hg onremote «remote» «command» «arguments»
其中 «remote» 是远程仓库别名或路径,其余参数构成正常的Mercurial命令。
选项 --ssh 可以像push或pull一样使用
hg onremote --ssh /custom/ssh staging status
3 工作原理
此扩展仅解析指定的路径,
如果它映射到本地目录,则执行 hg --cwd that/directory «command» «arguments»
如果它映射到ssh路径,则执行 ssh that/machine hg --cwd that/directory «command» «arguments»
在其他地方(如http或其他远程)则无法正常工作。
这并没有什么特别神奇的地方,扩展的目的是为了节省一些按键操作并避免流程中断(我主要写这个扩展是为了停止编写各种 push和update 脚本)。
4 配置
目前还没有专门的配置。
使用标准的mercurial设置来决定如何调用ssh以及调用哪个远程命令来启动Mercurial(请参见[ui]部分中的ssh和remotecmd设置)。这样,onremote使用与hg push和hg pull相同的ssh命令,以及相同的mercurial名称。
5 问题和限制
由于缺少完全工作的控制台,交互式命令可能无法正常工作。我建议避免触发交互式提示或编辑器启动的命令。如果您尝试hg onremote commit,请添加-m "Some message"。
6 安装
需要Mercurial ≥ 3.4(在旧版本上运行将导致崩溃)并且强烈建议使用Mercurial ≥ 4.5(3.4-4.4版本涉及一些可能的失败的处理)。
6.1 Linux/Unix(从PyPI)
如果您有工作的pip或easy_install
pip install --user mercurial_on_remote
或者
sudo pip install mercurial_on_remote
(或者使用easy_install代替pip)。然后通过以下方式激活
[extensions] mercurial_on_remote =
要升级,重复相同的命令并使用--upgrade选项,例如
pip install --user --upgrade mercurial_on_remote
6.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-on_remote/
更新到最新标签
激活
[extensions] mercurial_on_remote = ~/sources/mercurial-on_remote/mercurial_on_remote.py
要升级,请进行拉取和更新。
有关此类安装的更详细说明,请参阅mercurial_extension_utils。
6.3 Windows
如果您安装了任何Python,可以使用pip进行安装
pip install mercurial_on_remote
然而,由于Mercurial(无论是从TortoiseHg还是自己的包)使用它自己的捆绑Python,您必须通过指定路径来激活
[extensions] mercurial_on_remote = C:/Python27/Lib/site-packages/mercurial_on_remote.py ;; Or wherever pip installed it
要升级到新版本
pip --upgrade mercurial_on_remote
如果您没有任何Python,请克隆仓库
cd c:\hgplugins hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/ hg clone https://foss.heptapod.net/mercurial/mercurial-on_remote/
更新到标记版本并通过路径激活
[extensions] mercurial_on_remote = C:/hgplugins/mercurial-on_remote/mercurial_on_remote.py ;; Or wherever you cloned
有关Windows安装的更多详细信息,请参阅mercurial_extension_utils文档。
7 历史
请参阅HISTORY.rst
8 仓库、错误报告、增强建议
开发在HeptaPod上跟踪,请参阅https://foss.heptapod.net/mercurial/mercurial-on_remote/
使用问题跟踪器进行错误报告和改进建议。
感谢Octobus和Clever Cloud提供这项服务。
9 附加说明
有关此扩展的信息也可在Mercurial Wiki上找到: http://mercurial.selenic.com/wiki/OnRemoteExtension
请参阅我编写的其他Mercurial扩展:其他Mercurial扩展。
项目详情
mercurial_on_remote-1.0.6.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 365c35bf7855f7110d0380d5f65a83f29bd59c7440ddda82f6b40047a6535ca8 |
|
MD5 | 0735a039ffe8b3b488478e234b27be0e |
|
BLAKE2b-256 | 296472176663815f137a5a8426fc7a4bf7c8348ca4534b095a041bb8af8fee1e |