本文整理汇总了Python中gbp.deb.git.DebianGitRepository.commit_files方法的典型用法代码示例。如果您正苦于以下问题:Python DebianGitRepository.commit_files方法的具体用法?Python DebianGitRepository.commit_files怎么用?Python DebianGitRepository.commit_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.deb.git.DebianGitRepository
的用法示例。
在下文中一共展示了DebianGitRepository.commit_files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gbp.deb.git import DebianGitRepository [as 别名]
# 或者: from gbp.deb.git.DebianGitRepository import commit_files [as 别名]
#.........这里部分代码省略.........
if args:
gbp.log.info("Only looking for changes on '%s'" % " ".join(args))
commits = repo.get_commits(since=since, until=until, paths=args, options=options.git_log.split(" "))
commits.reverse()
# add a new changelog section if:
if options.new_version or options.bpo or options.nmu or options.qa or options.team or options.security:
if options.bpo:
version_change["increment"] = "--bpo"
elif options.nmu:
version_change["increment"] = "--nmu"
elif options.qa:
version_change["increment"] = "--qa"
elif options.team:
version_change["increment"] = "--team"
elif options.security:
version_change["increment"] = "--security"
else:
version_change["version"] = options.new_version
# the user wants to force a new version
add_section = True
elif cp["Distribution"] != "UNRELEASED" and not found_snapshot_banner and commits:
# the last version was a release and we have pending commits
add_section = True
elif options.snapshot and not found_snapshot_banner:
# the user want to switch to snapshot mode
add_section = True
else:
add_section = False
if add_section and not version_change and not source.is_native():
# Get version from upstream if none provided
v = guess_version_from_upstream(repo, options.upstream_tag, cp)
if v:
version_change["version"] = v
i = 0
for c in commits:
i += 1
parsed = parse_commit(repo, c, options, last_commit=i == len(commits))
commit_msg, (commit_author, commit_email) = parsed
if not commit_msg:
# Some commits can be ignored
continue
if add_section:
# Add a section containing just this message (we can't
# add an empty section with dch)
cp.add_section(
distribution="UNRELEASED",
msg=commit_msg,
version=version_change,
author=commit_author,
email=commit_email,
dch_options=dch_options,
)
# Adding a section only needs to happen once.
add_section = False
else:
cp.add_entry(commit_msg, commit_author, commit_email, dch_options)
# Show a message if there were no commits (not even ignored
# commits).
if not commits:
gbp.log.info("No changes detected from %s to %s." % (since, until))
if add_section:
# If we end up here, then there were no commits to include,
# so we put a dummy message in the new section.
cp.add_section(
distribution="UNRELEASED", msg=["UNRELEASED"], version=version_change, dch_options=dch_options
)
fixup_section(repo, git_author=options.git_author, options=options, dch_options=dch_options)
if options.release:
do_release(changelog, repo, cp, git_author=options.git_author, dch_options=dch_options)
elif options.snapshot:
(snap, version) = do_snapshot(changelog, repo, options.snapshot_number)
gbp.log.info("Changelog has been prepared for snapshot #%d at %s" % (snap, version))
if editor_cmd:
gbpc.Command(editor_cmd, ["debian/changelog"])()
if options.commit:
# Get the version from the changelog file (since dch might
# have incremented it, there's no way we can already know
# the version).
version = ChangeLog(filename=changelog).version
# Commit the changes to the changelog file
msg = changelog_commit_msg(options, version)
repo.commit_files([changelog], msg)
gbp.log.info("Changelog has been committed for version %s" % version)
except (gbpc.CommandExecFailed, GbpError, GitRepositoryError, DebianSourceError, NoChangeLogError) as err:
if len(err.__str__()):
gbp.log.err(err)
ret = 1
return ret
示例2: main
# 需要导入模块: from gbp.deb.git import DebianGitRepository [as 别名]
# 或者: from gbp.deb.git.DebianGitRepository import commit_files [as 别名]
#.........这里部分代码省略.........
if args:
gbp.log.info("Only looking for changes on '%s'" % " ".join(args))
commits = repo.get_commits(since=since, until=until, paths=args,
options=options.git_log.split(" "))
commits.reverse()
# add a new changelog section if:
if options.new_version or options.bpo or options.nmu or options.qa or options.team:
if options.bpo:
version_change['increment'] = '--bpo'
elif options.nmu:
version_change['increment'] = '--nmu'
elif options.qa:
version_change['increment'] = '--qa'
elif options.team:
version_change['increment'] = '--team'
else:
version_change['version'] = options.new_version
# the user wants to force a new version
add_section = True
elif cp['Distribution'] != "UNRELEASED" and not found_snapshot_header and commits:
# the last version was a release and we have pending commits
add_section = True
elif options.snapshot and not found_snapshot_header:
# the user want to switch to snapshot mode
add_section = True
else:
add_section = False
i = 0
for c in commits:
i += 1
parsed = parse_commit(repo, c, options,
last_commit = i == len(commits))
commit_msg, (commit_author, commit_email) = parsed
if not commit_msg:
# Some commits can be ignored
continue
if add_section:
# Add a section containing just this message (we can't
# add an empty section with dch)
add_changelog_section(distribution="UNRELEASED", msg=commit_msg,
version=version_change,
author=commit_author,
email=commit_email,
dch_options=dch_options,
repo=repo,
options=options,
cp=cp)
# Adding a section only needs to happen once.
add_section = False
else:
add_changelog_entry(commit_msg, commit_author, commit_email, dch_options)
# Show a message if there were no commits (not even ignored
# commits).
if not commits:
gbp.log.info("No changes detected from %s to %s." % (since, until))
if add_section:
# If we end up here, then there were no commits to include,
# so we put a dummy message in the new section.
add_changelog_section(distribution="UNRELEASED", msg=["UNRELEASED"],
version=version_change,
dch_options=dch_options,
repo=repo,
options=options,
cp=cp)
fixup_trailer(repo, git_author=options.git_author,
dch_options=dch_options)
if options.release:
do_release(changelog, repo, cp, git_author=options.git_author,
dch_options=dch_options)
elif options.snapshot:
(snap, version) = do_snapshot(changelog, repo, options.snapshot_number)
gbp.log.info("Changelog has been prepared for snapshot #%d at %s" % (snap, version))
if editor_cmd:
gbpc.Command(editor_cmd, ["debian/changelog"])()
if options.commit:
# Get the version from the changelog file (since dch might
# have incremented it, there's no way we can already know
# the version).
version = ChangeLog(filename=changelog).version
# Commit the changes to the changelog file
msg = changelog_commit_msg(options, version)
repo.commit_files([changelog], msg)
gbp.log.info("Changelog has been committed for version %s" % version)
except (GbpError, GitRepositoryError, NoChangeLogError) as err:
if len(err.__str__()):
gbp.log.err(err)
ret = 1
return ret