public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: repoman/man/, repoman/pym/repoman/
@ 2016-09-16 19:37 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-09-16 19:37 UTC (permalink / raw
  To: gentoo-commits

commit:     3aa9b7ad3e12d0c4b1177d6a52a02ae14edff3d5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 15 22:28:47 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Sep 16 19:36:09 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3aa9b7ad

repoman: Update man page and commitmsgfile option

Use .lower() on the leading 9 characters of the message text for the substitution
test.
Update the man page for this new templating capability.

 repoman/man/repoman.1          | 6 +++++-
 repoman/pym/repoman/actions.py | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index 4a9122e..8df3207 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -109,7 +109,11 @@ Behave as if no package.mask entries exist (not allowed with commit mode)
 Adds a commit message via the command line
 .TP
 \fB-M\fR, \fB--commitmsgfile\fR
-Adds a commit message from the specified file
+Adds a commit message from the specified file.  This option also will perform
+an automatic text substitution of a leading "cat/pkg: " string (upper or lower
+case) with the actual category/package prefix as defined by the required message
+format.  Use this option for templating a common commit message for multiple
+package updates.
 .TP
 \fB-V\fR, \fB--version\fR
 Show version info

diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
index 0534c29..796dbaf 100644
--- a/repoman/pym/repoman/actions.py
+++ b/repoman/pym/repoman/actions.py
@@ -108,7 +108,7 @@ class Actions(object):
 						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
-			if commitmessage[:9] in ("cat/pkg: ", "CAT/PKG: "):
+			if commitmessage[:9].lower() in ("cat/pkg: ",):
 				commitmessage = self.msg_prefix() + commitmessage[9:]
 
 		if not commitmessage or not commitmessage.strip():


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:master commit in: repoman/man/, repoman/pym/repoman/
@ 2017-09-11 20:32 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2017-09-11 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     342d3d5479b08d97635bc09615083b5a4493eb92
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  2 21:55:08 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 20:32:44 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=342d3d54

repoman: Unify usage of --bug and --closes options

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 = '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 = '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, )


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-11 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 19:37 [gentoo-commits] proj/portage:master commit in: repoman/man/, repoman/pym/repoman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2017-09-11 20:32 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox