[PATCH 1/1] UBUNTU: SAUCE: Adopt the use of "BugLink:" lines in git commit messages.

Brad Figg brad.figg at canonical.com
Fri May 1 18:12:12 UTC 2009


>From rtg:

  I think there are a couple of good reasons for doing this.

  1) I'm a lazy typist. I find it quite convenient to simply click on the
  Buglink URL and be presented with the bug page.

  2) The 'Bug:' field implies a certain context, which is useless when
  pushing our patches upstream. Rather then having to cleanse patches of
  irrelevant information, lets put it in the commit in an interesting and
  useful form to begin with. I suspect, given the feedback that Amit has
  already received from Andrew Morton, that the 'Bug:' field will not be
  well received in general.

  3) Finally, if we start developing for the upstream kernel (as we will
  if I get my way), we can take advantage of BugLink goodness
  automatically as our upstream patches show up in stable and other
  places.

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/370475

Signed-off-by: Brad Figg <brad.figg at canonical.com>
---
 debian/scripts/misc/git-ubuntu-log |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/debian/scripts/misc/git-ubuntu-log b/debian/scripts/misc/git-ubuntu-log
index 860990c..b880ce6 100755
--- a/debian/scripts/misc/git-ubuntu-log
+++ b/debian/scripts/misc/git-ubuntu-log
@@ -60,7 +60,7 @@ sub add_entry($) {
 }
 
 sub shortlog_entry($$$$$) {
-	my ($name, $desc, $bug, $cve, $commit) = @_;
+	my ($name, $desc, $bug, $buglink, $cve, $commit) = @_;
 	my $entry;
 
 	$desc =~ s#/pub/scm/linux/kernel/git/#/.../#g;
@@ -74,6 +74,7 @@ sub shortlog_entry($$$$$) {
 	$entry->{'cve'} = $cve;
 	$entry->{'commit'} = $commit;
 	$entry->{'author'} = $name;
+	$entry->{'buglink'} = $buglink;
 
 	if ($desc =~ /^Revert "/) {
 		push(@reverts, $entry);
@@ -117,6 +118,23 @@ sub shortlog_output {
 			}
 			if (defined($entry->{'bugno'})) {
 				print "    - LP: #" .  $entry->{'bugno'} . "\n";
+				# If there isn't a buglink, assume the bug number is to a bug
+				# in launchpad and generate the appropriate url
+				#
+				if (!defined($entry->{'buglink'})) {
+					print "    - BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/" .  $entry->{'bugno'} . "\n";
+				}
+			}
+			if (defined($entry->{'buglink'})) {
+				# If there isn't a bugno line, and if the buglink is into
+				# launchpad, use the buglink to create the launchpad bug number
+				#
+				if (!defined($entry->{'bugno'})) {
+					if ($entry->{'buglink'} =~ /https:\/\/.*.launchpad.net\/.*\/([0-9]+)\S*$/) {
+						print "    - LP: #" .  $1 . "\n";
+					}
+				}
+				print "    - BugLink: " .  $entry->{'buglink'} . "\n";
 			}
 			if (defined($entry->{'cve'})) {
 				print "    - " . $entry->{'cve'} . "\n";
@@ -167,6 +185,7 @@ sub changelog_input {
 			next unless /^\s*?(.*)/;
 			my $ignore = 0;
 			my $bug = undef;
+			my $buglink = undef;
 
 			# skip lines that are obviously not
 			# a 1-line cset description
@@ -178,7 +197,8 @@ sub changelog_input {
 			if ($desc =~ /^ *(Revert "|)UBUNTU:/) {
 				while (<STDIN>) {
 					$ignore = 1 if /^ *Ignore: yes/i;
-					$bug = $2 if /^ *Bug: *(#|)(.*)/;
+					$bug = $2 if /^ *Bug: *(#|)(.*)/i;
+					$buglink = $1 if /^ *BugLink: *(http.*)/i;
 					$cve = $1 if /^ *(CVE-.*)/;
 					last if /^commit /;
 				}
@@ -186,14 +206,15 @@ sub changelog_input {
 				$author = $kernel_auth;
 				$ignore = 1 if $desc =~ /Merge /;
 				while (<STDIN>) {
-					$bug = $2 if /^ *Bug: *(#|)(.*)/;
+					$bug = $2 if /^ *Bug: *(#|)(.*)/i;
+					$buglink = $1 if /^ *BugLink: *(http.*)/i;
 					$cve = $1 if /^ *(CVE-.*)/;
 					last if /^commit /;
 				}
 			}
 
 			if (!$ignore) {
-				&shortlog_entry($author, $desc, $bug,
+				&shortlog_entry($author, $desc, $bug, $buglink,
 						$cve, $commit, 0);
 			}
 
-- 
1.6.2.4





More information about the kernel-team mailing list