Below is my code. I want a loop in this way that if folder has tag sub-folder then it will show the list of tags otherwise it will show the subfolders of that folder and then again user will select sub-folder and if tags found then show the tag list otherwise show all subfolders till he finds the tag subfolder. Code should be append at the highlighted area
1.Rohit(user select any repo if select 1 then it will check if there is tags folder then it will run svn ls <url>/svn/tags or other wise show all modules(svn ls <url>/svn/module-name) inside this in listing(1,2,3,)
2.Singh
3.ajay
And I want this in loop
[shell script]value[/shell script]
unset Reponame
repolist()
{
RepoList=/mnt/scm/subversion/
cd ${RepoList}
List=`ls|cut -d " " -f6`
for i in ${List};do echo "${i}";done>/home/e030809/Repo.txt
count=0
cat /home/e030809/Repo.txt|while read line; do count=`echo $count + 1 | bc`; echo "$count)$line"; done|tee /home/e030809/Repo1.txt
}
sub_repolist()
{
echo -en "Enter the number corresponding to the repository to check list of labels or type q to quit(1,2...):"
read usrInput
if [[ "${usrInput}" == "Q" || "${usrInput}" == "q" ]]; then
return 0;
else
if [ -z $usrInput ];then
return 0;
fi
fi
cat /home/e030809/Repo1.txt|grep -w "$usrInput"|cut -d ")" -f2|head -1|tee /home/e030809/Repo2.txt
Reponame=`cat /home/e030809/Repo2.txt|sed 's/[ \t]*$//' #`
#echo $Reponame
}
sub_repolist1()
{
svn ls http://repo_host/svn/${Reponame}/|cut -d "/" -f1 >/home/e030809/Repo3.txt (This command show the list of subfolders)
find=`cat /home/e030809/Repo3.txt|grep -w "tags"|sed 's/[ \t]*$//' #`
if [[ "$find" == "tags" ]];then
svn ls http://repo_host/svn/${Reponame}/${find} (This command will show the list of tags because find variable has value tags)
else
echo -e "Repository "${Reponame}" has below modules.Please select appropriate number corresponding to module:"
count=0
cat /home/e030809/Repo3.txt|while read line; do count=`echo $count + 1 | bc`; echo "$count)$Reponame/$line"; done
fi
}
repolist:
sub_repolist
sub_repolist1