-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Closes tags with custom Bugzilla resolution #190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! This is great :)
src/pkgdev/const.py
Outdated
@@ -40,3 +40,8 @@ def _GET_CONST(attr, default_value): | |||
USER_CONF_FILE = os.path.join(getattr(_module, "USER_CONFIG_PATH"), "pkgdev.conf") | |||
SYSTEM_CONF_FILE = "/etc/pkgdev/pkgdev.conf" | |||
BUNDLED_CONF_FILE = os.path.join(DATA_PATH, "pkgdev.conf") | |||
|
|||
BZ_FIXED = "fixed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please define it using python's enum.Enum
, you can get all the know values from it
src/pkgdev/scripts/pkgdev_commit.py
Outdated
raise ValueError("URL-like value without resolution") | ||
res = res.lower() if res else const.BZ_FIXED | ||
if not (bug and res in const.BZ_RESOLUTIONS): | ||
raise argparse.ArgumentError(self, f"invalid commit tag: {values}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise argparse.ArgumentError(self, f"invalid commit tag: {values}") | |
raise argparse.ArgumentError(self, f"invalid commit tag {res!r}, should be one of: {values}") |
src/pkgdev/scripts/pkgdev_commit.py
Outdated
return | ||
|
||
url = self.parse_url(bug) | ||
is_bgo = url.split("//", 1)[1].startswith("bugs.gentoo.org") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_bgo = url.split("//", 1)[1].startswith("bugs.gentoo.org") | |
is_bgo = "bugs.gentoo.org" in url |
We can be simpler, even if not 100% quality check
Thanks for the feedback! I've been busy all week and I'll be implementing it on Sunday. Sorry for the delay! |
Support resolutions FIXED, OBSOLETE and PKGREMOVED, provided that the bug belongs to b.g.o. The default and fallback resolution is FIXED. Together with server-side changes to https://gitweb.gentoo.org/infra/githooks.git/, this patch allows Gentoo contributors to generate commit tags that cause bugs to be closed automatically with the indicated resolution. Currently, only the string after the last colon in the argument is significant for the resolution. Therefore, one could theoretically craft invalid tags such as 'Closes: https://bugs.gentoo.org/123:foo (obsolete)' Signed-off-by: Lucio Sauer <[email protected]>
Signed-off-by: Lucio Sauer <[email protected]>
_comp_ltrim_colon_completions was introduced with >=bash-completion-2.12 Signed-off-by: Lucio Sauer <[email protected]>
Signed-off-by: Lucio Sauer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you very much, looks and works great!
This PR is part of a larger effort[1] to automate resolving bugs on Gentoo's Bugzilla with the correct resolutions.
The command line syntax would be:
<bug>:<resolution>
for a given bgo bug with an explicit resolution<bug>:
or<bug>
for any bug without a resolution (implicitlyFIXED
for a bgo bug)Apart from
FIXED
, I chose to support:OBSOLETE
e.g. for when older versions of a package get dropped which implicitly fixes a bugPKGREMOVED
to encourage its adoption for the removal of packagesIf you think any resolutions are missing here, please tell me!
I wasn't sure how to handle malformed URL-like input with multiple colons like
https://foo:bar:obsolete
. Currently, it gets converted into aCloses: https://foo:bar (obsolete)
tag, similar to how-T/--tag
does it.[1]: Patch for infra's githooks: https://bugs.gentoo.org/934825