diff --git a/Scripts/Bash/Functions/Commons/cli_checkFiles.sh b/Scripts/Bash/Functions/Commons/cli_checkFiles.sh index 17d90d4..6af8536 100755 --- a/Scripts/Bash/Functions/Commons/cli_checkFiles.sh +++ b/Scripts/Bash/Functions/Commons/cli_checkFiles.sh @@ -116,7 +116,7 @@ function cli_checkFiles { -n|--versioned ) for FILE in $(echo $FILES);do - if [[ $(cli_isVersioned $FILE) == 'false' ]];then + if [[ $(svn_isVersioned $FILE) == 'false' ]];then cli_printMessage "`eval_gettext "The path \\\"\\\$FILE\\\" is not versioned."`" --as-error-line fi done diff --git a/Scripts/Bash/Functions/Commons/cli_syncroRepoChanges.sh b/Scripts/Bash/Functions/Commons/cli_syncroRepoChanges.sh deleted file mode 100755 index 6958137..0000000 --- a/Scripts/Bash/Functions/Commons/cli_syncroRepoChanges.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# cli_syncroRepoChanges.sh -- This function syncronizes both central -# repository and working copy performing a subversion update command -# first and a subversion commit command later. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_syncroRepoChanges { - - # Verify don't commit changes flag. - if [[ $FLAG_DONT_COMMIT_CHANGES != 'false' ]];then - return - fi - - # Define source location the subversion update action will take - # place on. If arguments are provided use them as srouce location. - # Otherwise use action value as default source location. - if [[ "$@" != '' ]];then - LOCATIONS="$@" - else - LOCATIONS="$ACTIONVAL" - fi - - # Bring changes from the repository into the working copy. - svn_updateRepoChanges "$LOCATIONS" - - # Check changes in the working copy. - svn_commitRepoChanges "$LOCATIONS" - -} diff --git a/Scripts/Bash/Functions/Help/Texinfo/texinfo_checkEntrySrcDst.sh b/Scripts/Bash/Functions/Help/Texinfo/texinfo_checkEntrySrcDst.sh index 91b3bfe..356b7b1 100755 --- a/Scripts/Bash/Functions/Help/Texinfo/texinfo_checkEntrySrcDst.sh +++ b/Scripts/Bash/Functions/Help/Texinfo/texinfo_checkEntrySrcDst.sh @@ -45,7 +45,7 @@ function texinfo_checkEntrySrcDst { # Verify source location to be sure it is under version control # and there isn't pending change to be committed first. - if [[ $(cli_isVersioned ${MANUAL_ENTRY_SRC}) == 'true' ]];then + if [[ $(svn_isVersioned ${MANUAL_ENTRY_SRC}) == 'true' ]];then if [[ $(cli_getRepoStatus ${MANUAL_ENTRY_SRC}) != '' ]];then cli_printMessage "`gettext "The source location has pending changes."`" --as-error-line fi diff --git a/Scripts/Bash/Functions/Help/help.sh b/Scripts/Bash/Functions/Help/help.sh index c77ec9e..b9de72f 100755 --- a/Scripts/Bash/Functions/Help/help.sh +++ b/Scripts/Bash/Functions/Help/help.sh @@ -191,7 +191,7 @@ function help { # the working copy and changes in the working copy # committed up to repository. if [[ -d ${MANUAL_CHANGED_DIRS} ]];then - cli_syncroRepoChanges ${MANUAL_CHANGED_DIRS} + svn_syncroRepoChanges ${MANUAL_CHANGED_DIRS} fi # Initialize documentation format functionalities. At @@ -234,6 +234,6 @@ function help { # Syncronize changes between repository and working copy. At this # point, changes in the repository are merged in the working copy # and changes in the working copy committed up to repository. - cli_syncroRepoChanges ${MANUAL_CHANGED_DIRS} + svn_syncroRepoChanges ${MANUAL_CHANGED_DIRS} } diff --git a/Scripts/Bash/Functions/Locale/locale.sh b/Scripts/Bash/Functions/Locale/locale.sh index 9e14889..b5a25ff 100755 --- a/Scripts/Bash/Functions/Locale/locale.sh +++ b/Scripts/Bash/Functions/Locale/locale.sh @@ -67,7 +67,7 @@ function locale { # Syncronize changes between repository and working copy. At this # point, changes in the repository are merged in the working copy # and changes in the working copy committed up to repository. - cli_syncroRepoChanges "${L10N_BASEDIR}" + svn_syncroRepoChanges "${L10N_BASEDIR}" # Loop through non-option arguments passed to centos-art.sh script # through its command-line. @@ -104,6 +104,6 @@ function locale { # Syncronize changes between repository and working copy. At this # point, changes in the repository are merged in the working copy # and changes in the working copy committed up to repository. - cli_syncroRepoChanges "${L10N_BASEDIR}" + svn_syncroRepoChanges "${L10N_BASEDIR}" } diff --git a/Scripts/Bash/Functions/Locale/locale_prepareWorkingDirectory.sh b/Scripts/Bash/Functions/Locale/locale_prepareWorkingDirectory.sh index 7d83e5a..46181e0 100755 --- a/Scripts/Bash/Functions/Locale/locale_prepareWorkingDirectory.sh +++ b/Scripts/Bash/Functions/Locale/locale_prepareWorkingDirectory.sh @@ -39,6 +39,7 @@ function locale_prepareWorkingDirectory { # At this point, changes in the repository are not merged in # the working copy, but chages in the working copy do are # committed up to repository. + cli_exportFunctions "Svn/svn_commitRepoChanges" svn_commitRepoChanges "${L10N_BASEDIR}" elif [[ $L10N_WORKDIR == '' ]];then diff --git a/Scripts/Bash/Functions/Render/render.sh b/Scripts/Bash/Functions/Render/render.sh index 06b7919..8252085 100755 --- a/Scripts/Bash/Functions/Render/render.sh +++ b/Scripts/Bash/Functions/Render/render.sh @@ -109,7 +109,7 @@ function render { # this point, changes in the repository are merged in the # working copy and changes in the working copy committed up to # repository. - cli_syncroRepoChanges + svn_syncroRepoChanges # Define renderable directories and the way they are produced. # To describe the way renderable directories are produced, we @@ -132,7 +132,7 @@ function render { # this point, changes in the repository are merged in the # working copy and changes in the working copy committed up to # repository. - cli_syncroRepoChanges + svn_syncroRepoChanges done diff --git a/Scripts/Bash/Functions/Svn/svn.sh b/Scripts/Bash/Functions/Svn/svn.sh index 685625d..9df8313 100644 --- a/Scripts/Bash/Functions/Svn/svn.sh +++ b/Scripts/Bash/Functions/Svn/svn.sh @@ -25,6 +25,35 @@ function svn { - return + local ACTIONNAM='' + local ACTIONNAMS='' + local ACTIONVAL='' + + # Define absolute path to Subversion command. + SVN=/usr/bin/svn + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + # Interpret arguments and options passed through command-line. + svn_getOptions + + # Define action value. We use non-option arguments to define the + # action value (ACTIONVAL) variable. + for ACTIONVAL in "$@";do + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + ACTIONVAL=$(cli_checkRepoDirSource $ACTIONVAL) + + # Execute action names. + for ACTIONNAM in $ACTIONNAMS;do + $ACTIONNAM + done + + done } diff --git a/Scripts/Bash/Functions/Svn/svn_commitRepoChanges.sh b/Scripts/Bash/Functions/Svn/svn_commitRepoChanges.sh index 424c6dc..7cbc93a 100755 --- a/Scripts/Bash/Functions/Svn/svn_commitRepoChanges.sh +++ b/Scripts/Bash/Functions/Svn/svn_commitRepoChanges.sh @@ -62,7 +62,7 @@ function svn_commitRepoChanges { for LOCATION in $LOCATIONS;do # Don't process location outside of version control. - if [[ $(cli_isVersioned $LOCATION) == 'false' ]];then + if [[ $(svn_isVersioned $LOCATION) == 'false' ]];then continue fi diff --git a/Scripts/Bash/Functions/Svn/svn_getOptions.sh b/Scripts/Bash/Functions/Svn/svn_getOptions.sh new file mode 100644 index 0000000..c855d22 --- /dev/null +++ b/Scripts/Bash/Functions/Svn/svn_getOptions.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# svn_getOptions.sh -- This function interprets option parameters +# passed to `svn' functionality and calls actions accordingly. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svn_getOptions { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="sync,dont-commit-changes,update,commit" + + # Redefine ARGUMENTS variable using getopt output. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + --sync ) + ACTIONNAMS="${ACTIONNAMS} svn_syncRepoChanges" + shift 1 + ;; + + --commit ) + ACTIONNAMS="${ACTIONNAMS} svn_commitRepoChanges" + shift 1 + ;; + + --update ) + ACTIONNAMS="${ACTIONNAMS} svn_updateRepoChanges" + shift 1 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # begining of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + +} diff --git a/Scripts/Bash/Functions/Svn/svn_isVersioned.sh b/Scripts/Bash/Functions/Svn/svn_isVersioned.sh index 897fa1a..8da169d 100755 --- a/Scripts/Bash/Functions/Svn/svn_isVersioned.sh +++ b/Scripts/Bash/Functions/Svn/svn_isVersioned.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# cli_isVersioned.sh -- This function determines whether a location is +# svn_isVersioned.sh -- This function determines whether a location is # under version control or not. When the location is under version # control, this function returns `true'. when the location isn't under # version control, this function returns `false'. @@ -25,7 +25,7 @@ # $Id$ # ---------------------------------------------------------------------- -function cli_isVersioned { +function svn_isVersioned { # Initialize absolute path using first positional parameter as # reference. diff --git a/Scripts/Bash/Functions/Svn/svn_syncroRepoChanges.sh b/Scripts/Bash/Functions/Svn/svn_syncroRepoChanges.sh new file mode 100755 index 0000000..640f429 --- /dev/null +++ b/Scripts/Bash/Functions/Svn/svn_syncroRepoChanges.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# svn_syncroRepoChanges.sh -- This function syncronizes both central +# repository and working copy performing a subversion update command +# first and a subversion commit command later. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function svn_syncroRepoChanges { + + # Verify don't commit changes flag. + if [[ $FLAG_DONT_COMMIT_CHANGES != 'false' ]];then + return + fi + + # Define source location the subversion update action will take + # place on. If arguments are provided use them as srouce location. + # Otherwise use action value as default source location. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + # Bring changes from the repository into the working copy. + cli_exportFunctions "Svn/svn_updateRepoChanges" + svn_updateRepoChanges "$LOCATIONS" + + # Check changes in the working copy. + cli_exportFunctions "Svn/svn_commitRepoChanges" + svn_commitRepoChanges "$LOCATIONS" + +} diff --git a/Scripts/Bash/Functions/Tuneup/tuneup.sh b/Scripts/Bash/Functions/Tuneup/tuneup.sh index 11ac661..549aada 100755 --- a/Scripts/Bash/Functions/Tuneup/tuneup.sh +++ b/Scripts/Bash/Functions/Tuneup/tuneup.sh @@ -69,7 +69,7 @@ function tuneup { # this point, changes in the repository are merged in the # working copy and changes in the working copy committed up to # repository. - cli_syncroRepoChanges + svn_syncroRepoChanges # Execute action name. $ACTIONNAM @@ -78,7 +78,7 @@ function tuneup { # this point, changes in the repository are merged in the # working copy and changes in the working copy committed up to # repository. - cli_syncroRepoChanges + svn_syncroRepoChanges done