added personal line counting util
This commit is contained in:
parent
11c0d7b489
commit
fe5200c838
2 changed files with 70 additions and 0 deletions
42
countlines.bat
Normal file
42
countlines.bat
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
for /f "delims=" %%i in ('git config user.email') do set AUTHOR=%%i
|
||||
echo Checking commit stats for %AUTHOR%...
|
||||
echo.
|
||||
|
||||
echo === Last 7 days (all .java files) ===
|
||||
git log --author="%AUTHOR%" --since="7 days ago" --pretty=tformat: --numstat | findstr "\.java" > temp_java.txt
|
||||
|
||||
set added=0
|
||||
set removed=0
|
||||
|
||||
for /f "tokens=1,2" %%a in (temp_java.txt) do (
|
||||
set /a added+=%%a
|
||||
set /a removed+=%%b
|
||||
)
|
||||
|
||||
set /a net=added-removed
|
||||
echo Lines added in .java: %added%
|
||||
echo Lines removed in .java: %removed%
|
||||
echo Net lines: %net%
|
||||
echo.
|
||||
|
||||
echo === All time (excluding *Test.java) ===
|
||||
git log --author="%AUTHOR%" --pretty=tformat: --numstat -- . ":(exclude)*Test.java" | findstr "\.java" > temp_java.txt
|
||||
|
||||
set added=0
|
||||
set removed=0
|
||||
|
||||
for /f "tokens=1,2" %%a in (temp_java.txt) do (
|
||||
set /a added+=%%a
|
||||
set /a removed+=%%b
|
||||
)
|
||||
|
||||
set /a net=added-removed
|
||||
echo Lines added in .java (excluding *Test.java): %added%
|
||||
echo Lines removed in .java (excluding *Test.java): %removed%
|
||||
echo Net lines: %net%
|
||||
|
||||
del temp_java.txt
|
||||
endlocal
|
||||
28
countlines.sh
Normal file
28
countlines.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
AUTHOR=$(git config user.email)
|
||||
echo -e "Checking commit stats for \033[38:5:2m$AUTHOR\033[0m..."
|
||||
|
||||
# Get numstat for commits by author, filter only .java lines
|
||||
git log --author="$AUTHOR" --since="7 days ago" --pretty=tformat: --numstat \
|
||||
| awk '
|
||||
$3 ~ /\.java$/ {
|
||||
added += $1
|
||||
removed += $2
|
||||
}
|
||||
END {
|
||||
print "Lines added in .java:", added
|
||||
print "Lines removed in .java:", removed
|
||||
print "Net lines:", added - removed
|
||||
}'
|
||||
git log --author="$AUTHOR" --pretty=tformat: --numstat -- . ':(exclude)*Test.java' \
|
||||
| awk '
|
||||
$3 ~ /\.java$/ {
|
||||
added += $1
|
||||
removed += $2
|
||||
}
|
||||
END {
|
||||
print "Lines added in .java (excluding *Test.java):", added
|
||||
print "Lines removed in .java (excluding *Test.java):", removed
|
||||
print "Net lines:", added - removed
|
||||
}'
|
||||
Loading…
Add table
Add a link
Reference in a new issue