Skip to content

Instantly share code, notes, and snippets.

@Rmanaf
Created November 6, 2023 08:11
Show Gist options
  • Save Rmanaf/91482a5b885943fec7b2e32c87f9fe73 to your computer and use it in GitHub Desktop.
Save Rmanaf/91482a5b885943fec7b2e32c87f9fe73 to your computer and use it in GitHub Desktop.
SVN Commit Automation for Unix-like environment
#!/bin/bash
# SVN Automation Script
# Usage:
# 1. Save this script to a file (e.g., svn_auto_commit.sh)
# 2. Make it executable by running 'chmod +x svn_auto_commit.sh' in the terminal
# 3. Run it to commit the changes
read -e -p "Enter the SVN working copy directory: " svn_dir
# Check if the directory exists
if [ ! -d "$svn_dir" ]; then
echo "Error: The specified directory does not exist."
exit 1
fi
cd "$svn_dir"
read -p "Do you want to authenticate with a username and password? (y/n): " authenticate
if [ "$authenticate" == "y" ] || [ "$authenticate" == "Y" ]; then
read -p "Enter your SVN username: " svn_username
read -s -p "Enter your SVN password: " svn_password
echo
# Set SVN credentials
svn auth --username "$svn_username" --password "$svn_password"
fi
read -p "Enter the commit message: " commit_message
svn update
svn add --force *
svn status | grep '!' | awk '{print $2}' | xargs svn delete
svn commit -m "$commit_message"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment