Skip to content

Instantly share code, notes, and snippets.

@hankpillow
Forked from mcarneiro/log-by-user
Created February 22, 2011 12:22
Show Gist options
  • Save hankpillow/838593 to your computer and use it in GitHub Desktop.
Save hankpillow/838593 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " log changes by user (SVN)";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " log-by-user SVN_PARAMETERS USERNAME";
echo -e "";
echo -e "${B1}EXAMPLES${B2}";
echo -e " log-by-user -l10 \"mcarneiro\"";
echo -e " log-by-user -r10:HEAD \"mcarneiro\"";
echo -e "";
exit 1;
fi
svn log -v $1 | sed -n "/"$2"/,/-----$/ p"
#!/bin/bash
svn status $1 | grep "^?" | awk '{print $2}' | xargs svn add
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " add files and folders recursivelly applying the current \"svn:ignore\" property";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " svn-ignore-add FOLDER_NAME";
echo -e "";
exit 1;
fi
svn add $1 --force --depth empty; svn pset svn:ignore "$(svn pget svn:ignore .)" $1; svn add $1 --force --depth files;
DIRECTORIES=(`svn st $1 | grep "^?" | awk '{print$2}'`);
if [ "$DIRECTORIES" != "" ]
then
for a in "${DIRECTORIES[@]}";
do
if [ -d "$a" ]
then
svn-ignore-add $a;
fi;
done;
fi;
#!/bin/bash
# quick way to get svn revision. useful for using in another functions
# usage svn-rev [FOLDER]
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " quick way to get svn revision. useful for using with another functions";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " svn-rev [FOLDER]";
echo -e "";
exit 1;
fi
svn info $1 | grep "Revision:" | awk '{print$2}'
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " removes all \"._\" files from the server (SVN) using the current working folder path as reference";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " svn-rm-mac-hidden MESSAGE";
echo -e "";
echo -e "${B1}REQUIRE${B2}";
echo -e " svn-url";
echo -e "";
exit 1;
fi
HAS_SVN_URL="$(type -t svn-url)";
if [ "$HAS_SVN_URL" = "" ];
then echo "ERROR: \"svn-url\" command is required. Get it on \"http://gist.github.com/580966#file_svn_url\"";
exit 1;
fi;
if [ "$1" = "" ];
then echo "ERROR: Message is required.";
exit 1;
fi;
FILE_LIST="$(for a in $(svn ls $(svn-url) --depth infinity | grep "\._"); do echo "$(svn-url)$a"; done;)";
if [ "$FILE_LIST" != "" ];
then svn rm $FILE_LIST -m "$1";
else echo "WARNING: Nothing to do.";
fi;
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " Gets only the url from svn info command";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " svn-url [BACK] [FOLDER]";
echo -e "";
echo -e " BACK number of \"back directories\" from the current url";
echo -e " FOLDER folder to execute svn info";
echo -e "";
echo -e "${B1}EXAMPLES${B2}";
echo -e " svn-url # https://svn.domain:8443/svn/project/branches/"
echo -e " svn-url 1 # https://svn.desenv:8443/svn/project/"
echo -e " svn-url 0 test/ # https://svn.desenv:8443/svn/project/branches/test/"
echo -e "";
exit 1;
fi
URL_BACK_NUM="0"
URL=$(svn info $2 | grep "URL:" | awk '{print $2}')"/"
if [ "$1" != "" ]
then
URL_BACK_NUM="$1"
fi
if [ "$URL_BACK_NUM" = "0" ]
then
echo $URL
else
URL_TO_FILTER=$(echo $URL | awk -F "/" '{print $(NF+'$(($URL_BACK_NUM))')}')
echo $URL | awk -F "$URL_TO_FILTER/" '{print$1}'
fi
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-01-11)";
echo -e " Creates a zip file with the modified or created files from a range of revisions";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " zip-by-log FILENAME SVN_PARAMETERS";
echo -e "";
echo -e "${B1}EXAMPLES${B2}";
echo -e " zip-by-log ftp.zip -l10";
echo -e " zip-by-log ftp.zip \"-r10 -r20\"";
echo -e "";
exit 1;
fi
PATH_TO_FILTER="$(pwd | awk -F "/" '{print $(NF)}')";
zip $1 $(svn log $2 -v | grep $PATH_TO_FILTER | grep -E "\s+?[AMR]" | awk -F "$PATH_TO_FILTER/" '{print $2}' | awk '{print $1}' | grep "\." | sort -u)
#!/bin/bash
if [ "$1" = "?" ]
then
B1="\033[1m";
B2="\033[0m";
echo -e "";
echo -e "${B1}AUTHOR${B2}";
echo -e " Marcelo Miranda Carneiro - mcarneiro@gmail.com";
echo -e "";
echo -e "${B1}INFO${B2} (release 2011-02-18)";
echo -e " Creates a zip file with the modified or created files from the current changes on working copy";
echo -e "";
echo -e "${B1}USAGE${B2}";
echo -e " zip-by-log [FILENAME]";
echo -e "";
echo -e "${B1}EXAMPLES${B2}";
echo -e " zip-by-status # if no name is passed, creates a 'status.zip' file";
echo -e " zip-by-status ftp.zip";
echo -e "";
exit 1;
fi
FILENAME=$1;
if [ "$FILENAME" = "" ];
then
FILENAME="status.zip";
fi
zip $FILENAME $(svn st | grep "^[AM]" | awk '{print$(NF)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment