<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>泛城科技技术博客bash &#187; 泛城科技技术博客</title>
	<atom:link href="http://tech.lezi.com/archives/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lezi.com</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jan 2013 09:18:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>统计分析svn用户每天提交的代码数</title>
		<link>http://tech.lezi.com/archives/268</link>
		<comments>http://tech.lezi.com/archives/268#comments</comments>
		<pubDate>Wed, 19 Oct 2011 06:44:51 +0000</pubDate>
		<dc:creator>neilxp</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[analyze]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://tech.lezi.com/?p=268</guid>
		<description><![CDATA[这个脚本可以分析svn 用户每天提交的代码数，有了数量的横向比较，也就知道团队里面哪个成员是有很大的潜力提升，帮助其提高。 可以在这里https://gist.github.com/1297604获取最新的代码，复制黏贴到文件里面，chmod +x 后，即可使用。 使用方法： 像下面，获取上一天某账号改动代码的数量 ./svn_ana.sh SVN_ACCOUNT_NAME &#124; wc -l 这里也附上代码，使用前将uname, password用你svn账号的用户名、密码替换 #!/bin/sh # This is a script that help you get your team member's productivity # by analyzing his/her code commiting in SVN repository, for the day before # # You can get a rough num for comparing between team members by [...]]]></description>
			<content:encoded><![CDATA[<p>这个脚本可以分析svn 用户每天提交的代码数，有了数量的横向比较，也就知道团队里面哪个成员是有很大的潜力提升，帮助其提高。</p>
<p>可以在这里<a href="https://gist.github.com/1297604">https://gist.github.com/1297604</a>获取最新的代码，复制黏贴到文件里面，chmod +x 后，即可使用。</p>
<p><span id="more-268"></span></p>
<p>使用方法：</p>
<p>像下面，获取上一天某账号改动代码的数量</p>
<pre class="brush:bash">./svn_ana.sh SVN_ACCOUNT_NAME | wc -l</pre>
<p>这里也附上代码，使用前将uname, password用你svn账号的用户名、密码替换</p>
<pre class="brush:bash">#!/bin/sh
# This is a script that help you get your team member's productivity
# by analyzing his/her code commiting in SVN repository, for the day before
#
# You can get a rough num for comparing between team members by using it in the way below
# ./svn_ana.sh SVN_ACCOUNT_NAME | wc -l
#
uname=vr
password=reader

if [ $# -lt 1 ]
then
	echo Usage: $0 ACCOUNT
	echo -e "   Where ACCOUNT is the SVN acconut name you want to analyze"
	exit -1
fi
user=$1
today=`date +%Y-%m-%d`
yesterday=`date -d '-1 day'  +%Y-%m-%d`
revisions=$(svn log -r{$today}:{$yesterday} --username $uname --password $password |grep $user'\ '|awk '{print $1}')
lastrev=init
for rawrev in $revisions
do
	rev=$(echo $rawrev|tr -d r)
	rev2=`expr $rev - 1`
	if [ "$lastrev" = "init" ]; then
		lastrev=$rev
	fi
	dummy=$(echo $revisions|grep $rev2)
	if [ $? -eq 0 ]
	then
		continue
	fi

	svn diff -r$rev2:$lastrev --username $uname --password $password
	lastrev=init
done</pre>

	<h2>您也许会对以下文章感兴趣</h2>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://tech.lezi.com/archives/268/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
