Skip to content

Instantly share code, notes, and snippets.

@jbgutierrez
Created October 30, 2009 19:15
Show Gist options
  • Save jbgutierrez/222636 to your computer and use it in GitHub Desktop.
Save jbgutierrez/222636 to your computer and use it in GitHub Desktop.
#!/bin/bash
##
# *1 Tiene algo que ver con los saltos de línea pero no sé muy bien! :-(
OLDIFS=$IFS
IFS=$'\n'
FILE_NAME=$1
LINES=`svn log $FILE_NAME`
##
# RegExp
VERSION="^V\.."
RIGHT_BRACKET="^}"
LEFT_BRACKET="^{"
BRACKETS=($RIGHT_BRACKET $LEFT_BRACKET)
##
# Evalua expresiones regulares para usar en condiciones if
function is_a {
regexp=$1
return `echo "$line" | grep -q -e "$regexp"`
}
##
# Inicializa la expressión regular para determinar comienzos de comentarios
function set_left_bracket()
{
is_a_comment=1
bracket=$LEFT_BRACKET
}
##
# Cambiar de expressión regular y establece si la siguiente línea será un comentario
function toggle_current_bracket {
is_a_comment=$((($is_a_comment + 1) % 2))
bracket=${BRACKETS[$is_a_comment]}
}
##
# El algoritmo en sí
set_left_bracket
for line in $LINES; do
if is_a $bracket; then
toggle_current_bracket;
continue;
fi;
if is_a $VERSION; then
echo "\n"$line
set_left_bracket
continue;
fi;
if [ $is_a_comment -eq 0 ]; then
echo "\t" $line
fi
done;
# tiene que ver con *1
IFS=$SAVEIFS
------------------------------------------------------------------------
rX | jbgutierrez | YYYY-MM-DD HH:mm:ss ...
V.1.1
{
Se elimina el uso del subrayado en el documento
}
------------------------------------------------------------------------
rX | jbgutierrez | YYYY-MM-DD HH:mm:ss ...
{
El Depto. de Calidad informa de "...ausencia total de acentos en el documento...". {2009/09/27}. Se ha corregido los siguientes apartados:
2. DESCRIPCIÓN DEL SISTEMA ACTUAL
2.3. LISTA DE PROBLEMAS, DEFICIENCIAS Y MEJORAS
}
Qué pesados los de calidad! (Este comentario tampoco se incluye)
{
Se revisan los formatos de los encabezados
}
------------------------------------------------------------------------
rX | jbgutierrez | YYYY-MM-DD HH:mm:ss ...
V.1.0
Hey, este comentario no se incluirá!!!
------------------------------------------------------------------------
rX | jbgutierrez | YYYY-MM-DD HH:mm:ss ...
Se cubren los datos generales del documento; autor, proyecto, epigrafe ...
------------------------------------------------------------------------
rX | jbgutierrez | YYYY-MM-DD HH:mm:ss ...
commit inicial
------------------------------------------------------------------------
V.1.1
Se elimina el uso del subrayado en el documento
El Depto. de Calidad informa de "...ausencia total de acentos en el documento...". {2009/09/27}. Se ha corregido los siguientes apartados:
2. DESCRIPCIÓN DEL SISTEMA ACTUAL
2.3. LISTA DE PROBLEMAS, DEFICIENCIAS Y MEJORAS
Se revisan los formatos de los encabezados
V.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment