在每次提交善变自动推送 [英] mercurial automatic push on every commit
问题描述
我们是很熟悉的颠覆工作流和事实,我的电脑连接到互联网,99.9%的时间,我不喜欢做'汞词和汞推分开。
Being very familiar with the subversion workflow and that fact that 99.9% of the time my computer is connected to the internet, I don't like doing 'hg ci' and 'hg push' separately.
我记得有BZR将约束后继提交命令来自动直接提交到服务器(推)一结账命令。
I remember bzr had a 'checkout' command that would bind subsequent 'commit' commands to automatically commit directly to the server ('push').
善变是否有类似这样的东西吗?
Does mercurial have something similar to this?
PS:写一个shell脚本或别名运行汞CI $ *&放大器;&安培;汞推是我做的最后一件事。
PS: Writing a shell script or alias that runs 'hg ci $* && hg push' would be the last thing I'd do.
推荐答案
您可以添加的勾后成功提交运行的推动。
You could add a hook to run push after a successful commit.
编辑:我只是想出来,它似乎很好地工作。我增加了以下内容我想激活自动推动储备库的 .hg / hgrc
文件:
I just tried it out and it seems to work fine. I added the following to the .hg/hgrc
file of the repository I wanted to activate automatic pushing for:
[hooks]
commit.autopush = hg push
编辑2:同时,您不要不必担心这样的事情:
EDIT 2: Also, you don't have to worry about something like this:
- 您是在您存储库不要自动推送。
- 您使用
汞-R〜/另一-回购的-autopushes提交
在不同的回购该提交确实自动推送。 - 将在
汞推
挂钩最终推动在当前目录下,而不是你的? 犯下的一个变化
- You're in a repository that you don't want to automatically push.
- You use
hg -R ~/another-repo-that-autopushes commit
to commit in a different repo that does automatically push. - Will the
hg push
hook end up pushing the changes in the current directory instead of the one you're committing in?
没有,也不会。根据页面我联系:
No, it won't. According to the page I linked:
这是可执行钩总是设置为存储库的根目录下的当前目录运行。
An executable hook is always run with its current directory set to a repository's root directory.
这是一个边缘的情况下,但水银正确处理它。
It's an edge case, but Mercurial handles it correctly.
这篇关于在每次提交善变自动推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!