Skip to content

Instantly share code, notes, and snippets.

@huntlyc
Created January 28, 2015 16:36
Show Gist options
  • Save huntlyc/f22bd4c96d6db3793dad to your computer and use it in GitHub Desktop.
Save huntlyc/f22bd4c96d6db3793dad to your computer and use it in GitHub Desktop.
svnli
#!/bin/bash
#
# Author: Huntly Cameron <[email protected]>
# Date: 2015-01-25
# Licence: MIT
# Description: if working dir, lists the root forlders of the repo + branches
##
# Try an info and redriect err to std input so we can save it to the status var
status=$(svn info 2>&1)
# if the status doesn't contain 'not a working copy then run'
if [[ $status != *"is not a working copy"* ]]; then
# Find the repo root and extract it
repourl=`svn info | grep 'Repository Root' | sed -e 's/Repository\sRoot\:\s//'`
currentb=`svn info | grep 'Relative URL' | sed -e 's/Relative\sURL\:\s//'`
echo "U: $repourl";
echo "B: $currentb";
echo "";
echo "Root Folders";
echo "============";
echo $repourl | xargs svn list
echo "";
echo "Branches";
echo "========";
# get the branches as well
echo "$repourl/branches/" | xargs svn list
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment