Skip to content

Show whether a working copy needs commit/update #155

Description

@GoogleCodeExporter
In the list of working copies, add a tag so that I can see if there are files 
that needs updates. See my (quick and dirty) geektools script that does the 
same for me if I place my working copies in the specified directories below:

---
#!/bin/sh

parse_svn_status() {
    local REV=$(                # get svn revision number
        svn info "$1" 2>/dev/null | grep Revision | sed -e 's/Revision: //'
    )
    [ "$REV" ] || return        # stop now if not a working copy

    local STATUS=(              # create an array

        # svn status items (second column is always ' ', 'C', or 'M')
        $( svn st "$1" | grep '^[^ ][ CM]' | \

        # first column only, filter duplicates
        sed -Ee 's/^(.).*$/\1/' | awk 'x[$0]++ == 0' )
    )

    [ "$STATUS" ] || return

    echo "$1 (${STATUS[*]})"
}

alldirs() {
for file in *; do
    if [ -d "$file" ]; then
#   echo "Checking:" "$file"
    parse_svn_status "$file";
    fi
done
}

echo "Subversion Dirty Working Copies"
echo ""
echo "Research:"
echo "---------"
pushd /Users/msv/Documents/Research >>/dev/null
alldirs
echo ""
echo "Teaching:"
echo "---------"
pushd /Users/msv/Documents/Teaching >>/dev/null
alldirs
echo ""
pushd /Users/msv/Documents/ >>/dev/null
parse_svn_status "Personal"

popd >>/dev/null
popd >>/dev/null
popd >>/dev/null

---

Original issue reported on code.google.com by mikael.s...@gmail.com on 20 Jan 2012 at 12:32

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions