[GRASS-SVN] r70753 - grass/trunk/tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 14 09:48:16 PDT 2017
Author: hcho
Date: 2017-03-14 09:48:16 -0700 (Tue, 14 Mar 2017)
New Revision: 70753
Modified:
grass/trunk/tools/svnlog.sh
Log:
svnlog.sh: add --user; print raw log by default; add --compact
Modified: grass/trunk/tools/svnlog.sh
===================================================================
--- grass/trunk/tools/svnlog.sh 2017-03-12 14:35:42 UTC (rev 70752)
+++ grass/trunk/tools/svnlog.sh 2017-03-14 16:48:16 UTC (rev 70753)
@@ -15,7 +15,10 @@
#
#############################################################################
+user=""
+compact=0
prefix="revision"
+get_user=0
get_prefix=0
# collect revision numbers from command line arguments, if any
@@ -28,11 +31,26 @@
Options:
-h, --help print this help
+ -u, --user USER search for revisions by USERs separated by a comma
+ -c, --compact print compact log messages; used with --prefix
-p, --prefix PREFIX print PREFIX followed by a space and the revision number;
- print no space if PREFIX is empty
+ print no space if PREFIX is empty; used with --compact
EOT
exit
fi
+ if [ "$i" = "-u" -o "$i" = "--user" ]; then
+ get_user=1
+ continue
+ fi
+ if [ $get_user -eq 1 ]; then
+ user=`echo $i | sed 's/^/^(/; s/,/|/g; s/$/)$/'`
+ get_user=0
+ continue
+ fi
+ if [ "$i" = "-c" -o "$i" = "--compact" ]; then
+ compact=1
+ continue
+ fi
if [ "$i" = "-p" -o "$i" = "--prefix" ]; then
get_prefix=1
continue
@@ -56,9 +74,16 @@
fi
# retreive and combine log messages
-svn log $revs | awk --assign prefix="$prefix" '
+svn log $revs |
+awk \
+ --assign user="$user" \
+ --assign compact=$compact \
+ --assign prefix="$prefix" \
+'BEGIN{
+ any = 0
+}
/^------------------------------------------------------------------------$/{
- if(rev != ""){
+ if(compact && rev != ""){
gsub(/^[ \t\n]+|[ \t\n]+$/, "", msg)
nlines = split(msg, lines, /\n/)
if(nlines == 0)
@@ -74,15 +99,35 @@
prev_multi = nlines > 1
}
started = 1
+ sep = $0
rev = msg = ""
next
}
{
if(started){
- rev = $1
started = 0
+ if(user == "" || $3 ~ user){
+ any = 1
+ skip = 0
+ if(compact)
+ rev = $1
+ else{
+ print sep
+ print
+ print ""
+ }
+ }else
+ skip = 1
getline
next
+ }else if(!skip){
+ if(compact)
+ msg = msg $0 "\n"
+ else
+ print
}
- msg = msg $0 "\n"
+}
+END{
+ if(!compact && any)
+ print sep
}'
More information about the grass-commit
mailing list