Skip to content

Instantly share code, notes, and snippets.

@p4p1
Last active April 10, 2020 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p4p1/85393014efb6eb029bdf38dd2499fd40 to your computer and use it in GitHub Desktop.
Save p4p1/85393014efb6eb029bdf38dd2499fd40 to your computer and use it in GitHub Desktop.
SVN script to simplify it's usage
#!/bin/bash
# svnbyleo.sh
#
# Description:
# Simple script to use svn as if it was git
echo -n "Check SVn -> "
if hash svn;then
echo -e "\e[1;34m:)\e[m"
else
echo -e "\e[1;31m:(\e[m"
if [ "$EUID" -ne 0 ]; then
echo -e "\e[1;31mPlease run as root\e[m"
exit 84
fi
apt install subversion
fi
if ! [ "${#@}" -eq "0" ]; then
if [ $1 = "install" ];then
if [ "$EUID" -ne 0 ]; then
echo -e "\e[1;31mPlease run as root\e[m"
exit 84
else
cp -r $0 /usr/bin/
fi
fi
if [ $1 = "add" ]; then
if [ "${#@}" -eq "2" ]; then
svn add $2
else
echo "Usage: $0 add [FILE]"
exit 84
fi
fi
if [ $1 = "clone" ]; then
if [ "${#@}" -eq "2" ]; then
svn co $2
else
echo "Usage: $0 clone [REPO]"
exit 84
fi
fi
if [ $1 = "commit" ]; then
echo "there is no commit in svn you just need to push with a message"
fi
if [ $1 = "push" ]; then
if [ "${#@}" -eq "2" ]; then
svn commit -m $2
else
echo "Usage: $0 push [MESSAGE TO PUSH]"
exit 84
fi
fi
if [ $1 = "pull" ]; then
svn update
fi
if [ $1 = "status" ]; then
svn status
fi
if [ $1 = "log" ]; then
svn log
fi
if [ $1 = "diff" ]; then
svn diff
fi
else
echo
echo "Installation:"
echo "$0 install -> install this script"
echo
echo "Usage:"
echo "$0 add [FILE]"
echo "$0 clone [https://REPO/TO/CLONE/]"
echo "$0 push [MESSAGE TO PUSH]"
echo "$0 pull"
echo "$0 status"
echo "$0 log"
echo "$0 diff"
exit 84
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment