[PATCH v2 1/2] repoman: Unify usage of --bug and --closes options

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH v2 1/2] repoman: Unify usage of --bug and --closes options

Michał Górny-5
Replace the different logic used for --bug and --closes options with
a uniform solution. As a result, --closes now interprets numbers
as Gentoo bug numbers rather than GitHub pull request numbers.

This change is mostly done since the 'Closes' tag now started being used
to resolve Gentoo bugs. While changing the logic could be confusing,
it has not made it into a release yet and the GitHub default would not
be very useful anyway.

After all, repoman is normally used to commit the changes before a pull
request is created, which implies that the user does not know the pull
request number yet. The 'Closes' tag for pull request is usually added
by the reviewer before merging, using 'git --amend' since repoman has
no amending option. That considered, it is quite unlikely that anyone
would find --closes with pull request numbers useful.
---
 repoman/man/repoman.1          |  7 ++++---
 repoman/pym/repoman/actions.py | 17 ++++-------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index a49c72c0d..41df8ed2f 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -31,9 +31,10 @@ is forced for known bug trackers.
 \fB-c\fR, \fB--closes\fR
 Include a \fBCloses\fR tag in the commit message footer that can be used
 to close pull requests (and issues) on GitHub and other compatible
-services (GitLab, Bitbucket). The argument can be either a PR number for
-the gentoo/gentoo GitHub repository or a full PR/bug URL. For bug URLs,
-HTTPS is forced automatically for known bug/PR trackers.
+services (GitLab, Bitbucket). The argument can be either a Gentoo bug
+number or a full PR/bug URL. Gentoo bug URLs are automatically shortened
+to the canonical \fBhttps://bugs.gentoo.org/NNNNNN\fR form, and HTTPS
+is forced for known bug trackers.
 .TP
 \fB\-\-digest=<y|n>\fR
 Automatically update Manifest digests for modified files. This
diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
index 2112299c0..b76a6e466 100644
--- a/repoman/pym/repoman/actions.py
+++ b/repoman/pym/repoman/actions.py
@@ -357,7 +357,9 @@ class Actions(object):
 
  # Common part of commit footer
  commit_footer = "\n"
- for bug in self.options.bug:
+ for tag, bug in chain(
+ (('Bug', x) for x in self.options.bug),
+ (('Closes', x) for x in self.options.closes)):
  # case 1: pure number NNNNNN
  if bug.isdigit():
  bug = '<a href="https://bugs.gentoo.org/%s'">https://bugs.gentoo.org/%s' % (bug, )
@@ -374,18 +376,7 @@ class Actions(object):
  elif (purl.scheme == 'http' and
  purl.netloc in self.https_bugtrackers):
  bug = urlunsplit(('https',) + purl[1:])
- commit_footer += "Bug: %s\n" % (bug, )
-
- for closes in self.options.closes:
- # case 1: pure number NNNN
- if closes.isdigit():
- closes = '<a href="https://github.com/gentoo/gentoo/pull/%s'">https://github.com/gentoo/gentoo/pull/%s' % (closes, )
- else:
- purl = urlsplit(closes)
- # case 2: bug tracker w/ http -> https
- if purl.netloc in self.https_bugtrackers:
- closes = urlunsplit(('https',) + purl[1:])
- commit_footer += "Closes: %s\n" % (closes, )
+ commit_footer += "%s: %s\n" % (tag, bug)
 
  if dco_sob:
  commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
--
2.14.1


Reply | Threaded
Open this post in threaded view
|

[PATCH v2 2/2] repoman: Update --bug/--closes description for bugs.g.o hooks

Michał Górny-5
Update the description for --bug and --closes to account for the fact
that the tags are now handled by git hooks on Gentoo Infra, and cause
actions on Gentoo Bugzilla.
---
 repoman/man/repoman.1 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index 41df8ed2f..813bdae21 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -27,14 +27,23 @@ be either a Gentoo bug number or a full bug URL (either Gentoo
 or upstream). Gentoo bug URLs are automatically shortened to
 the canonical \fBhttps://bugs.gentoo.org/NNNNNN\fR form, and HTTPS
 is forced for known bug trackers.
+
+When pushing to the Gentoo repository, the reference to the commit
+will be automatically added as a comment on the bug.
 .TP
 \fB-c\fR, \fB--closes\fR
 Include a \fBCloses\fR tag in the commit message footer that can be used
-to close pull requests (and issues) on GitHub and other compatible
-services (GitLab, Bitbucket). The argument can be either a Gentoo bug
+to close bugs and pull requests. The argument can be either a Gentoo bug
 number or a full PR/bug URL. Gentoo bug URLs are automatically shortened
 to the canonical \fBhttps://bugs.gentoo.org/NNNNNN\fR form, and HTTPS
 is forced for known bug trackers.
+
+When pushing to the Gentoo repository, the referenced bugs will be
+closed as RESOLVED/FIXED automatically with a comment referencing
+the commit. Furthermore, GitHub pull requests will be closed as well
+due to the automatic GitHub mirroring.
+
+Other platforms using the \fBCloses\fR tag include GitLab and Bitbucket.
 .TP
 \fB\-\-digest=<y|n>\fR
 Automatically update Manifest digests for modified files. This
--
2.14.1