git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Exporter for code_swarm

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Sep 16, 2009, 20:27 UTC
Message-ID
<1253132823-29993-1-git-send-email-giuseppe.bilotta@gmail.com>

This simple Perl script echoes the entire project history into a format suitable for consumption from the organic project development visualizer code_swarm http://vis.cs.ucdavis.edu/~ogawa/codeswarm/ and any other software that expects a file event XML file in the same format.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 contrib/git-file-events.perl |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100755 contrib/git-file-events.perl

I had actually considered writing a patch to add the format as a predefined format for git log, but on second thoughts I decided it was not really worth the effort. This script, although it's just a quick hack, serves the purpose just as well, although it's obviously not suited for anything more than contrib/, if for anything at all.

Enjoy.
diff --git a/contrib/git-file-events.perl b/contrib/git-file-events.perl
new file mode 100755
index 0000000..b5fd5e5
--- /dev/null
+++ b/contrib/git-file-events.perl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+# Output full repository log as a list of file events, in the format expected by
+# code_swarm http://vis.cs.ucdavis.edu/~ogawa/codeswarm/
+#
+# Usage: perl git-file-events.perl > events.xml
+
+open(LOG, 'git log --reverse --date-order --format="%x09%at000%x09%aN" --name-only|');
+
+my $date = undef;
+my $author = undef;
+
+print "<?xml version=\"1.0\" ?>\n<file_events>\n";
+while (<LOG>) {
+	chomp;
+	if (/^\t(\d+)\t(.*)/) {
+		$date = $1;
+		$author = $2;
+	} else {
+		next unless $_;
+		die "Malformed log: no author!\n'$_'\n" unless $author;
+		$file = $_;
+		$file =~ s/\n//g;
+		$file =~ s/"//g;
+		print "<event date=\"$date\" filename=\"$_\" author=\"$author\" />\n";
+	}
+}
+print "</file_events>\n";
-- 
1.6.4.1.345.ge2d8f
Message 1 of 1 in “Exporter for code_swarm”
  1. Exporter for code_swarmGiuseppe Bilotta, Sep 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.