本文整理汇总了Python中gbp.deb.git.DebianGitRepository.get_pristine_tar_commit方法的典型用法代码示例。如果您正苦于以下问题:Python DebianGitRepository.get_pristine_tar_commit方法的具体用法?Python DebianGitRepository.get_pristine_tar_commit怎么用?Python DebianGitRepository.get_pristine_tar_commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.deb.git.DebianGitRepository
的用法示例。
在下文中一共展示了DebianGitRepository.get_pristine_tar_commit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gbp.deb.git import DebianGitRepository [as 别名]
# 或者: from gbp.deb.git.DebianGitRepository import get_pristine_tar_commit [as 别名]
def main(argv):
retval = 1
branch = None
dest = None
to_push = {
'refs': [],
'tags': [],
}
(options, args) = parse_args(argv)
if not options:
return ExitCodes.parse_error
if len(args) > 2:
gbp.log.err("Only a single remote repository can be given")
elif len(args) == 2:
dest = args[1]
gbp.log.setup(options.color, options.verbose, options.color_scheme)
try:
repo = DebianGitRepository(os.path.curdir, toplevel=False)
except GitRepositoryError:
gbp.log.err("%s is not inside a git repository" % (os.path.abspath('.')))
return 1
try:
source = DebianSource(repo.path)
branch = repo.branch
if not options.ignore_branch:
if branch != options.debian_branch:
gbp.log.err("You are not on branch '%s' but %s" %
(options.debian_branch,
"on '%s'" % branch if branch else 'in detached HEAD state'))
raise GbpError("Use --ignore-branch to ignore or --debian-branch to set the branch name.")
if not dest:
dest = get_remote(repo, branch)
if options.debian_tag != '':
dtag = repo.version_to_tag(options.debian_tag, source.version)
if repo.has_tag(dtag):
to_push['tags'].append(dtag)
if source.is_releasable() and branch:
ref = 'refs/heads/%s' % branch
to_push['refs'].append((ref, get_push_src(repo, ref, dtag)))
if not source.is_native():
if options.upstream_tag != '':
utag = repo.version_to_tag(options.upstream_tag,
source.upstream_version)
if repo.has_tag(utag):
to_push['tags'].append(utag)
if options.upstream_branch != '':
ref = 'refs/heads/%s' % options.upstream_branch
to_push['refs'].append((ref, get_push_src(repo, ref, utag)))
if options.pristine_tar:
commit = repo.get_pristine_tar_commit(source)
if commit:
ref = 'refs/heads/pristine-tar'
to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
if do_push(repo, [dest], to_push, dry_run=options.dryrun):
retval = 0
else:
gbp.log.err("Failed to push some refs.")
retval = 1
except (GbpError, GitRepositoryError, DebianSourceError) as err:
if str(err):
gbp.log.err(err)
except KeyboardInterrupt:
gbp.log.err("Interrupted. Aborting.")
return retval