git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* graphing commit trees
@ 2005-05-01 20:01 Lennert Buytenhek
  0 siblings, 0 replies; only message in thread
From: Lennert Buytenhek @ 2005-05-01 20:01 UTC (permalink / raw)
  To: git

Hi!

As a 5-minute hack to see how easy it'd be to create trees from commit
objects: the attached perl script creates a file suitable for feeding
to dot/dotty from the graphviz suite.  Example graph at:

	http://www.liacs.nl/~buytenh/graph_42d4dc3f4e1ec1396371aac89d0dccfdd977191b.png

Warning: big image (2746x41363), many apps can't display it properly.
(mozilla gives an error, eog shows only the top 32768 pixel rows, gimp
seems to work.)


--L


#!/usr/bin/perl

my %processed;

sub traverse {
        my $commit = shift;
        my $parent;
        my @parents;

        return if (defined $processed{$commit});
        $processed{$commit} = "";

        @parents = split(" ", `git-cat-file commit $commit | grep "^parent " | awk '{print \$2}'`);

        foreach $parent (@parents) {
                print "\"$parent\" -> \"$commit\"\n";
                traverse($parent);
        }
}

sub mk_graph {
        my $root = shift;

        print "digraph blah_$root {\n";
        traverse($root);
        print "}\n";
}

$root = `cat .git/HEAD`;
chomp $root;

mk_graph($root);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-01 19:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-01 20:01 graphing commit trees Lennert Buytenhek

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).