From ff489bc37a5b13755e5b5305fbdb84ef120e68e4 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 27 Jan 2009 23:35:09 +0100 Subject: [PATCH] gitstats: Teach 'stats.py author -f' to sort output by commit count The main usage of author -f is to find out who has been working on a certain file, so it makes sense to sort the output. --- src/git_stats/author.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/git_stats/author.py b/src/git_stats/author.py index 3c863cd..457ab0b 100644 --- a/src/git_stats/author.py +++ b/src/git_stats/author.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import operator import os import sys @@ -307,7 +308,8 @@ def dispatch(*args): result = [] - for key, value in activity_for_file.iteritems(): + for key, value in sorted(activity_for_file.iteritems(), reverse=True, + key=operator.itemgetter(1)): result.append("%s: %s" % (key, str(value))) for line in result: -- 2.11.4.GIT