David Chambers avatar David Chambers committed 7a898f8

initial commit

Comments (0)

Files changed (1)

+#!/usr/bin/env perl -w
+
+use strict;
+use Encode;
+
+my @bars = split //, "\x{2581}\x{2582}\x{2583}\x{2584}\x{2585}\x{2586}\x{2587}";
+my %hash = ();
+my $max  = 0;
+my $now  = time;
+my $week = 7 * 24 * 60 * 60;
+
+chomp(my @lines = `hg log -M --template '{author|person}:{date|hgdate}\n'`);
+foreach (@lines) {
+  my ($name, $timestamp, $offset) = /(.+):(.+) (.+)/;
+  $timestamp += $offset;
+  if ($timestamp > $now - 52 * $week) {
+    my $count = $hash{$name}[52 - 1 - int(($now - $timestamp) / $week)] += 1;
+    if ($count > $max) { $max = $count }
+  }
+}
+print "\n";
+print "52-week contributions\n";
+print "=====================\n";
+foreach (sort { lc($a) cmp lc($b) } keys %hash) {
+  print;
+  print ' ', '.' x (30 - length decode('utf8', $_)), ' ';
+  foreach (@{$hash{$_}}) {
+    binmode STDOUT, ':utf8';
+    print $_ ? $bars[int(@bars * $_ / ($max + 1))] : ' ';
+    print ' ';
+    binmode STDOUT, ':raw';
+  }
+  print "\n";
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.