git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Anderson <ryan@michonline.com>
To: Matthias Andree <matthias.andree@gmx.de>
Cc: Linus Torvalds <torvalds@transmeta.com>, git@vger.kernel.org
Subject: [PATCH] Convert shortlog to handle cogito (cg-log) output
Date: Tue, 26 Apr 2005 04:39:50 -0400	[thread overview]
Message-ID: <20050426083950.GA30167@mythryan2.michonline.com> (raw)


Convert "shortlog" to understand cogito's cg-log output format instead
of "bk changes" format.

Cogito (and by inference, "git" in general) have a different log output
format than BitKeeper.  This log format seems somewhat simpler to parse.

The following patch is a *bare minimum* conversion to make "shortlog"
provide corrected output the Cogito script "cg-log".

(This is clearly not sufficient, and not intended for application to any
rea tree, as a lot of BitKeeper domain knowledge remains, but this
should be enough for Linus to provide changelogs in the "shortlog"
format again, and hopefully to serve as a template for further
modifications by others.)

Signed-Off-By: Ryan Anderson <ryan@michonline.com>

--- cogito-tools/shortlog	2005-04-26 04:22:01.000000000 -0400
+++ cogito-tools/git-shortlog	2005-04-26 04:36:52.000000000 -0400
@@ -3052,7 +3052,7 @@
       }
 
     if (defined $address and $opt{multi}
-	and m{^[^<[:space:]]} and not m{^ChangeSet@}) {
+	and m{^[^<[:space:]]} and not m{^commit }) {
       # if we are in multi mode, if we encounter a non-address
       # left-justified line, flush all data and print the header. The
       # 'defined $address' trick lets this only trigger to switch back
@@ -3063,13 +3063,14 @@
       @prolog = ($_);
       undef %$log;
       undef $address;
-    } elsif (m{^<([^>]+)>} or m{^ChangeSet@[0-9.]+,\s*[-0-9:+ ]+,\s*(\S+)}) {
+    } elsif (m{^<([^>]+)>} or m{^author (.*) <(.*)>}) {
       # go figure if a line starts with an address, if so, take it
       # resolve the address to a name if possible
       append_item(%$log, @cur); @cur = ();
-      $address = lc($1);
+      $address = lc($2);
       $address =~ s/\[[^]]+\]$//;
       $name = rmap_address($address, 1);
+      $name = $1 if ($name eq $address);
       $author = treat_addr_name($address, $name);
       $first = 1;
       $firstpar = 1;
@@ -3093,25 +3094,28 @@
       } else {
 	  print STDERR " SKIPPED SIGNED-OFF-BY  $author\n" if $debug;
       }
-    } elsif ($first) {
+    } elsif ($first && m/^(?:[[:space:]]{4}|\t)(.*)$/) {
       # we have a "first" line after an address, take it,
       # strip common redundant tags
+      
+      my $comment = $1;
 
       # kill "PATCH" tag
-      s/^\s*\[PATCH\]//;
-      s/^\s*PATCH//;
-      s/^\s*[-:]+\s*//;
+      $comment =~ s/^\s*\[PATCH\]//;
+      $comment =~ s/^\s*PATCH//;
+      $comment =~ s/^\s*[-:]+\s*//;
 
       # strip trailing colon or period, and if we strip one,
       # we don't parse further lines as part of the first paragraph
-      if (s/[:.]+\s*$//) { $firstpar = 0; }
+      if ($comment =~ s/[:.]+\s*$//) { $firstpar = 0; }
 
       # kill leading and trailing whitespace for consistent indentation
-      s/^\s+//; s/\s+$//;
+      $comment =~ s/^\s+//; s/\s+$//;
 
-      push @cur, $_;
+      push @cur, $comment;
       $first = 0;
-    } elsif (defined $address) {
+
+    } elsif (defined $address && m/^(?:[[:space:]]{4}|\t)(.*)$/ ) {
       # second or subsequent lines -- if in first paragraph,
       # append this line to the first log line.
       if (m/^\s*$/) { $firstpar = 0; }
@@ -3124,6 +3128,10 @@
       }
       # we don't parse further lines as part of the first paragraph
       if (s/[:.]+\s*$//) { $firstpar = 0; }
+
+    } elsif (m/^(commit|tree|parent|committer) / || m/^\s*$/) {
+      # Skip unused header lines
+
     } else {
       # store header before a changelog
       push @prolog, $_;


-- 

Ryan Anderson
  sometimes Pug Majere

                 reply	other threads:[~2005-04-26  8:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050426083950.GA30167@mythryan2.michonline.com \
    --to=ryan@michonline.com \
    --cc=git@vger.kernel.org \
    --cc=matthias.andree@gmx.de \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).