{"thread":{"id":"20976","subject":"[PATCH] Exporter for code_swarm","startedAt":"2009-09-16T20:27:03Z","lastAt":"2009-09-16T20:27:03Z","messageCount":1,"participants":["Giuseppe Bilotta"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"123369","messageId":"1253132823-29993-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"20976","inReplyTo":null,"subject":"[PATCH] Exporter for code_swarm","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-09-16T20:27:03Z","receivedAt":"2009-09-16T20:27:03Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This simple Perl script echoes the entire project history into a format\nsuitable for consumption from the organic project development visualizer\ncode_swarm http://vis.cs.ucdavis.edu/~ogawa/codeswarm/ and any other\nsoftware that expects a file event XML file in the same format.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n contrib/git-file-events.perl |   28 ++++++++++++++++++++++++++++\n 1 files changed, 28 insertions(+), 0 deletions(-)\n create mode 100755 contrib/git-file-events.perl\n\nI had actually considered writing a patch to add the format as a predefined\nformat for git log, but on second thoughts I decided it was not really worth\nthe effort. This script, although it's just a quick hack, serves the purpose\njust as well, although it's obviously not suited for anything more than\ncontrib/, if for anything at all.\n\nEnjoy.\n\n\ndiff --git a/contrib/git-file-events.perl b/contrib/git-file-events.perl\nnew file mode 100755\nindex 0000000..b5fd5e5\n--- /dev/null\n+++ b/contrib/git-file-events.perl\n@@ -0,0 +1,28 @@\n+#!/usr/bin/perl\n+\n+# Output full repository log as a list of file events, in the format expected by\n+# code_swarm http://vis.cs.ucdavis.edu/~ogawa/codeswarm/\n+#\n+# Usage: perl git-file-events.perl > events.xml\n+\n+open(LOG, 'git log --reverse --date-order --format=\"%x09%at000%x09%aN\" --name-only|');\n+\n+my $date = undef;\n+my $author = undef;\n+\n+print \"<?xml version=\\\"1.0\\\" ?>\\n<file_events>\\n\";\n+while (<LOG>) {\n+\tchomp;\n+\tif (/^\\t(\\d+)\\t(.*)/) {\n+\t\t$date = $1;\n+\t\t$author = $2;\n+\t} else {\n+\t\tnext unless $_;\n+\t\tdie \"Malformed log: no author!\\n'$_'\\n\" unless $author;\n+\t\t$file = $_;\n+\t\t$file =~ s/\\n//g;\n+\t\t$file =~ s/\"//g;\n+\t\tprint \"<event date=\\\"$date\\\" filename=\\\"$_\\\" author=\\\"$author\\\" />\\n\";\n+\t}\n+}\n+print \"</file_events>\\n\";\n-- \n1.6.4.1.345.ge2d8f\n"}]}