r12342 - in software: . list-inactive-members

Evgeni Golov evgeni at alioth.debian.org
Sat May 14 12:13:09 UTC 2011


Author: evgeni
Date: 2011-05-14 12:12:54 +0000 (Sat, 14 May 2011)
New Revision: 12342

Added:
   software/list-inactive-members/
   software/list-inactive-members/get-git-commits.sh
   software/list-inactive-members/get-members.py
   software/list-inactive-members/get-svn-commits.sh
Log:
add a bunch of scripts to find inactive members of a team


Added: software/list-inactive-members/get-git-commits.sh
===================================================================
--- software/list-inactive-members/get-git-commits.sh	                        (rev 0)
+++ software/list-inactive-members/get-git-commits.sh	2011-05-14 12:12:54 UTC (rev 12342)
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ -z "$REPOBASE" -o -z "$OUT" ]; then
+	echo "You have to call:"
+	echo "$0 <git-repo-base> <output-file>"
+	exit 1
+fi
+
+GIT=`which git`
+GREP=`which grep`
+SED=`which sed`
+REPOBASE=`readlink -f $1`
+OUT=`readlink -f $2`
+
+for proj in $REPOBASE/*.git; do
+	cd $proj; $GIT log --date=short --pretty=format:"%ad::%an::%ae" >> $OUT
+done


Property changes on: software/list-inactive-members/get-git-commits.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: software/list-inactive-members/get-members.py
===================================================================
--- software/list-inactive-members/get-members.py	                        (rev 0)
+++ software/list-inactive-members/get-members.py	2011-05-14 12:12:54 UTC (rev 12342)
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+URL = 'https://alioth.debian.org/project/memberlist.php?group_id=30862'
+LIMIT = '2010-01-01'
+
+import urllib2
+from BeautifulSoup import BeautifulSoup
+import re
+import sys
+enc = sys.stdout.encoding or 'ascii'
+
+def get_members(teamurl, svn_file, git_file, since, only_inactive=True):
+    userinfo = {}
+    html = urllib2.urlopen(URL).read()
+    soup = BeautifulSoup(html)
+
+    table = soup.find('table', attrs={'class': 'width-100p100 listTable'})
+    trs = table.findAll('tr')
+    for tr in trs:
+        tds = tr.findAll('td')
+        if tds:
+            name = tds[0].string or tds[0].contents[0].string
+            user = tds[1].contents[0].string
+            userinfo[user] = {}
+            userinfo[user]['name'] = name
+            userinfo[user]['user'] = user
+            userinfo[user]['svn'] = '1970-01-01'
+            userinfo[user]['git'] = '1970-01-01'
+
+    svnfile = open(svn_file)
+    svncommits = []
+    for line in svnfile:
+        line = line.strip()
+        commit = {}
+        commit['date'] = line.split('::')[0]
+        commit['user'] = line.split('::')[1]
+        svncommits.append(commit)
+
+    gitfile = open(git_file)
+    gitcommits = []
+    for line in gitfile:
+        line = line.strip()
+        try:
+            line = line.decode('utf-8')
+        except:
+            line = line.decode('latin1')
+        commit = {}
+        commit['date'] = line.split('::')[0]
+        commit['name'] = line.split('::')[1].lower()
+        commit['email'] = line.split('::')[2].lower()
+        gitcommits.append(commit)
+
+    for user in userinfo:
+        for commit in svncommits:
+            if commit['user'] == user:
+                if userinfo[user]['svn'] < commit['date']:
+                    userinfo[user]['svn'] = commit['date']
+        for commit in gitcommits:
+            if commit['email'].find(user.replace('-guest','')) != -1 or commit['name'] == userinfo[user]['name'].lower():
+                if userinfo[user]['git'] < commit['date']:
+                    userinfo[user]['git'] = commit['date']
+
+    for user in userinfo:
+        if not only_inactive or (userinfo[user]['svn'] < LIMIT and userinfo[user]['git'] < LIMIT):
+            s = "%(name)s <%(user)s at alioth.debian.org>" % userinfo[user]
+            print s.encode(enc, 'replace')
+
+if __name__ == '__main__':
+    if len(sys.argv) != 3:
+        print "You have to call:"
+        print "%s <svn-commits-file> <git-commits-file>" % sys.argv[0]
+        sys.exit(1)
+
+    get_members(URL, sys.argv[1], sys.argv[2], LIMIT)


Property changes on: software/list-inactive-members/get-members.py
___________________________________________________________________
Added: svn:executable
   + *

Added: software/list-inactive-members/get-svn-commits.sh
===================================================================
--- software/list-inactive-members/get-svn-commits.sh	                        (rev 0)
+++ software/list-inactive-members/get-svn-commits.sh	2011-05-14 12:12:54 UTC (rev 12342)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ -z "$REPO" -o -z "$OUT" ]; then
+	echo "You have to call:"
+	echo "$0 <svn-repo> <output-file>"
+	exit 1
+fi
+
+SVN=`which svn`
+GREP=`which grep`
+SED=`which sed`
+REPO=$1
+OUT=$2
+
+$SVN log $REPO |$GREP "^r[0-9]" |$SED 's#^\(r[0-9]*\) | \([^ ]*\) | \([^ ]*\) .*#\3::\2#' > $OUT


Property changes on: software/list-inactive-members/get-svn-commits.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Pkg-games-commits mailing list