In fact, in code_swarm, you can display any statistics that changes over time and which has an object , which is something and the subject over which the action is performed. In the classic case, when the log for code_swarm is unloaded, let's say a platform such as showteamwork , the object is the programmer, the subject file. In our case, the object will be the file and the subject line, which is added or deleted.
<? xml version ="1.0" ? > < file_events > < event date ="" author ="" filename ="" action ="" comment ="" /> </ file_events >
<? xml version ="1.0" ? > < file_events > < event date ="" author ="" filename ="" action ="" comment ="" /> </ file_events >
<? xml version ="1.0" ? > < file_events > < event date ="" author ="" filename ="" action ="" comment ="" /> </ file_events >
<? xml version ="1.0" ? > < file_events > < event date ="" author ="" filename ="" action ="" comment ="" /> </ file_events >
1142998387000:John Resig<br>&ajax/ajax.js<br>new file mode 100644<br> +// AJAX Plugin<br>+// Docs Here:<br>+// http://jquery.com/docs/ajax/<br>+if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {<br>+var XMLHttpRequest = function() {<br>+return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') = 0) ?<br> -Microsoft.XMLHTTP : Msxml2.XMLHTTP);<br>-};<br>-} <br> +.xml = function( type, url, data, ret ) {<br>+var xml = new XMLHttpRequest();<br>+if ( xml ) {<br>+xml.open(type || GET, url, true);<br>+if ( data )<br>+xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');<br>+if ( ret )<br>+xml.onreadystatechange = function() {<br>
This file is unloaded by the command:git log -U0 --diff-filter=AMD --reverse --pretty= "%at000:%cn" -10 | \<br> grep -v "^\(-\{3\}\|+\{3\}\) " | \<br> grep -v "^[+-][ ]*$" | \<br> grep -v "^[+-]$" | \<br> grep -v "^[ ]*$" | \<br> sed -e "s/diff .* b\//\&/g" \<br> -e "s/^+[ ]\+/+/g" \<br> -e "s/^-[ ]\ + /-/g" \<br> -e "s/[ ]\+$//g" \<br> -e "s/^$//g" \<br> -e 's/\\/\\\\/g' \<br> -e "s/[\"\`<>$]//g"
I think it is worth describing what and for what here:#!/bin/sh
generate () {
if test -t 1 ; then
exec > $logfile
fi
echo -e "<?xml version=\"1.0\"?>\n<file_events>"
echo "generating ..." >& 2
awk - v typegen = $1 '
BEGIN {
split("\b\b\b\b\b. . . . . \b- \b\b- \b\b- \b\b- \b\b- \b= = = = =", st, " ")
ist=0
_ord_init()
typehash=0
if( typegen == "ch_code") {
typehash=1
}
else if( typegen == "crypt" ) {
typehash=2
}
}
function _ord_init(low, high, i, t)
{
low = sprintf("%c", 7)
if (low == "\a") {
low = 0
high = 127
} else if (sprintf("%c", 128 + 7) == "\a") {
low = 128
high = 255
} else {
low = 0
high = 255
}
for (i = low; i <= high; i++) {
t = sprintf("%c", i)
_ord_[t] = i
}
}
function ord(str, c) {
c = substr(str, 1, 1);
return _ord_[c];
}
/^[0-9]/ {
sub(/:.*/, "");
d=$0;
next;
}
/^&/ {
sub(/&/, "");
f=$0
substr($0, 2, length($0) - 1);
next;
}
/^\+/ { a="A"; }
/^-/ { a="D"; }
/^[\+-]/ {
sub(/[\+-]/, "")
str=""
if( typehash == 1) {
for(i=1; i<length($0); i++){
str = str "" ord(substr($0, i, 1))
}
gsub(/32|16/, "/sd", str)
str = substr(str, 0, length(str)-2) "." substr(str, length(str)-1, 2);
}
else {
cmd="echo \"" $0 "\" | md5sum | cut -f1 -d \" \" | sed -e \"s@[32|16]@/sd@g;\" -e \"s/\\(..\\)\$/.\\1/\""
if ( typehash == 2 )
cmd="C:/Perl/bin/perl -e \"print crypt($ARGV[0], $ARGV[1])\" \"" $0 "\" \"1/5l58j/jk\""
cmd | getline str;
close(cmd);
}
if (str != "")
print "<event date=\""d"\" author=\""f"\" filename=\""str"\" action=\""a"\" comment=\"\"/>"
system("echo -ne \"" st[ist++] "\" >&2")
if (ist > 16) ist=0
}
' $gitdiff
echo - ne "\b\b\b\b\b\b\b\b\b\b\b\bcompleted!" >& 2
echo "</file_events>"
rm $gitdiff
}
prepare_git () {
git log - U0 -- diff-filter = AMD -- reverse -- pretty = "%at000:%cn" $1 | \
grep - v "^\(-\{3\}\|+\{3\}\) " | \
grep - v "^[+-][ ]*$" | \
grep - v "^[+-]$" | \
grep - v "^[ ]*$" | \
sed -e "s/diff .* b\//\&/g" \
-e "s/^+[ ]\+/+/g" \
-e "s/^-[ ]\+/-/g" \
-e "s/[ ]\+$//g" \
-e "s/^$//g" \
-e 's/\\/\\\\/g' \
-e "s/[\"\`<>$]//g" > $gitdiff
}
fileaction = "$(date +%j%H%M%s)"
typehash = md5
[ -n "$1" ] && typehash = $1 || echo -e " " + \
" \n :\n" + \
"\t\tmd5 — -\n\t\tcrypt\n\t\tch_code\nusing: $0 crypt" >& 2
echo " : " $typehash >& 2
[ -n "$2" ] && countcommit = $2 || echo -e " \n" + \
"git log --help\n:\t-<n>\n\t\tLimits the number of commits to show.\nusing: $0 crypt -10" >& 2
echo -n " : " >& 2
[ -n "$2" ] && echo $2 ' ' >& 2 || echo " " >& 2
gitdiff = $fileaction ".temp"
logfile = $fileaction "actions.xml"
prepare_git $countcommit
generate $typehash
$ echo "{ } \$@" > /bin/genlogcs
Actually, by generating activity, everything.#
ColorAssign1 = "DigitLetter" , ".*[0-9][az]" , 43 , 170 , 215 , 43 , 170 , 215
#
ColorAssign2 = "LetterDigit" , ".*[az][0-9]" , 255 , 134 , 51 , 255 , 134 , 51
#
ColorAssign3 = "LetterLetter" , ".*[az][az]" , 43 , 110 , 214 , 43 , 110 , 214
#
ColorAssign4 = "DigitDigit" , ".*[0-9][0-9]" , 41 , 242 , 185 , 41 , 242 , 185
Width = 1280
Height = 720
InputFile = data / my / data / actions . xml
PhysicsEngineConfigDir = physics_engine
PhysicsEngineSelection = PhysicsEngineOrderly
ParticleSpriteFile = src / particle . png
Font = Helvetica
FontSize = 16
BoldFontSize = 16
#MillisecondsPerFrame=2254085
MaxThreads = 4
Background = 0 , 0 , 0
TakeSnapshots = true
SnapshotLocation = data / my / png / cs - #####. png
DrawNamesSharp = true
DrawNamesHalos = true
DrawFilesSharp = false
DrawFilesFuzzy = true
DrawFilesJelly = false
ShowLegend = true
ShowHistory = true
ShowDate = true
ShowEdges = false
ShowDebug = false
EdgeLength = 36
EdgeDecrement = - 2
FileDecrement = - 1
PersonDecrement = - 1
FileSpeed = 7.0
PersonSpeed = 2.0
FileMass = 2.0
PersonMass = 10.0
EdgeLife = 250
FileLife = 200
PersonLife = 255
HighlightPct = 5
UseOpenGL = false
ShowUserName = true
IsInputSorted = false
This file is useful to us in the future.#!/bin/sh
uses (){
echo -e 'using\n$0 file_codeswarm.xml'
}
generatelog (){
echo "genereting... "
state =( "\\" "|" "/" "—" )
i = 0
if [ -f "$1" ]; then
result = ${1%.*} '.log'
echo -n > $result
# event
grep -e "event " $1 | \
#
# <event />
sed -e "s/^[ ]*//;s/^<event //g;s|/>$||g" | \
while read line
do
date = ""
# , 4
eval $line ;
# date,
[ -n "$date" ] && [ "`echo -n $data | wc -c`" - gt "10" ] && date = `echo $data | sed -e "s/^\(.\{10\}\).*/\1/"`
[ -n "$date" ] && echo "$date|$author|$action|$filename" >> $result
# .
echo - ne "\b${state[$i]}"
(( i += 1 ))
[[ $i - eq 5 ]] && i = 0
done
echo - ne "\bcompleted!"
else
echo -e "file log code_swarm not exsits!\n$1"
fi
}
[ -n "$1" ] && generatelog $1 || uses
This script uses the useful eval function. It executes the text as if you typed it into the command line. This approach is convenient in our case, since the input line has the following form:date ="1142998387000" author ="ajax/ajax.js" filename ="c9/sd/sd9db4/sd/sd/sdb945/sdb89a/sd/sd7/sd/sdfbfdf.04" action ="A" comment =""
As you understand, the system will process this line and we will have 5 variables date , author , filename , action , comment (thanks to bliznezz ). These variables are uploaded to a file with the following format:date|author|action|filename
True with gource, you can already customize this format. The file processing format is in the file {gource_home} /data/gource.stylecall sh gen_log ./data/actions.xml
call sh sort_log ./data/actions.log > data\gource.log
pushd png
del *.png
popd
pushd ..\..
call run.bat data\my\my.config
popd
pushd png
call "..\tools\nt\mencoder" mf://*.png -mf fps=19:type=png -ovc x264 -x264encopts pass=1:bitrate=1000 -oac copy -audiofile "..\data\audio.wav" -o "..\results\result.avi"
popd
pushd "tools\gource"
call gource.exe --hide filenames,dirnames --user-scale 2 --output-framerate 25 --stop-position 1 --highlight-all-users --seconds-per-day 1 --output-ppm-stream "..\..\results\resultgource.ppm" "..\..\data\gource.log"
popd
pushd "tools\nt"
call ffmpeg -y -b 9000K -f image2pipe -vcodec ppm -i "..\..\results\resultgource.ppm" -fpre "..\ll.ffpreset" -i "..\..\results\resultgource.ppm" -vcodec libx264 "..\..\results\resultgource.avi"
call mencoder "..\..\results\resultgource.avi" -ovc x264 -x264encopts pass=1:bitrate=10000 -ofps 19 -speed 2 -o "..\..\results\resultgource.fps"
call mencoder "..\..\results\resultgource.fps" -ovc x264 -x264encopts pass=1:bitrate=10000 -oac copy -audiofile "..\..\data\audio.wav" -o "..\..\results\resultgource.avi"
popd
del results\resultgource.ppm
del results\resultgource.fps
del data\actions.log
This script performs the following actions:$ git clone git://github.com/artzub/code_swarm-gource-my-conf.git test
and post your results to me very interesting.Source: https://habr.com/ru/post/114630/
All Articles