| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_commitRepoChanges { |
| |
| local -a FILES |
| local -a INFO |
| local -a FILESNUM |
| local COUNT=0 |
| local UPDATEOUT='' |
| local PREDICATE='' |
| local LOCALFILES='' |
| local CHNGDIRECTION='' |
| local CHNGTOTAL=0 |
| local LOCATIONS='' |
| |
| |
| |
| |
| |
| |
| |
| if [[ "$@" != '' ]];then |
| LOCATIONS="$@" |
| else |
| LOCATIONS="$ACTIONVAL" |
| fi |
| |
| |
| |
| |
| |
| |
| |
| LOCATIONS=$(echo -e "$LOCATIONS" | sed -r "s! +!\n!g" \ |
| | egrep '^/home/centos/artwork/(trunk|branches|tags)/.+$') |
| |
| echo '----------------------------------------------------------------------' |
| |
| cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" 'AsResponseLine' |
| UPDATEOUT=$(svn update ${LOCATIONS}) |
| |
| |
| cli_printMessage "`gettext "Checking changes in the working copy"`" 'AsResponseLine' |
| STATUSOUT=$(svn status ${LOCATIONS}) |
| echo '----------------------------------------------------------------------' |
| |
| |
| |
| FILES[0]=$(echo "$UPDATEOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[1]=$(echo "$UPDATEOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[2]=$(echo "$UPDATEOUT" | egrep "^U.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[3]=$(echo "$UPDATEOUT" | egrep "^C.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[4]=$(echo "$UPDATEOUT" | egrep "^G.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| |
| |
| |
| FILES[5]=$(echo "$STATUSOUT" | egrep "^M.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[6]=$(echo "$STATUSOUT" | egrep "^\?.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[7]=$(echo "$STATUSOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[8]=$(echo "$STATUSOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| |
| |
| |
| INFO[0]="`gettext "Added"`" |
| INFO[1]="`gettext "Deleted"`" |
| INFO[2]="`gettext "Updated"`" |
| INFO[3]="`gettext "Conflicted"`" |
| INFO[4]="`gettext "Merged"`" |
| |
| |
| |
| INFO[5]="`gettext "Modified"`" |
| INFO[6]="`gettext "Unversioned"`" |
| INFO[7]=${INFO[1]} |
| INFO[8]=${INFO[0]} |
| |
| while [[ $COUNT -ne ${#FILES[*]} ]];do |
| |
| |
| if [[ "${FILES[$COUNT]}" == '' ]];then |
| FILESNUM[$COUNT]=0 |
| else |
| FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) |
| fi |
| |
| |
| CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) |
| |
| |
| |
| |
| |
| |
| |
| if [[ ${FILESNUM[$COUNT]} -lt 1 ]];then |
| PREDICATE[$COUNT]=`gettext "file"` |
| else |
| PREDICATE[$COUNT]=`ngettext "file" "files" ${FILESNUM[$COUNT]}` |
| fi |
| |
| |
| if [[ $COUNT -le 4 ]]; then |
| |
| |
| CHNGDIRECTION="`gettext "from the repository."`" |
| elif [[ $COUNT -gt 4 ]];then |
| |
| |
| CHNGDIRECTION="`gettext "from the working copy."`" |
| fi |
| |
| |
| PREDICATE[$COUNT]="${PREDICATE[$COUNT]} ${CHNGDIRECTION}" |
| |
| |
| cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" 'AsRegularLine' |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| echo '----------------------------------------------------------------------' |
| |
| |
| |
| |
| if [[ $CHNGTOTAL -eq 0 ]];then |
| return 0 |
| fi |
| |
| |
| |
| |
| if [[ ${FILESNUM[6]} -gt 0 ]];then |
| cli_printMessage "`ngettext "The following file is unversioned" \ |
| "The following files are unversioned" ${FILESNUM[6]}`:" |
| for FILE in ${FILES[6]};do |
| cli_printMessage $FILE 'AsResponseLine' |
| done |
| cli_printMessage "`ngettext "Do you want to add it now?" \ |
| "Do you want to add them now?" ${FILESNUM[6]}`" 'AsYesOrNoRequestLine' |
| svn add ${FILES[6]} --quiet |
| fi |
| |
| |
| COUNT=0 |
| |
| |
| |
| while [[ $COUNT -ne ${#FILES[*]} ]];do |
| LOCALFILES="$LOCALFILES ${FILES[$COUNT]}" |
| COUNT=$(($COUNT + 1 )) |
| done |
| |
| |
| |
| |
| if [[ $LOCALFILES != '' ]];then |
| |
| |
| cli_printMessage "`gettext "Do you want to see changes now?"`" "AsYesOrNoRequestLine" |
| svn diff $LOCALFILES | less |
| |
| |
| cli_printMessage "`gettext "Do you want to commit changes now?"`" "AsYesOrNoRequestLine" |
| svn commit $LOCALFILES |
| |
| fi |
| |
| } |