Magellan Linux

Annotation of /trunk/pkgtools/svn-branch.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1330 - (hide annotations) (download) (as text)
Tue May 31 17:42:39 2011 UTC (12 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 577 byte(s)
-added
1 niro 1330 #!/bin/bash
2     export LC_ALL=C
3    
4     usage()
5     {
6     echo "Usage: $(basename $0) BRANCH [MESSAGE]"
7     echo
8     echo "Message is optional, you must run this script within a svn tree."
9     echo
10     exit 1
11     }
12    
13     BRANCH="$1"
14     MESSAGE="$2"
15     [[ -z ${BRANCH} ]] && usage
16     [[ -z ${Message} ]] && MESSAGE="created branch '${BRANCH}'"
17    
18     URI="$(svn info | grep 'URL:' | cut -d' ' -f2)"
19     [[ $? -ne 0 ]] && usage
20     REPO_ROOT="$(svn info | grep 'Repository Root:' | cut -d' ' -f3)"
21     [[ $? -ne 0 ]] && usage
22    
23     echo "creating branch ${URI} with '${BRANCH}'..."
24     svn copy -m "${MESSAGE}" "${URI}" "${REPO_ROOT}/branches/${BRANCH}"