編輯:關於android開發
一部分為實際統計計算部分,代碼如下:
- #!/bin/bash
- # 按照cdc.txt 中定義的目錄統計個項目的總提交次數、增加、刪除、留存代碼行數
- # 統計按照自然月進行或者指定時段進行 $1 為月份(1-12)
- ### 當前目錄###
- if [ $(echo $0 | grep '^/') ]; then
- cur_dir=$(dirname $0)
- else
- cur_dir=$(pwd)/$(dirname $0)
- fi
- ### 定義使用文件###
- repo_file=$cur_dir/cdc.txt #定義版本庫目錄文件
- everyone_file=$cur_dir/every.txt
- goluk_file=$cur_dir/goluk.csv
- ### 接收月份參數###
- Month=$1
- :>$goluk_file
- while read name project_dir
- do
- echo $name |awk '{printf "%-20s%1s%10s%1s%10s%1s%10s%1s%10s\n",$1, \
- "," , "提交次數" , "," , "增加代碼" , "," , "減少代碼" , "," , "留存代碼"}' >> $goluk_file
- everyone_file=$cur_dir/$project_dir/every.txt
- ### 匯總計算各人的代碼行數
- ### 刪除空行
- awk '!/^$/' $everyone_file |\
- ### 計算
- awk '{if($1 ~ /^[a-zA-Z]+$/) {if(NR==1){printf "%20s",$1 }else {printf "\n%20s%8d%8d",$1,adds,dels;adds=0;dels=0}} \
- else{adds=adds+$1;dels=dels+$2;next} }' |\
- ### 匯總
- awk '{cnt[$1]++;name[$1]=$1;adds[$1]+=$2;dels[$1]+=$3}END{for(i in name) printf "%-20s%1s%10d%1s%10d%1s%10d%1s%10d\n",\
- name[i],",",cnt[i],",",adds[i],",",dels[i],",",adds[i]-dels[i]}' >> $goluk_file
- done < $repo_file
最後一部分腳本,是首次git clone版本庫用的
- #!/bin/bash
- # 統計後台的總的提交次數、增加、刪除、留存代碼行數
- # 統計按照自然月進行或者指定時段進行 $1 為月份(1-12)
- #### 定義分支 ####
- if [ $2 = "" ] ; then
- Branch=develop
- else
- Branch=$2
- fi
- #### 定義版本庫 ####
- #git_repo=cdc.txt
- ### 當前目錄###
- if [ $(echo $0 | grep '^/') ]; then
- cur_dir=$(dirname $0)
- else
- cur_dir=$(pwd)/$(dirname $0)
- fi
- ### 定義使用文件###
- repo_file=$cur_dir/cdc.txt #版本庫定義
- commit_file=$cur_dir/commit.txt #提交次數明細
- total_file=$cur_dir/total.txt #每人提交次數匯總
- detail_file=$cur_dir/detail.txt #每人提交行數明細
- everyone_file=$cur_dir/every.txt
- ### 接收月份參數###
- Month=$1
- ### 初始化中間文件###
- :>$commit_file
- :>$detail_file
- :>$everyone_file
- ### 首先統計每個人的提交次數,記錄到中間文件
- function Count() {
- while read git_url
- do
- echo $git_url
- goluk_repo=`echo $git_url |awk -F/ '{print $NF}'`
- cd $goluk_repo
- git checkout $Branch
- git pull
- git log --pretty='%aN' --since ==2016-$Month-01 --until=2016-$Month-31 | sort | uniq -c | sort -k1 -n -r >> $commit_file
- cd ../
- done < $repo_file
- }
- ### 代碼提交行數
- function Codelines() {
- while read git_url
- do
- echo $git_url
- goluk_repo=`echo $git_url |awk -F/ '{print $NF}'`
- cd $goluk_repo
- git pull
- git checkout $Branch
- # 統計各版本總行數
- git log --author=^.* --pretty=tformat: --numstat --since=2016-$Month-01 --until=2016-$Month-31 |\
- awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } \
- END { print add,subs,loc ,repo_name }' repo_name=$goluk_repo - >> $detail_file
- ### debug begin
- ###git log --author=^.* --pretty=tformat:%aN --numstat --since=2016-$Month-01 --until=2016-$Month-31 |\
- ### awk '!/^$/' >> $cur_dir/every2.txt
- ## debug end
- # 記錄各人代碼、增加行數、刪除行數明細
- git log --pretty='tformat:%aN' --numstat --since=2016-$Month-01 --until=2016-$Month-31 >>$everyone_file
- cd ../
- done < $repo_file
- }
- #awk '{sum[$2]+=$1}END{for(i in sum)print i ,sum[i]}' scrope.txt |sort -k2 -nr >
- Count $Month
- ### 計算總提交次數
- awk '{sum[$2]+=$1}END{for(i in sum)print i ,sum[i]}' $commit_file |sort -k2 -nr > $total_file
- Codelines $Month
- ### 匯總提交數
- awk '{cnt+=$2}END{printf "%-20d%10d\n",Mon,cnt}' Mon=$Month $total_file
- ### 匯總代碼行數
- #awk '{adds+=$1;removes+=$2;saves+=$3}END{print adds,removes,saves}' $detail_file
- ### 匯總計算各人的代碼行數
- ### 刪除空行
- awk '!/^$/' $everyone_file |\
- ### 計算
- awk '{if($1 ~ /^[a-zA-Z]+$/) {if(NR==1){printf "%20s",$1 }else {printf "\n%20s%8d%8d",$1,adds,dels;adds=0;dels=0}} \
- else{adds=adds+$1;dels=dels+$2;next} }' |\
- ### 匯總
- awk '{cnt[$1]++;name[$1]=$1;adds[$1]+=$2;dels[$1]+=$3}END{for(i in name) printf "%-20s%10d%10d%10d%10d\n", name[i],cnt[i],adds[i],dels[i],adds[i]-dels[i]}'
- #!/bin/bash
- #### 定義分支 ####
- Branch=release
- #### 定義版本庫 ####
- git_repo=cdc.txt
- while read repo
- do
- git clone $repo
- done < $git_repo
- [email protected]:users/p1/cdc/authority
- [email protected]:users/p2/cdc/business
- .
- ├── GetStat.sh #第一部分腳本
- ├── android #項目目錄
- │ ├── GetAllByMon.sh #第二部分腳本
- │ ├── cdc.txt #本項目源碼的git地址
- │ ├── commit.txt
- │ ├── detail.txt
- │ ├── every.txt
- │ ├── total.txt
- │ └── workspace-goluk #項目源碼
- ├── cdc.txt # 項目名稱和目錄文件,以空格分隔
- ├── firmware #結構同上目錄
- │ ├── GetAllByMon.sh
- │ ├── Getrepo.sh
- │ ├── cdc.txt
- │ ├── commit.txt
- │ ├── detail.txt
- │ ├── every.txt
- │ ├── goluk_src
- │ ├── s2l_linux_sdk
- │ └── total.txt
Android jni helloworld,androidjni新建Android項目,設置布局: <RelativeLayout xmlns:android=
Android 交錯 GridView,androidgridview下載 Demo 交錯 GridView 交錯 GridView 只是具有不等大小行、多個列的 Gr
Android 觸摸及手勢操作GestureDetector 現在的智能手機不敢說百分百的都是觸摸屏,也應該是百分之九九以上為觸摸屏了,觸摸屏為我們操作
Android重構與設計之路,從整理提示對話框彈窗開始,android彈窗 封裝一個獨立彈窗Module,這裡的彈窗包括普通的Dialog方式彈框和WindowMana