git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [PATCH] Exporter for code_swarm
Date: Wed, 16 Sep 2009 22:27:03 +0200	[thread overview]
Message-ID: <1253132823-29993-1-git-send-email-giuseppe.bilotta@gmail.com> (raw)

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

                 reply	other threads:[~2009-09-16 20:27 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1253132823-29993-1-git-send-email-giuseppe.bilotta@gmail.com \
    --to=giuseppe.bilotta@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).