配置bzr 在push的时候 &…
2015-01-18 20:16
155 查看
最近需要调整代码的跨平台测试框架,需要在bzr push代码的时候自动触发 测试。
首先将附录的代码放到一个文件中,如push.py,并放在.bazaar/plugins 下
假设代码库位于 172.16.74.152/repo下
本地branch出的目录为/home/user/local-repo
然后在 172.16.74.152/repo 目录下.bzr/branch/branch.conf文件以及本
地/home/user/local-repo目录下.bzr/branch/branch.conf文件中添加
[hooks]
post_push = echo "a";wget -o /dev/null http://localhost:8080/job/greatsql_proxy_2/build
注: “post_push =” 后加需要执行shell 命令
可能还需要配置172.16.74.152机器与本地机的免ssh验证。
附录1
#!/usr/bin/python
from bzrlib import hooks
from bzrlib.branch import Branch
from bzrlib.config import TreeConfig
from bzrlib.errors import BzrError
import subprocess
import os
def branch_base(local, master):
if local is
None:
branch = master
else:
branch = local
return
branch.base
def run_hook_command(local, master, name, args):
if local is
None:
branch = master
else:
branch = local
config =
TreeConfig(branch)
command =
config.get_option(name, section="hooks")
if command
is None:
print "Missing conf for hook"
return
print
"Command %s" % command
os.system(command)
def post_push_hook(result):
print "My
new revno is %d" % result.new_revno
run_hook_command(result.local_branch,
result.master_branch,"post_push",
[branch_base(result.local_branch, result.master_branch),
result.source_branch.base, str(result.old_revno),
result.old_revid, str(result.new_revno), result.new_revid])
转载请注明出自 高孝鑫 的博客
首先将附录的代码放到一个文件中,如push.py,并放在.bazaar/plugins 下
假设代码库位于 172.16.74.152/repo下
本地branch出的目录为/home/user/local-repo
然后在 172.16.74.152/repo 目录下.bzr/branch/branch.conf文件以及本
地/home/user/local-repo目录下.bzr/branch/branch.conf文件中添加
[hooks]
post_push = echo "a";wget -o /dev/null http://localhost:8080/job/greatsql_proxy_2/build
注: “post_push =” 后加需要执行shell 命令
可能还需要配置172.16.74.152机器与本地机的免ssh验证。
附录1
#!/usr/bin/python
from bzrlib import hooks
from bzrlib.branch import Branch
from bzrlib.config import TreeConfig
from bzrlib.errors import BzrError
import subprocess
import os
def branch_base(local, master):
if local is
None:
branch = master
else:
branch = local
return
branch.base
def run_hook_command(local, master, name, args):
if local is
None:
branch = master
else:
branch = local
config =
TreeConfig(branch)
command =
config.get_option(name, section="hooks")
if command
is None:
print "Missing conf for hook"
return
"Command %s" % command
os.system(command)
def post_push_hook(result):
print "My
new revno is %d" % result.new_revno
run_hook_command(result.local_branch,
result.master_branch,"post_push",
[branch_base(result.local_branch, result.master_branch),
result.source_branch.base, str(result.old_revno),
result.old_revid, str(result.new_revno), result.new_revid])
转载请注明出自 高孝鑫 的博客
相关文章推荐
- 配置 bazaar 在提交代码的时候 向…
- Enterprise Manager配置失败解决方案
- BUG!!!======> 配置git时候 报错 "error: failed to push some refs to "
- Apache 下配置 mod_Rewrite
- 3 Nginx的基本配置和优化
- 6 Nginx负载均衡和反向代理配置
- MOSS 配置SSO的时候可能遇到"您没有执行此操作的权限"的错误
- centOS LD 环境变量配置
- Ubuntu 下的VSFTP配置
- ORACLE:实例化 EM 配置文件时出错…
- SUBLIME TEXT 2 配置文件详解
- 很重要!!!ssh集成的时候struts2 和 spring3集成一定要在struts.xml文件里配置!<constant name="struts.objectFactory" value="sp
- 配置SSH&nbsp;解决Agent&nbsp;admitted&nbsp;failu…
- [原创]opencv学习之配置eclipse&nbsp;QT…
- 配置hadoop&nbsp;使用fair&nbsp;sc…
- 编写的exe在别的机器上运行的时候总是报错 "找不到MSVCR100.dll 请重新安装",编译的机器上又不会报,这是怎么回事啊?是不是因为编译的机器上有特殊的配置?
- jsp 运行环境的配置之Tomcat7 设置…
- Eclipse与apach tomacat配置
- PHP+CKEditor&nbsp;3配置详细说明(包括…
- PHP array_push() 函数