{"thread":{"id":"3229","subject":"RE: The merge from hell...","startedAt":"2006-02-03T18:34:35Z","lastAt":"2006-02-04T07:17:42Z","messageCount":4,"participants":["Brown, Len","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15522","messageId":"F7DC2337C7631D4386A2DF6E8FB22B3005F34393@hdsmsx401.amr.corp.intel.com","threadId":"3229","inReplyTo":null,"subject":"RE: The merge from hell...","fromName":"Brown, Len","fromEmail":"len.brown@intel.com","sentAt":"2006-02-03T18:34:35Z","receivedAt":"2006-02-03T18:34:35Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":">On Thu, Feb 02, 2006 at 10:28:43PM -0800, Junio C Hamano wrote:\n>\n> > > One thing I'd ask for: would it be possible to have more \n>descriptive \n> > > branch names than just numbers? Even if you want to track \n>it by bugzilla \n> > > entry number, how about calling it \"bugzilla-12345\" instead? \n> > \n> > When kernel people (not just Len) talk about a \"bugzilla ID\",\n> > does that ID always come from the same namespace, or do some\n> > subsystems have their own bugzilla?\n>\n>Not only do some subsystems have their own bugtracker (ALSA for eg),\n>but referring to 'bugzilla' alone is meaningless, as it could\n>mean bugme.osdl.org, bugzilla.redhat.com, bugzilla.novell.com,\n>bugzilla.ubuntu.com etc etc, all of which are a prime source of\n>juicy kernel bugs.\n\nNaming the branch is just eye-candy for the merge comment.\nMy topic branch labels in refs/my-branch never get to kernel.org, so you're\nnot going to see the pretty green tags on topic branches branches that I see.\n\nI include the full-URL of the bug report in the original commit comments\nfor those who are interested.  I think this it the important place to put it,\nand in practice I've found it to be extremely useful.\n\n-Len\n"},{"id":"15546","messageId":"7vy80r97h6.fsf@assigned-by-dhcp.cox.net","threadId":"3229","inReplyTo":"F7DC2337C7631D4386A2DF6E8FB22B3005F34393@hdsmsx401.amr.corp.intel.com","subject":"Re: The merge from hell...","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-04T02:35:17Z","receivedAt":"2006-02-04T02:35:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Brown, Len\" <len.brown@intel.com> writes:\n\n> Naming the branch is just eye-candy for the merge comment.\n> My topic branch labels in refs/my-branch never get to kernel.org, so you're\n> not going to see the pretty green tags on topic branches branches that I see.\n>\n> I include the full-URL of the bug report in the original commit comments\n> for those who are interested.  I think this it the important place to put it,\n> and in practice I've found it to be extremely useful.\n\nBoth excellent points.\n\nIf I may digress,...\n\nIt appears most of the topic branches in that merge have only\none commit since they forked from trunk (the development track\nled to the first parent of that merge), but some seem to have\nmore than one commits.\n\nIt might make sense if we have a tool support to pre-format the\nmerge messages like this, given set of branch names:\n\n    [ACPI] Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release\n\n    3549: [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops\n    4320: [ACPI] fix reboot upon suspend-to-disk\n    4485: [ACPI] handle BIOS with implicit C1 in _CST\n    4588: [ACPI] fix acpi_os_wait_sempahore() finite timeout case (AE_TIME warning)\n    4980 (5 commits): [ACPI] build EC driver on IA64\n    5483 (3 commits): [ACPI] fix acpi_cpufreq.c build warrning\n    5651: [ACPI] SMP S3 resume: evaluate _WAK after INIT\n    acpica (23 commits): [ACPI] ACPICA 20060113\n    asus (3 commits): [ACPI_ASUS] fix asus module param description\n    fops (2 commits): [ACPI] make two processor functions static\n    pnpacpi (3 commits): [PNPACPI] clean excluded_id_list[]\n\nHere I am counting the number of commits on each topic since it\nlast diverged from trunk (`merge-base release branch`), and\nshowing the latest commit of the topic.\n\nWe could even go further and have \"per branch annotation\" that\nlets you do something like this:\n\n\t$ git checkout -b 3549 \\\n          --description 'http://bugzilla.kernel.org/show_bug.cgi?id=3549'\n\t$ work work\n        $ git commit\n\t... work on other topics in similar way ...\n        ... later, on the 'release' branch ...\n        $ git pull . 3549 4320 4485...\n\nWith that, we could give a default merge message formatted like this:\n\n    Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release\n\n    3549: http://bugzilla.kernel.org/show_bug.cgi?id=3549\n     [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops\n\n    4320: http://bugzilla.kernel.org/show_bug.cgi?id=4320\n     [ACPI] fix reboot upon suspend-to-disk\n\n    5483: http://bugzilla.kernel.org/show_bug.cgi?id=5483\n     [ACPI] fix acpi_cpufreq.c build warrning\n     [ACPI] IA64 ZX1 buildfix for _PDC patch\n     [ACPI] Avoid BIOS inflicted crashes by evaluating _PDC only once\n\n    pnpacpi: work on PNP-ACPI issues\n     [PNPACPI] clean excluded_id_list[]\n     [PNPACPI] Ignore devices that have no resources\n     [ACPI] enable PNPACPI support for resource types used by HP serial ports\n\nThis last digression might be too much, though.  It may be\nsomething that is better computed by 'git log' while reviewing\nhistory, except that the description of each branch cannot be\ngiven that way.\n"},{"id":"15547","messageId":"Pine.LNX.4.64.0602031841320.3969@g5.osdl.org","threadId":"3229","inReplyTo":"7vy80r97h6.fsf@assigned-by-dhcp.cox.net","subject":"Re: The merge from hell...","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-04T02:47:08Z","receivedAt":"2006-02-04T02:47:08Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 3 Feb 2006, Junio C Hamano wrote:\n> \n> It might make sense if we have a tool support to pre-format the\n> merge messages like this, given set of branch names:\n> \n>     [ACPI] Merge 3549, 4320, 4485, 4588, 4980, 5483, 5651, acpica, asus, fops and pnpacpi branches into release\n> \n>     3549: [ACPI] Disable C2/C3 for _all_ IBM R40e Laptops\n>     4320: [ACPI] fix reboot upon suspend-to-disk\n>     4485: [ACPI] handle BIOS with implicit C1 in _CST\n..\n\nWell, this is actually not all that different from what gitk will show you \n(since I added the commit \"explanation\" names with my increadible \ncopy-paste skills to it).\n\nJust look in the details window in gitk on that merge, and that's pretty \nmuch exactly what you'll see, except you'll also have the nice clickable \nhyperlink features ;)\n\nYeah, it doesn't show the branch names _and_ it shows the commit that you \nmerged into too, so it looks like\n\n  Parent: 3ee68.. ([SPARC64]: Use compat_sys_futimesat in 32-bit syscall table.)\n  Parent: 876c1.. ([ACPI] Disable C2/C3 for _all_ IBM R40e Laptops)\n  Parent: 729b4.. ([ACPI] fix reboot upon suspend-to-disk)\n  Parent: cf824.. ([ACPI] handle BIOS with implicit C1 in _CST)\n\nbut it's actually pretty readable there.\n\n\t\tLinus\n"},{"id":"15557","messageId":"7vu0bf619l.fsf_-_@assigned-by-dhcp.cox.net","threadId":"3229","inReplyTo":"Pine.LNX.4.64.0602031841320.3969@g5.osdl.org","subject":"[PATCH] fmt-merge-msg: show summary of what is merged.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-04T07:17:42Z","receivedAt":"2006-02-04T07:17:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Yeah, it doesn't show the branch names _and_ it shows the commit that you \n> merged into too, so it looks like\n>\n>   Parent: 3ee68.. ([SPARC64]: Use compat_sys_futimesat in 32-bit syscall table.)\n>   Parent: 876c1.. ([ACPI] Disable C2/C3 for _all_ IBM R40e Laptops)\n>   Parent: 729b4.. ([ACPI] fix reboot upon suspend-to-disk)\n>   Parent: cf824.. ([ACPI] handle BIOS with implicit C1 in _CST)\n>\n> but it's actually pretty readable there.\n\nFair enough.  I myself do not use gitk that often than I use\n'git log'.  Something like this patch is what I've been thinking\nof doing (it actually works rather nicely if you try to recreate\nLen's merge).\n\n-- >8 --\nThis was prompted by Len's 12-way octopus.  In addition to\nthe branch names, populate the log message with one-line\ndescription from actual commits that are being merged.\n\nThis is experimental.  You need to have 'merge.summary'\nin the configuration file to enable it:\n\n\t$ git repo-config merge.summary yes\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n git-fmt-merge-msg.perl |   79 +++++++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 77 insertions(+), 2 deletions(-)\n\nb145e0d7a5fc728c00925b55c8a2c2a97788536b\ndiff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl\nindex 778388e..9ac3c87 100755\n--- a/git-fmt-merge-msg.perl\n+++ b/git-fmt-merge-msg.perl\n@@ -27,10 +27,47 @@ sub andjoin {\n \treturn ($m);\n }\n \n+sub repoconfig {\n+\tmy $fh;\n+\tmy $val;\n+\teval {\n+\t\topen $fh, '-|', 'git-repo-config', '--get', 'merge.summary'\n+\t\t    or die \"$!\";\n+\t\t($val) = <$fh>;\n+\t\tclose $fh;\n+\t};\n+\treturn $val;\n+}\n+\n+sub mergebase {\n+\tmy ($other) = @_;\n+\tmy $fh;\n+\topen $fh, '-|', 'git-merge-base', '--all', 'HEAD', $other or die \"$!\";\n+\tmy (@mb) = map { chomp; $_ } <$fh>;\n+\tclose $fh or die \"$!\";\n+\treturn @mb;\n+}\n+\n+sub shortlog {\n+\tmy ($tip, $limit, @base) = @_;\n+\tmy ($fh, @result);\n+\topen $fh, '-|', ('git-log', \"--max-count=$limit\", '--topo-order',\n+\t\t\t '--pretty=oneline', $tip, map { \"^$_\" } @base)\n+\t    or die \"$!\";\n+\twhile (<$fh>) {\n+\t\ts/^[0-9a-f]{40}\\s+//;\n+\t\tpush @result, $_;\n+\t}\n+\tclose $fh or die \"$!\";\n+\treturn @result;\n+}\n+\n+my @origin = ();\n while (<>) {\n-\tmy ($bname, $tname, $gname, $src);\n+\tmy ($bname, $tname, $gname, $src, $sha1, $origin);\n \tchomp;\n-\ts/^[0-9a-f]*\t//;\n+\ts/^([0-9a-f]*)\t//;\n+\t$sha1 = $1;\n \tnext if (/^not-for-merge/);\n \ts/^\t//;\n \tif (s/ of (.*)$//) {\n@@ -52,19 +89,30 @@ while (<>) {\n \t\t};\n \t}\n \tif (/^branch (.*)$/) {\n+\t\t$origin = $1;\n \t\tpush @{$src{$src}{BRANCH}}, $1;\n \t\t$src{$src}{HEAD_STATUS} |= 2;\n \t}\n \telsif (/^tag (.*)$/) {\n+\t\t$origin = $_;\n \t\tpush @{$src{$src}{TAG}}, $1;\n \t\t$src{$src}{HEAD_STATUS} |= 2;\n \t}\n \telsif (/^HEAD$/) {\n+\t\t$origin = $src;\n \t\t$src{$src}{HEAD_STATUS} |= 1;\n \t}\n \telse {\n \t\tpush @{$src{$src}{GENERIC}}, $_;\n \t\t$src{$src}{HEAD_STATUS} |= 2;\n+\t\t$origin = $src;\n+\t}\n+\tif ($src eq '.' || $src eq $origin) {\n+\t\t$origin =~ s/^'(.*)'$/$1/;\n+\t\tpush @origin, [$sha1, \"$origin\"];\n+\t}\n+\telse {\n+\t\tpush @origin, [$sha1, \"$origin of $src\"];\n \t}\n }\n \n@@ -93,3 +141,30 @@ for my $src (@src) {\n \tpush @msg, $this;\n }\n print \"Merge \", join(\"; \", @msg), \"\\n\";\n+\n+if (!repoconfig) {\n+\texit(0);\n+}\n+\n+# We limit the merge message to the latst 20 or so per each branch.\n+my $limit = 20;\n+\n+for (@origin) {\n+\tmy ($sha1, $name) = @$_;\n+\tmy @mb = mergebase($sha1);\n+\tmy @log = shortlog($sha1, $limit, @mb);\n+\tif ($limit + 1 <= @log) {\n+\t\tprint \"\\n* $name: (\" . scalar(@log) . \" commits)\\n\";\n+\t}\n+\telse {\n+\t\tprint \"\\n* $name:\\n\";\n+\t}\n+\tmy $cnt = 0;\n+\tfor my $log (@log) {\n+\t\tif ($limit < ++$cnt) {\n+\t\t\tprint \"  ...\\n\";\n+\t\t\tlast;\n+\t\t}\n+\t\tprint \"  $log\";\n+\t}\n+}\n-- \n1.1.6.ge2129\n"}]}