Android中用Git来抓取你感兴趣列表的提交log

    如题所述,用到的命令其实很简单,关键的就这一句

git log --stat --author=pattern
在这一句命令的基础上,我写了一个脚本用于抓取一个list中所有人的提交log,以及每次提交的文件

#!/bin/bash

#the script could catch the changelog list of openplatform kernel and android
#use this script,you should modify the three information of yours 
#1.HOME_NAME
#2.Add the author into the authors list
#3.set the root path of the project

HOME_NAME=xh.huang

#set the author list in order to match which committing is from ourselves
authors=(aaaaaa@google.com.cn
	bbbbbb@google.com.cn
	cccccc@google.com.cn)

#init the path which project you should catching the log list
PATH_KERNEL="/home/$HOME_NAME/kernel"
PATH_ANDROID="/home/$HOME_NAME/jb-4.2"

#init the result file of change log list which to save
RESULT_DIR="/home/$HOME_NAME/changeloglist"
RESULT_KERNEL="kernel.changelog"
RESULT_ANDROID="android.changelog"
RESULT_PROJECT=(kernel.changelog android.changelog)

#build the store where to save the result
mkdir $RESULT_DIR
cd $RESULT_DIR
for result in ${RESULT_PROJECT[*]}
{
	rm -rf $result
	touch $result
}

#catch the changeloglist of kernel
PATH_RESULT_KERNEl=$RESULT_DIR"/"$RESULT_KERNEL
echo "*************************************************************************" >> $PATH_RESULT_KERNEl
echo "The project of " $RESULT_KERNEL "changeloglist" >> $PATH_RESULT_KERNEl
echo "*************************************************************************" >> $PATH_RESULT_KERNEl
cd $PATH_KERNEL
for author in ${authors[*]}
{
    git log --stat --author=$author >> $PATH_RESULT_KERNEl
} 

#catch the changeloglist of android
PATH_RESULT_ANDROID=$RESULT_DIR"/"$RESULT_ANDROID
echo "*************************************************************************" >> $PATH_RESULT_ANDROID
echo "The project of " $RESULT_ANDROID "changeloglist" >> $PATH_RESULT_ANDROID
echo "*************************************************************************" >> $PATH_RESULT_ANDROID
cd $PATH_ANDROID
for author in ${authors[*]}
{
    repo forall -c git log --stat --author=$author >> $PATH_RESULT_ANDROID
} 
上面的脚本可以拿来直接用,你可以根据需要进行修改,其中repo forall是对Android中的每个project执行后面的git命令

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值