Mercurial 中有设置默认路径的命令吗?
hg clone
设置默认路径,这样每次拉取和推送时不用指定url。
hg clone ssh://[email protected]/account/repository
但是,如果您有一个现有的本地存储库并决定在 bitbucket 上共享它,您将无法获得默认路径设置。
hg push ssh://[email protected]/account/repository
是否有命令来设置默认路径,或者我是否被迫手动编辑 .hg/hgrc?
hg clone
sets up the default path, so that you can pull and push without specifying the url every time.
hg clone ssh://[email protected]/account/repository
But if you have an existing local repository and decide to share it on bitbucket, you won't get the default path setup for you.
hg push ssh://[email protected]/account/repository
Is there a command to set the default path or am I forced to manually edit .hg/hgrc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有、也不会有这样的命令。其中一次,Mercurial 的主要作者 Matt tweet 表示:
您可以通过将其放入您个人的
.hgrc
中,使hg erc
命令打开该编辑器:(最后来自 Steve Losh)
如果您想变得更奇特,您可以这样做一个使用 sed 或类似工具修改
.hg\hgrc
文件的post-clone
挂钩,但您很快就不会在 Mercurial 中找到该功能。There isn't a command for this and there won't be one. One of the times this was suggested the primary author of Mercurial, Matt, tweeted:
You can make the
hg erc
command open up that editor by putting this in your personal.hgrc
:(that last from Steve Losh)
If you want to get fancy you could do a
post-clone
hook that modifies the.hg\hgrc
file using sed or similar, but you'll not find that functionality in Mercurial any time soon.不,没有内置命令;您需要自己将其添加到 .hg/hgrc 中。
No, there's no builtin command; you need to add it in .hg/hgrc yourself.
如果您正在运行 TortoiseHg,您还可以打开存储库资源管理器并选择同步 -> 配置路径...这将允许您定义默认路径以及您可能需要的任何其他路径。例如,您可以使用别名“bitbucket”配置路径,并使用本地克隆、服务器副本等的默认路径...
以这种方式所做的更改不会存储在 .hgrc 或 Mercurial.ini 文件中,因为它们每个存储库 - 它们存储在 .hg 目录中。
If you're running TortoiseHg, you can also bring up the Repository Explorer and select Synchronize->Configure Paths... this will allow you to define the default path, and any additional paths you may want. For example, you could configure a path with the alias 'bitbucket' and use your default path for a local clone, server copy, etc...
Changes made in this fashion are not stored in the .hgrc or Mercurial.ini file because they are per repo - they are instead stored in the .hg directory.