git+gerrit clone 脚本
来源:互联网 发布:复制淘口令淘宝没反应 编辑:程序博客网 时间:2024/05/16 18:15
使用gerrit作为code Review平台后,克隆代码的简易方法,写了个脚本,工作中常用到:
#!/usr/bin/env python# coding=utf-8 # for git clone helper# author: jason # import os, sysGERRIT_SERVER="192.168.1.187"GERRIT_LISTEN_PORT="29419"GIT_REPO_NAME=""SSH_CLONE_FULL_CMD=""GERRIT_HOOKS_CMD="" WHOAMI=""def hello():print '\033[0;32;40m'#print 50*('*')print print '\tGerrit source code clone tools'print print 50*("*")print '\033[0m'def __exit(x):sys.exit(x)def error_color():print '\033[0;31;40m'def normal_color():print '\033[0m'def get_username():global WHOAMIWHOAMI = os.popen('whoami').read().strip()def prep_git_repo():global GIT_REPO_NAMEGIT_REPO_NAME=raw_input("Please input the dest Git Repository:")if (len(GIT_REPO_NAME) <= 0):error_color()print "Invalid Git Repository, You entered NULL value!"normal_color()__exit(1)print("The dest Git Repo is %s") % GIT_REPO_NAMEdef prep_ssh_clone_str():global SSH_CLONE_FULL_CMDglobal GIT_REPO_NAMEglobal WHOAMI global GERRIT_SERVERglobal GERRIT_LISTEN_PORTSSH_CLONE_FULL_CMD = "git clone ssh://"+WHOAMI+"@"+GERRIT_SERVER+":"+GERRIT_LISTEN_PORT+"/"+GIT_REPO_NAMEprint SSH_CLONE_FULL_CMDdef prep_gerrit_hooks():global WHOAMIglobal GIT_REPO_NAMEglobal GERRIT_HOOKS_CMDglobal GERRIT_LISTEN_PORTglobal GERRIT_SERVERGERRIT_HOOKS_CMD = "scp -p -P " + GERRIT_LISTEN_PORT + " " + WHOAMI+ "@" + GERRIT_SERVER + ":hooks/commit-msg " + GIT_REPO_NAME + "/.git/hooks/"print GERRIT_HOOKS_CMDdef do_shell_cmd(CMD):os.system(CMD)def do_git_clone():global GERRIT_HOOKS_CMDglobal SSH_CLONE_FULL_CMDget_username()prep_git_repo()prep_ssh_clone_str()prep_gerrit_hooks()do_shell_cmd(SSH_CLONE_FULL_CMD)do_shell_cmd(GERRIT_HOOKS_CMD)print '\033[0;32;40m'print "Git Clone done!"normal_color()if __name__ == "__main__":hello()do_git_clone()__exit(0)
直接执行该脚本即可.
0 0
- git+gerrit clone 脚本
- Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- git clone https://gerrit.fd.io/r/vpp ./ 失败
- git 同步脚本&& git clone 远程分支
- git-gerrit
- git gerrit
- 完美解决repo init 错误 fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- 解决repo init 错误 fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- 解决repo init 错误 fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- (OK) fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- android N7.1 下载fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 解决方法
- repo init报错Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
- windows下使用BAT批处理脚本批量git clone代码
- git clone
- git clone
- git clone
- git clone
- Spring Boot——开发新一代Spring Java应用
- 关于python中@property的使用
- Android性能优化之Battery-Historian(一)
- iOS- 浅谈视频播放的N种解决方案
- 内部类总结
- git+gerrit clone 脚本
- Read / Write Locks in Java
- Android 游戏编程
- [290] Word Pattern
- hdu5733 tetrahedron(计算几何)
- html前端几种加密方式的整理
- 红黑树知识点小结
- javaMail
- Eclipse中使用JUnit进行单元测试