1 |
Replace the different logic used for --bug and --closes options with |
2 |
a uniform solution. As a result, --closes now interprets numbers |
3 |
as Gentoo bug numbers rather than GitHub pull request numbers. |
4 |
|
5 |
This change is mostly done since the 'Closes' tag now started being used |
6 |
to resolve Gentoo bugs. While changing the logic could be confusing, |
7 |
it has not made it into a release yet and the GitHub default would not |
8 |
be very useful anyway. |
9 |
|
10 |
After all, repoman is normally used to commit the changes before a pull |
11 |
request is created, which implies that the user does not know the pull |
12 |
request number yet. The 'Closes' tag for pull request is usually added |
13 |
by the reviewer before merging, using 'git --amend' since repoman has |
14 |
no amending option. That considered, it is quite unlikely that anyone |
15 |
would find --closes with pull request numbers useful. |
16 |
--- |
17 |
repoman/man/repoman.1 | 7 ++++--- |
18 |
repoman/pym/repoman/actions.py | 17 ++++------------- |
19 |
2 files changed, 8 insertions(+), 16 deletions(-) |
20 |
|
21 |
diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1 |
22 |
index a49c72c0d..41df8ed2f 100644 |
23 |
--- a/repoman/man/repoman.1 |
24 |
+++ b/repoman/man/repoman.1 |
25 |
@@ -31,9 +31,10 @@ is forced for known bug trackers. |
26 |
\fB-c\fR, \fB--closes\fR |
27 |
Include a \fBCloses\fR tag in the commit message footer that can be used |
28 |
to close pull requests (and issues) on GitHub and other compatible |
29 |
-services (GitLab, Bitbucket). The argument can be either a PR number for |
30 |
-the gentoo/gentoo GitHub repository or a full PR/bug URL. For bug URLs, |
31 |
-HTTPS is forced automatically for known bug/PR trackers. |
32 |
+services (GitLab, Bitbucket). The argument can be either a Gentoo bug |
33 |
+number or a full PR/bug URL. Gentoo bug URLs are automatically shortened |
34 |
+to the canonical \fBhttps://bugs.gentoo.org/NNNNNN\fR form, and HTTPS |
35 |
+is forced for known bug trackers. |
36 |
.TP |
37 |
\fB\-\-digest=<y|n>\fR |
38 |
Automatically update Manifest digests for modified files. This |
39 |
diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py |
40 |
index 2112299c0..b76a6e466 100644 |
41 |
--- a/repoman/pym/repoman/actions.py |
42 |
+++ b/repoman/pym/repoman/actions.py |
43 |
@@ -357,7 +357,9 @@ class Actions(object): |
44 |
|
45 |
# Common part of commit footer |
46 |
commit_footer = "\n" |
47 |
- for bug in self.options.bug: |
48 |
+ for tag, bug in chain( |
49 |
+ (('Bug', x) for x in self.options.bug), |
50 |
+ (('Closes', x) for x in self.options.closes)): |
51 |
# case 1: pure number NNNNNN |
52 |
if bug.isdigit(): |
53 |
bug = 'https://bugs.gentoo.org/%s' % (bug, ) |
54 |
@@ -374,18 +376,7 @@ class Actions(object): |
55 |
elif (purl.scheme == 'http' and |
56 |
purl.netloc in self.https_bugtrackers): |
57 |
bug = urlunsplit(('https',) + purl[1:]) |
58 |
- commit_footer += "Bug: %s\n" % (bug, ) |
59 |
- |
60 |
- for closes in self.options.closes: |
61 |
- # case 1: pure number NNNN |
62 |
- if closes.isdigit(): |
63 |
- closes = 'https://github.com/gentoo/gentoo/pull/%s' % (closes, ) |
64 |
- else: |
65 |
- purl = urlsplit(closes) |
66 |
- # case 2: bug tracker w/ http -> https |
67 |
- if purl.netloc in self.https_bugtrackers: |
68 |
- closes = urlunsplit(('https',) + purl[1:]) |
69 |
- commit_footer += "Closes: %s\n" % (closes, ) |
70 |
+ commit_footer += "%s: %s\n" % (tag, bug) |
71 |
|
72 |
if dco_sob: |
73 |
commit_footer += "Signed-off-by: %s\n" % (dco_sob, ) |
74 |
-- |
75 |
2.14.1 |