| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_commitRepoChanges { |
| |
| |
| if [[ $FLAG_DONT_COMMIT_CHANGES == 'true' ]];then |
| return |
| fi |
| |
| local -a FILES |
| local -a INFO |
| local -a FILESNUM |
| local COUNT=0 |
| local STATUSOUT='' |
| local PREDICATE='' |
| local CHNGTOTAL=0 |
| local LOCATIONS='' |
| local LOCATION='' |
| |
| |
| |
| |
| if [[ "$@" != '' ]];then |
| LOCATIONS="$@" |
| else |
| LOCATIONS="$ACTIONVAL" |
| fi |
| |
| |
| cli_printMessage "`gettext "Checking changes in the working copy"`" --as-banner-line |
| STATUSOUT=$(svn status ${LOCATIONS}) |
| |
| |
| |
| FILES[0]=$(echo "$STATUSOUT" | egrep "^M.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[1]=$(echo "$STATUSOUT" | egrep "^\?.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[2]=$(echo "$STATUSOUT" | egrep "^D.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| FILES[3]=$(echo "$STATUSOUT" | egrep "^A.+$(cli_getRepoTLDir "${LOCATIONS}").+$" | sed -r "s,^.+($(cli_getRepoTLDir "${LOCATIONS}").+)$,\1,") |
| |
| |
| |
| INFO[0]="`gettext "Modified"`" |
| INFO[1]="`gettext "Unversioned"`" |
| INFO[2]="`gettext "Deleted"`" |
| INFO[3]="`gettext "Added"`" |
| |
| 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]})) |
| |
| |
| |
| |
| |
| |
| |
| PREDICATE[$COUNT]=`ngettext "file in the working copy" \ |
| "files in the repository" $((${FILESNUM[$COUNT]} + 1))` |
| |
| |
| cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| |
| |
| |
| if [[ ${FILESNUM[1]} -gt 0 ]];then |
| |
| |
| cli_printMessage '-' --as-separator-line |
| |
| cli_printMessage "`ngettext "The following file is unversioned" \ |
| "The following files are unversioned" ${FILESNUM[1]}`:" |
| for FILE in ${FILES[1]};do |
| cli_printMessage "$FILE" --as-response-line |
| done |
| cli_printMessage "`ngettext "Do you want to add it now?" \ |
| "Do you want to add them now?" ${FILESNUM[2]}`" --as-yesornorequest-line |
| svn add ${FILES[1]} --quiet |
| fi |
| |
| |
| |
| if [[ $CHNGTOTAL -gt 0 ]];then |
| |
| |
| cli_printMessage '-' --as-separator-line |
| |
| |
| cli_printMessage "`gettext "Do you want to see changes now?"`" --as-yesornorequest-line |
| svn diff $LOCATIONS | less |
| |
| |
| cli_printMessage "`gettext "Do you want to commit changes now?"`" --as-yesornorequest-line |
| svn commit $LOCATIONS |
| |
| fi |
| |
| } |