Skip to content

Commit

Permalink
Merge pull request #1389
Browse files Browse the repository at this point in the history
improvements to pr-tool
  • Loading branch information
arogge committed Feb 23, 2023
2 parents 0658e55 + 8fce4b6 commit 50d68f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
- ua_restore: Add additional client info for restore report [PR #1374]
- restore: fix failed restores showing Restore ok with warning [PR #1387]
- FreeBSD: build cleanup [PR #1336]
- improvements to pr-tool [PR #1389]

### Removed
- remove no longer used pkglists [PR #1335]
Expand Down Expand Up @@ -61,4 +62,5 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
[PR #1374]: https://github.com/bareos/bareos/pull/1374
[PR #1378]: https://github.com/bareos/bareos/pull/1378
[PR #1387]: https://github.com/bareos/bareos/pull/1387
[PR #1389]: https://github.com/bareos/bareos/pull/1389
[unreleased]: https://github.com/bareos/bareos/tree/master
17 changes: 14 additions & 3 deletions devtools/pip-tools/pr_tool/main.py
@@ -1,7 +1,7 @@
#!/usr/bin/python3
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2022-2022 Bareos GmbH & Co. KG
# Copyright (C) 2022-2023 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -215,7 +215,9 @@ def __init__(self, commits):
def check_commit(self, commit):
headline, *messageBody = commit.message.split("\n")
issues = []
if messageBody[0] == "":
if len(messageBody) == 0:
issues.append("missing newline at end of headline")
elif messageBody[0] == "":
messageBody.pop(0)
else:
issues.append("missing empty line after headline")
Expand Down Expand Up @@ -386,6 +388,10 @@ def get_changelog_section(pr):
labels = get_plain_label_list(pr["labels"])
if "documentation" in labels:
return "Documentation"
if "bugfix" in labels:
return "Fixed"
if "removal" in labels:
return "Removed"
return guess_section(pr["title"])


Expand Down Expand Up @@ -594,7 +600,7 @@ def get_remote_ref(branch, owner="{owner}", repo="{repo}"):
def repo_up_to_date(repo, pr_data, remote_ref):
local_head = repo.commit(pr_data["_base_branch"])
remote_head = remote_ref["object"]["sha"]
return local_head != remote_head
return str(local_head) == str(remote_head)


def setup_logging(*, verbose, debug):
Expand Down Expand Up @@ -669,6 +675,11 @@ def main():
git_remote
)
)
if args.subcommand == "merge":
logging.critical(
"Merge will probably fail with an out-of-date repository, exiting"
)
return 2

if args.subcommand == "check":
ret = check_merge_prereq(repo, pr_data)
Expand Down

0 comments on commit 50d68f3

Please sign in to comment.