本文整理汇总了Python中git.cmd.Git.branch方法的典型用法代码示例。如果您正苦于以下问题:Python Git.branch方法的具体用法?Python Git.branch怎么用?Python Git.branch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.cmd.Git
的用法示例。
在下文中一共展示了Git.branch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_branches
# 需要导入模块: from git.cmd import Git [as 别名]
# 或者: from git.cmd.Git import branch [as 别名]
def init_branches(options, error, info, debug):
path = getcwd()
git = Git(path)
create = options.release_tool_settings['branches']
for branch in create:
debug('creating branch "%s"...' % branch)
debug(git.branch(branch))
info('Created branches ' + ', '.join(create))
示例2: renameRelease
# 需要导入模块: from git.cmd import Git [as 别名]
# 或者: from git.cmd.Git import branch [as 别名]
def renameRelease(self, name, new_name):
super(PuppetInstallMethod, self).renameRelease(name, new_name)
with puppet_lock:
# Path conversation
name = name.replace("/", "@")
new_name = new_name.replace("/", "@")
# Check if we've origins
if len([f for f in os.listdir(self.__work_path) if f.startswith(name)]) > 1:
raise ValueError("cannot rename release which contains childs")
# Go for it
current_dir = os.path.join(self.__work_path, name)
cmd = Git(current_dir)
cmd.branch("-m", name, new_name)
cmd.push("origin", ":" + name)
cmd.push("origin", new_name)
os.rename(current_dir, os.path.join(self.__work_path, new_name))
return True
示例3: get_all_remote_branch
# 需要导入模块: from git.cmd import Git [as 别名]
# 或者: from git.cmd.Git import branch [as 别名]
def get_all_remote_branch(url):
tmp = tempfile.mkdtemp(prefix="repo_br")
git = Git(tmp)
git.clone(url, tmp)
return [b.strip()[len('origin/'):] for b in git.branch('--remote').splitlines() if not 'HEAD' in b]