Checkout[-][--][++]

Commit[-][--][++]

All commands are from the root dir of your project

To commit local changes into a report, you must run the add or delete command on each file. Run svn status shows if a file is

  • A: File to be added
  • C: Conflicting changes
  • D: File to be deleted
  • G: File to be merged with updates from server
  • M: File has been modified
  • R: File to be replaced
  • G: File to be merged
  • X: Resource is external to repository (svn:externals)
  • ?: File/directory not under version control
  • !: File/directory missing
  • ~: Versioned item obstructed by some item of a different kind.

If the file is modified (M) not change are needed, it will be commited normally. If the file is not under version control (?) this means its a new file you created, you must add it to the repo with svn add path/shown/file.txt. Now a svn status will show that file as (A), meaning added to report. Sames goes for a (!) means you deleted the file, so to update the report with the deleted file run svn delete path/shown/file.txt.

Once all the files are in sync (either you svn delete or svn add) now commit your local repo back to svn with svn commit and enter the correct comments

Commit Helper Scripts[-][--][++]

Instead of manually adding/deleting every file in svn status, here are a few helper scripts

Add all files not currently under source control (?)
svn status | grep ^? | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn add
Also Try svn add --force . (don't forget the .)

Delete all files from report not in your local dir
svn status | grep ^! | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn delete

Make sure you have all files added or deleted (in sync), this script should return nothing
svn status | grep -v ^A | grep -v ^D | grep -v ^M

Now run svn commit

Here is a script that does it all

#!/bin/bash

echo "SVN Sync for $(pwd)"

if [ ! -d ".svn" ]; then
    echo "No .svn folder found, make sure you are at the root of the svn project"
    exit 1
fi

# Add all files not currently under source countrol
if [ $(svn status | grep ^? | wc -l) -ne 0 ]; then
    svn status | grep ^? | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn add
fi

# Delete all files from svn that are not in your local dir
if [ $(svn status | grep ^! | wc -l) -ne 0 ]; then
    svn status | grep ^! | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn delete
fi

if [ $(svn status | wc -l) -eq 0 ]; then
    echo "No files modified, nothing to do"
fi

Versioned Item Obstructed[-][--][++]

If you get a bunch of ~ files they can be hard to clear up. So far the best way I have found is to temporarily move those folder out, mark them as deleted in SVN, commit, then move them back, mark them as new files, then commit. I have a script that will do this for you

#!/bin/bash

# Fix obstructed versioned items by removing them and re-adding them
# mReschke 2014-04-17

tmp="/tmp/svntemp"
if [ $(svn status | grep ^~ | wc -l) -ne 0 ]; then
    if [ -e "$tmp" ]; then
        echo "$tmp exists, please remove it first"
        exit 1
    fi
    mkdir -p $tmp
    for file in $(svn status | grep ^~ | awk -F " " '{print $2}'); do
        # Copy while preserving directory tree  
        cp -rfv --parents $file $tmp/

        # Remove copied files from svn folder
        rm -rf $file
    done
    svn status | grep ^! | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn delete
    svn commit
    cp -rfv $tmp/*
    svn status | grep ^? | awk -F " " '{print $2}' | tr "\n" "\0" | xargs -0 svn add
    svn commit
    echo
    echo "Once you verify all is good, you can delete $tmp"
else
    echo "Nothing to do, no obstructed ~ items"
fi

Tag or Branch[-][--][++]

svn copy http://svn.mreschke.net/mrcore/trunk http://svn.mreschke.net/mrcore/tags/mrcore-4.1.2 -m "Tagged for version 4.1.2 release"