git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: The merge from hell...
@ 2006-02-03 18:34 Brown, Len
  2006-02-04  2:35 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Brown, Len @ 2006-02-03 18:34 UTC (permalink / raw)
  To: Dave Jones, Junio C Hamano
  Cc: Linus Torvalds, Git Mailing List, Paul Mackerras, Marco Costalba,
	Aneesh Kumar

>On Thu, Feb 02, 2006 at 10:28:43PM -0800, Junio C Hamano wrote:
>
> > > One thing I'd ask for: would it be possible to have more 
>descriptive 
> > > branch names than just numbers? Even if you want to track 
>it by bugzilla 
> > > entry number, how about calling it "bugzilla-12345" instead? 
> > 
> > When kernel people (not just Len) talk about a "bugzilla ID",
> > does that ID always come from the same namespace, or do some
> > subsystems have their own bugzilla?
>
>Not only do some subsystems have their own bugtracker (ALSA for eg),
>but referring to 'bugzilla' alone is meaningless, as it could
>mean bugme.osdl.org, bugzilla.redhat.com, bugzilla.novell.com,
>bugzilla.ubuntu.com etc etc, all of which are a prime source of
>juicy kernel bugs.

Naming the branch is just eye-candy for the merge comment.
My topic branch labels in refs/my-branch never get to kernel.org, so you're
not going to see the pretty green tags on topic branches branches that I see.

I include the full-URL of the bug report in the original commit comments
for those who are interested.  I think this it the important place to put it,
and in practice I've found it to be extremely useful.

-Len

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

* Re: The merge from hell...
  2006-02-03 18:34 The merge from hell Brown, Len
@ 2006-02-04  2:35 ` Junio C Hamano
  2006-02-04  2:47   ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-02-04  2:35 UTC (permalink / raw)
  To: Brown, Len
  Cc: Linus Torvalds, Git Mailing List, Paul Mackerras, Marco Costalba,
	Aneesh Kumar, Dave Jones

"Brown, Len" <len.brown@intel.com> writes:

> Naming the branch is just eye-candy for the merge comment.
> My topic branch labels in refs/my-branch never get to kernel.org, so you're
> not going to see the pretty green tags on topic branches branches that I see.
>
> I include the full-URL of the bug report in the original commit comments
> for those who are interested.  I think this it the important place to put it,
> and in practice I've found it to be extremely useful.

Both excellent points.

If I may digress,...

It appears most of the topic branches in that merge have only
one commit since they forked from trunk (the development track
led to the first parent of that merge), but some seem to have
more than one commits.

It might make sense if we have a tool support to pre-format the
merge messages like this, given set of branch names:

    [ACPI] Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release

    3549: [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops
    4320: [ACPI] fix reboot upon suspend-to-disk
    4485: [ACPI] handle BIOS with implicit C1 in _CST
    4588: [ACPI] fix acpi_os_wait_sempahore() finite timeout case (AE_TIME warning)
    4980 (5 commits): [ACPI] build EC driver on IA64
    5483 (3 commits): [ACPI] fix acpi_cpufreq.c build warrning
    5651: [ACPI] SMP S3 resume: evaluate _WAK after INIT
    acpica (23 commits): [ACPI] ACPICA 20060113
    asus (3 commits): [ACPI_ASUS] fix asus module param description
    fops (2 commits): [ACPI] make two processor functions static
    pnpacpi (3 commits): [PNPACPI] clean excluded_id_list[]

Here I am counting the number of commits on each topic since it
last diverged from trunk (`merge-base release branch`), and
showing the latest commit of the topic.

We could even go further and have "per branch annotation" that
lets you do something like this:

	$ git checkout -b 3549 \
          --description 'http://bugzilla.kernel.org/show_bug.cgi?id=3549'
	$ work work
        $ git commit
	... work on other topics in similar way ...
        ... later, on the 'release' branch ...
        $ git pull . 3549 4320 4485...

With that, we could give a default merge message formatted like this:

    Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release

    3549: http://bugzilla.kernel.org/show_bug.cgi?id=3549
     [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops

    4320: http://bugzilla.kernel.org/show_bug.cgi?id=4320
     [ACPI] fix reboot upon suspend-to-disk

    5483: http://bugzilla.kernel.org/show_bug.cgi?id=5483
     [ACPI] fix acpi_cpufreq.c build warrning
     [ACPI] IA64 ZX1 buildfix for _PDC patch
     [ACPI] Avoid BIOS inflicted crashes by evaluating _PDC only once

    pnpacpi: work on PNP-ACPI issues
     [PNPACPI] clean excluded_id_list[]
     [PNPACPI] Ignore devices that have no resources
     [ACPI] enable PNPACPI support for resource types used by HP serial ports

This last digression might be too much, though.  It may be
something that is better computed by 'git log' while reviewing
history, except that the description of each branch cannot be
given that way.

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

* Re: The merge from hell...
  2006-02-04  2:35 ` Junio C Hamano
@ 2006-02-04  2:47   ` Linus Torvalds
  2006-02-04  7:17     ` [PATCH] fmt-merge-msg: show summary of what is merged Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2006-02-04  2:47 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Brown, Len, Git Mailing List, Paul Mackerras, Marco Costalba,
	Aneesh Kumar, Dave Jones



On Fri, 3 Feb 2006, Junio C Hamano wrote:
> 
> It might make sense if we have a tool support to pre-format the
> merge messages like this, given set of branch names:
> 
>     [ACPI] Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release
> 
>     3549: [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops
>     4320: [ACPI] fix reboot upon suspend-to-disk
>     4485: [ACPI] handle BIOS with implicit C1 in _CST
..

Well, this is actually not all that different from what gitk will show you 
(since I added the commit "explanation" names with my increadible 
copy-paste skills to it).

Just look in the details window in gitk on that merge, and that's pretty 
much exactly what you'll see, except you'll also have the nice clickable 
hyperlink features ;)

Yeah, it doesn't show the branch names _and_ it shows the commit that you 
merged into too, so it looks like

  Parent: 3ee68.. ([SPARC64]: Use compat_sys_futimesat in 32-bit syscall table.)
  Parent: 876c1.. ([ACPI] Disable C2/C3 for _all_ IBM R40e Laptops)
  Parent: 729b4.. ([ACPI] fix reboot upon suspend-to-disk)
  Parent: cf824.. ([ACPI] handle BIOS with implicit C1 in _CST)

but it's actually pretty readable there.

		Linus

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

* [PATCH] fmt-merge-msg: show summary of what is merged.
  2006-02-04  2:47   ` Linus Torvalds
@ 2006-02-04  7:17     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-02-04  7:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Brown, Len, Git Mailing List, Paul Mackerras, Marco Costalba,
	Aneesh Kumar, Dave Jones

Linus Torvalds <torvalds@osdl.org> writes:

> Yeah, it doesn't show the branch names _and_ it shows the commit that you 
> merged into too, so it looks like
>
>   Parent: 3ee68.. ([SPARC64]: Use compat_sys_futimesat in 32-bit syscall table.)
>   Parent: 876c1.. ([ACPI] Disable C2/C3 for _all_ IBM R40e Laptops)
>   Parent: 729b4.. ([ACPI] fix reboot upon suspend-to-disk)
>   Parent: cf824.. ([ACPI] handle BIOS with implicit C1 in _CST)
>
> but it's actually pretty readable there.

Fair enough.  I myself do not use gitk that often than I use
'git log'.  Something like this patch is what I've been thinking
of doing (it actually works rather nicely if you try to recreate
Len's merge).

-- >8 --
This was prompted by Len's 12-way octopus.  In addition to
the branch names, populate the log message with one-line
description from actual commits that are being merged.

This is experimental.  You need to have 'merge.summary'
in the configuration file to enable it:

	$ git repo-config merge.summary yes

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 git-fmt-merge-msg.perl |   79 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)

b145e0d7a5fc728c00925b55c8a2c2a97788536b
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 778388e..9ac3c87 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -27,10 +27,47 @@ sub andjoin {
 	return ($m);
 }
 
+sub repoconfig {
+	my $fh;
+	my $val;
+	eval {
+		open $fh, '-|', 'git-repo-config', '--get', 'merge.summary'
+		    or die "$!";
+		($val) = <$fh>;
+		close $fh;
+	};
+	return $val;
+}
+
+sub mergebase {
+	my ($other) = @_;
+	my $fh;
+	open $fh, '-|', 'git-merge-base', '--all', 'HEAD', $other or die "$!";
+	my (@mb) = map { chomp; $_ } <$fh>;
+	close $fh or die "$!";
+	return @mb;
+}
+
+sub shortlog {
+	my ($tip, $limit, @base) = @_;
+	my ($fh, @result);
+	open $fh, '-|', ('git-log', "--max-count=$limit", '--topo-order',
+			 '--pretty=oneline', $tip, map { "^$_" } @base)
+	    or die "$!";
+	while (<$fh>) {
+		s/^[0-9a-f]{40}\s+//;
+		push @result, $_;
+	}
+	close $fh or die "$!";
+	return @result;
+}
+
+my @origin = ();
 while (<>) {
-	my ($bname, $tname, $gname, $src);
+	my ($bname, $tname, $gname, $src, $sha1, $origin);
 	chomp;
-	s/^[0-9a-f]*	//;
+	s/^([0-9a-f]*)	//;
+	$sha1 = $1;
 	next if (/^not-for-merge/);
 	s/^	//;
 	if (s/ of (.*)$//) {
@@ -52,19 +89,30 @@ while (<>) {
 		};
 	}
 	if (/^branch (.*)$/) {
+		$origin = $1;
 		push @{$src{$src}{BRANCH}}, $1;
 		$src{$src}{HEAD_STATUS} |= 2;
 	}
 	elsif (/^tag (.*)$/) {
+		$origin = $_;
 		push @{$src{$src}{TAG}}, $1;
 		$src{$src}{HEAD_STATUS} |= 2;
 	}
 	elsif (/^HEAD$/) {
+		$origin = $src;
 		$src{$src}{HEAD_STATUS} |= 1;
 	}
 	else {
 		push @{$src{$src}{GENERIC}}, $_;
 		$src{$src}{HEAD_STATUS} |= 2;
+		$origin = $src;
+	}
+	if ($src eq '.' || $src eq $origin) {
+		$origin =~ s/^'(.*)'$/$1/;
+		push @origin, [$sha1, "$origin"];
+	}
+	else {
+		push @origin, [$sha1, "$origin of $src"];
 	}
 }
 
@@ -93,3 +141,30 @@ for my $src (@src) {
 	push @msg, $this;
 }
 print "Merge ", join("; ", @msg), "\n";
+
+if (!repoconfig) {
+	exit(0);
+}
+
+# We limit the merge message to the latst 20 or so per each branch.
+my $limit = 20;
+
+for (@origin) {
+	my ($sha1, $name) = @$_;
+	my @mb = mergebase($sha1);
+	my @log = shortlog($sha1, $limit, @mb);
+	if ($limit + 1 <= @log) {
+		print "\n* $name: (" . scalar(@log) . " commits)\n";
+	}
+	else {
+		print "\n* $name:\n";
+	}
+	my $cnt = 0;
+	for my $log (@log) {
+		if ($limit < ++$cnt) {
+			print "  ...\n";
+			last;
+		}
+		print "  $log";
+	}
+}
-- 
1.1.6.ge2129

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

end of thread, other threads:[~2006-02-04  7:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-03 18:34 The merge from hell Brown, Len
2006-02-04  2:35 ` Junio C Hamano
2006-02-04  2:47   ` Linus Torvalds
2006-02-04  7:17     ` [PATCH] fmt-merge-msg: show summary of what is merged Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).