+ run_loop n "CHECK CHANGES in $import/$module/trunk -- conflicts should get resolved" \
+ svn status trunk
+
+ run_prompt n "CHECKING IN changes in trunk" \
+ svn ci -m "Merged changes from import-$previous to import-$next"
+
+ prompt=$(svn_url_needs_creation $svn/$module/imports/after-$next)
+ run_prompt $prompt "Backing up into after-$next" \
+ svn copy $svn/$module/$trunk $svn/$module/imports/after-$next
+
+ run_prompt n "Want to rename $import as $import-to-trash" \
+ mv $import $import-totrash
+
+ echo 'Done'
+}
+
+##############################
+function tag_usage () {
+ echo "Usage: $0 module"
+ exit 1
+}
+
+function tag_module () {
+
+ [[ -z "$@" ]] && tag_usage
+ module=$1; shift
+ tagwork=$HOME/tags/$module
+ tagtrunk=$HOME/tags/$module/trunk
+ [[ -n "$@" ]] && tag_usage
+
+ echo 'Tagging' $module
+
+ run_prompt $(dir_needs_creation $tagtrunk) "Checking out $tagtrunk" \
+ svn co $svn/$module/trunk $tagtrunk
+
+ run_prompt y "Updating $tagtrunk" \
+ svn up $tagtrunk
+
+ run_prompt $(svn_dir_needs_revert $tagtrunk) "Reverting $tagtrunk for safety " \
+ svn revert -R $tagtrunk
+
+ run "cd $tagtrunk" \
+ cd $tagtrunk
+
+ ### extracting current version info
+ spec=$(figure_module_spec $tagtrunk $module)
+ version=$(extract_from_spec $spec version)
+ subversion=$(extract_from_spec $spec subversion)
+ newsubversion=$(($subversion+1))
+
+ message "FOUND spec=$spec version=$version subversion=$subversion"
+
+ # check that the tags relating to subversion and newsubversion does (resp. does not) exist
+ oldtag=$svn/$module/tags/$module-${version}.${subversion}
+ newtag=$svn/$module/tags/$module-${version}.${newsubversion}
+
+ echo -n "Checking tags status ..."
+ old_check=$(svn_url_check $oldtag)
+ if [ -z "$old_check" ] ; then
+ echo "Former tag does not exist -- exiting"
+ echo "URL was $oldtag"
+ exit 1
+ fi
+ echo -n " old tag OK ... "
+
+ new_check=$(svn_url_check $newtag)
+ if [ -n "$new_check" ] ; then
+ echo "New tag does exist -- exiting"
+ echo "URL was $newtag"
+ exit 1
+ fi
+ echo " new tag OK"
+
+ patch_in_spec $spec subversion $newsubversion
+
+ run_loop y "Checking differences" \
+ svn diff $tagtrunk
+
+ run_prompt n "Display differences from previous tag" \
+ svn diff $oldtag $svn/$module/trunk
+
+ run_prompt y "Committing changes in $tagtrunk" \
+ svn ci --editor-cmd=vi $tagtrunk
+
+ # putting spaces in the message does not work
+ run_prompt y "Creating tag $newtag" \
+ svn copy --message "$module-${version}.${newsubversion}" $svn/$module/trunk $newtag
+
+ # make changes in build/*-tags.mk
+ tagbuild=$HOME/tags/build/trunk
+ oldname=$module-${version}.${subversion}
+ newname=$module-${version}.${newsubversion}
+
+ run_prompt $(dir_needs_creation $tagbuild) "Checking out $tagbuild" \
+ svn co $svn/$module/build $tagbuild
+
+ run_prompt y "Updating $tagbuild" \
+ svn up $tagbuild
+
+ run_prompt $(svn_dir_needs_revert $tagbuild) "Reverting $tagbuild for safety " \
+ svn revert -R $tagbuild
+
+ run "cd $tagbuild" \
+ cd $tagbuild
+
+ # committing tags files
+ files_to_commit=""
+ for tagsmk in *-tags.mk; do
+ echo "=== Managing $tagsmk"
+ sed -i -e "s,$oldname,$newname,g" $tagsmk
+ if [ $(svn_file_needs_commit $tagsmk) = "y" ] ; then
+ echo "Changes in $tagsmk"
+ svn diff $tagsmk
+ my_prompt y "Adopt $newname in $tagsmk"
+ if [ "$?" == 1 ] ; then
+ files_to_commit="$files_to_commit $tagsmk"
+ fi
+ fi
+ done
+ if [ -n "$files_to_commit" ] ; then
+ command="svn commit -mAdopting-$newname $files_to_commit"
+ run "Committing selected tags files" $command
+ fi
+}
+
+####################
+function diff_modules () {
+ for module in "$@" ; do
+ tagtrunk=$HOME/tags/$module/trunk
+ echo "--------------------Checking $module"
+ run_prompt y "Updating $tagwork" svn update $tagtrunk
+ ### extracting current version info
+ spec=$(figure_module_spec $tagtrunk $module)
+ version=$(extract_from_spec $spec version)
+ subversion=$(extract_from_spec $spec subversion)
+
+ echo "FOUND spec=$spec version=$version subversion=$subversion"
+
+ lasttag=$svn/$module/tags/$module-${version}.${subversion}
+ trunk=$svn/$module/trunk
+
+ run_prompt y "Diffing : < last tag -- trunk >" svn diff $lasttag $trunk
+
+ done
+}