From 6e16a80cf02c54f732ee7aa254111a6a7bb5ad49 Mon Sep 17 00:00:00 2001 From: Rodolfo Ribeiro Gomes Date: Mon, 19 Oct 2020 12:16:13 -0300 Subject: [PATCH 1/2] remove old SVN-related stuff --- ETL/Makefile.am | 3 -- ETL/configure.ac | 3 -- synfig-core/Makefile.am | 3 -- synfig-core/build_tools/autorevision.sh | 38 ++--------------------- synfig-core/config/package | 6 ++-- synfig-studio/Makefile.am | 7 ++--- synfig-studio/build_tools/autorevision.sh | 37 ++-------------------- synfig-studio/config/package | 6 ++-- synfig-studio/src/gui/dialogs/about.cpp | 2 +- 9 files changed, 13 insertions(+), 92 deletions(-) diff --git a/ETL/Makefile.am b/ETL/Makefile.am index 863803fa528..2d2570cf45a 100644 --- a/ETL/Makefile.am +++ b/ETL/Makefile.am @@ -52,9 +52,6 @@ EXTRA_DIST = \ ETL.pc.in -SVN=svn -TAG=@PACKAGE_TARNAME@_@VERSION_MAJ@_@VERSION_MIN@_@VERSION_REV@ - GREP=grep PRINTF=printf diff --git a/ETL/configure.ac b/ETL/configure.ac index 144e9537b77..2c40e19b21f 100644 --- a/ETL/configure.ac +++ b/ETL/configure.ac @@ -17,9 +17,6 @@ AM_MAINTAINER_MODE debug="no" -SVN_REPOSITORY=https://synfig.svn.sourceforge.net/svnroot/synfig/ETL -AC_SUBST(SVN_REPOSITORY) - # -- A R G U M E N T S ---------------------------------------- diff --git a/synfig-core/Makefile.am b/synfig-core/Makefile.am index eefe716a541..37cd51e223b 100644 --- a/synfig-core/Makefile.am +++ b/synfig-core/Makefile.am @@ -87,9 +87,6 @@ PRINTF=printf SH=sh DOXYGEN=doxygen -SVN=svn -TAG=@PACKAGE_TARNAME@_@VERSION_MAJ@_@VERSION_MIN@_@VERSION_REV@ - stats: -@echo -@echo -- Stats diff --git a/synfig-core/build_tools/autorevision.sh b/synfig-core/build_tools/autorevision.sh index e47de2b4764..272a4f99037 100644 --- a/synfig-core/build_tools/autorevision.sh +++ b/synfig-core/build_tools/autorevision.sh @@ -30,24 +30,6 @@ get_git_id(){ #REVISION="$REVISION"`cd "$1"; [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"` } -get_git_svn_id(){ - export SCM=git-svn - export REVISION=`cd "$1"; git svn find-rev HEAD` - export COMPARE="$1/.git/" - if [ x = "x$REVISION" ] ; then - # The extra M at the end is for Modified - export REVISION=`cd "$1"; git svn find-rev \`git rev-list --max-count=1 --grep='git-svn-id: ' HEAD\``M - else - export REVISION="$REVISION"`cd "$1"; git diff --quiet HEAD || echo M` - fi -} - -get_svn_id(){ - export SCM=svn - export REVISION=`cd "$1"; svnversion || svn info | sed -n 's/^Revision: \(.*\)/\1/p'` -} - - HEADER="$2/autorevision.h" SCM=none @@ -57,21 +39,9 @@ if [ ! -f "$HEADER" ] ; then fi -# Extract the revision from SVN/git/etc +# Extract the revision from git if git rev-parse --git-dir > /dev/null 2>&1 ; then get_git_id "." -elif [ -d "$1/.git/svn" ] ; then - get_git_svn_id "$1" -elif [ -d "$1/../.git/svn" ] ; then - get_git_svn_id "$1/.." -elif [ -d "$1/../../.git/svn" ] ; then - get_git_svn_id "$1/../.." -elif [ -d "$1/.svn" ] ; then - COMPARE="$1/.svn" - get_svn_id "$1" -elif [ -d "$1/_svn" ] ; then - COMPARE="$1/_svn" - get_svn_id "$1" fi @@ -88,11 +58,7 @@ if [ "$COMPARE" -ot "$HEADER" ] ; then exit; fi # Set the development version string if [ x = "x$DEVEL_VERSION" ] ; then if [ x != "x$REVISION" ] ; then - if [ $SCM = svn ] ; then - DEVEL_VERSION="SVN r$REVISION" - elif [ $SCM = git-svn ] ; then - DEVEL_VERSION="SVN r$REVISION (via git)" - elif [ $SCM = git ] ; then + if [ $SCM = git ] ; then DEVEL_VERSION="Revision: ${REVISION}\\\\nBranch: ${BRANCH}\\\\nRevision ID: ${REVISION_ID}" elif [ $SCM = manual ] ; then DEVEL_VERSION="$REVISION (manually configured)" diff --git a/synfig-core/config/package b/synfig-core/config/package index fa142a27160..be33a643f34 100755 --- a/synfig-core/config/package +++ b/synfig-core/config/package @@ -217,12 +217,12 @@ if ( $?resDir ) then pushd $resDir > /dev/null # get lists of resources. We'll want to change # permissions on just these things later. - set directoriesInResDir = `find . -type d | grep -v -e .svn -e CVS` - set filesInResDir = `find . -type f` + set directoriesInResDir = `find . -type d | grep -v -e .git` + set filesInResDir = `find . -type f | grep -v -e .git` popd > /dev/null # copy the resource directory contents into the package directory - foreach resFile (`cd $resDir && find . | grep -v -e .svn -e CVS`) + foreach resFile (`cd $resDir && find . | grep -v -e .git`) cp -r "$resDir/$resFile" "$pkg/Contents/Resources" end diff --git a/synfig-studio/Makefile.am b/synfig-studio/Makefile.am index 5a02c39e1f2..378fce0c2db 100644 --- a/synfig-studio/Makefile.am +++ b/synfig-studio/Makefile.am @@ -89,9 +89,6 @@ PRINTF=printf SH=sh DOXYGEN=doxygen -SVN=svn -TAG=@PACKAGE_TARNAME@_@VERSION_MAJ@_@VERSION_MIN@_@VERSION_REV@ - ChangeLog: ../autobuild/git2cl > ChangeLog @@ -109,14 +106,14 @@ listfixmes: -@echo -@echo -- List of pending FIXMEs -@echo - -@$(GREP) FIXME -n `shell find $(top_srcdir) -name '*.[ch]*' | grep -v svn` + -@$(GREP) FIXME -n `shell find $(top_srcdir) -name '*.[ch]*' | grep -v .git` -@echo listhacks: -@echo -@echo -- List of pending HACKs -@echo - -@$(GREP) HACK -n `shell find $(top_srcdir) -name '*.[ch]*' | grep -v svn` + -@$(GREP) HACK -n `shell find $(top_srcdir) -name '*.[ch]*' | grep -v .git` -@echo run: check diff --git a/synfig-studio/build_tools/autorevision.sh b/synfig-studio/build_tools/autorevision.sh index 723db3b0419..3cc10bcfe2e 100644 --- a/synfig-studio/build_tools/autorevision.sh +++ b/synfig-studio/build_tools/autorevision.sh @@ -30,23 +30,6 @@ get_git_id(){ #REVISION="$REVISION"`cd "$1"; [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"` } -get_git_svn_id(){ - export SCM=git-svn - export REVISION=`cd "$1"; git svn find-rev HEAD` - export COMPARE="$1/.git/" - if [ x = "x$REVISION" ] ; then - # The extra M at the end is for Modified - export REVISION=`cd "$1"; git svn find-rev \`git rev-list --max-count=1 --grep='git-svn-id: ' HEAD\``M - else - export REVISION="$REVISION"`cd "$1"; git diff --quiet HEAD || echo M` - fi -} - -get_svn_id(){ - export SCM=svn - export REVISION=`cd "$1"; svnversion || svn info | sed -n 's/^Revision: \(.*\)/\1/p'` -} - HEADER="$2/autorevision.h" SCM=none @@ -57,21 +40,9 @@ if [ ! -f "$HEADER" ] ; then fi -# Extract the revision from SVN/git/etc +# Extract the revision from git if git rev-parse --git-dir > /dev/null 2>&1 ; then get_git_id "." -elif [ -d "$1/.git/svn" ] ; then - get_git_svn_id "$1" -elif [ -d "$1/../.git/svn" ] ; then - get_git_svn_id "$1/.." -elif [ -d "$1/../../.git/svn" ] ; then - get_git_svn_id "$1/../.." -elif [ -d "$1/.svn" ] ; then - COMPARE="$1/.svn" - get_svn_id "$1" -elif [ -d "$1/_svn" ] ; then - COMPARE="$1/_svn" - get_svn_id "$1" fi @@ -88,11 +59,7 @@ if [ "$COMPARE" -ot "$HEADER" ] ; then exit; fi # Set the development version string if [ x = "x$DEVEL_VERSION" ] ; then if [ x != "x$REVISION" ] ; then - if [ $SCM = svn ] ; then - DEVEL_VERSION="SVN r$REVISION" - elif [ $SCM = git-svn ] ; then - DEVEL_VERSION="SVN r$REVISION (via git)" - elif [ $SCM = git ] ; then + if [ $SCM = git ] ; then DEVEL_VERSION="Revision: ${REVISION}\\\\nBranch: ${BRANCH}\\\\nRevision ID: ${REVISION_ID}" elif [ $SCM = manual ] ; then DEVEL_VERSION="$REVISION (manually configured)" diff --git a/synfig-studio/config/package b/synfig-studio/config/package index a3262279e23..75a9be0fac1 100755 --- a/synfig-studio/config/package +++ b/synfig-studio/config/package @@ -217,12 +217,12 @@ if ( $?resDir ) then pushd $resDir > /dev/null # get lists of resources. We'll want to change # permissions on just these things later. - set directoriesInResDir = `find . -type d | grep -v -e svn -e CVS` - set filesInResDir = `find . -type f | grep -v -e svn -e CVS` + set directoriesInResDir = `find . -type d | grep -v -e .git` + set filesInResDir = `find . -type f | grep -v -e .git` popd > /dev/null # copy the resource directory contents into the package directory - foreach resFile (`cd $resDir && find . | grep -v svn`) + foreach resFile (`cd $resDir && find . | grep -v -e .git`) cp -fr "$resDir/$resFile" "$pkg/Contents/Resources" end diff --git a/synfig-studio/src/gui/dialogs/about.cpp b/synfig-studio/src/gui/dialogs/about.cpp index b6549bef779..a4affc2fd56 100644 --- a/synfig-studio/src/gui/dialogs/about.cpp +++ b/synfig-studio/src/gui/dialogs/about.cpp @@ -40,7 +40,7 @@ #include #include -// This is generated at make time from .svn or .git/svn or autorevision.conf +// This is generated at make time from .git or autorevision.conf #include #include "about.h" From 26fde94c8de9c0565a0c866902308823a1401112 Mon Sep 17 00:00:00 2001 From: Rodolfo Ribeiro Gomes Date: Mon, 19 Oct 2020 12:36:30 -0300 Subject: [PATCH 2/2] remove old hidden feature of CVS support for synfig document hidden in 2015-08-17 by 00a2c3d868 --- synfig-studio/po/POTFILES.in | 2 - synfig-studio/src/gui/app.cpp | 18 - synfig-studio/src/gui/canvasview.cpp | 23 -- synfig-studio/src/gui/iconcontroller.cpp | 5 - synfig-studio/src/gui/instance.cpp | 239 ------------- synfig-studio/src/gui/instance.h | 8 - synfig-studio/src/synfigapp/CMakeLists.txt | 1 - synfig-studio/src/synfigapp/Makefile.am | 2 - synfig-studio/src/synfigapp/cvs.cpp | 386 --------------------- synfig-studio/src/synfigapp/cvs.h | 104 ------ synfig-studio/src/synfigapp/instance.cpp | 3 - synfig-studio/src/synfigapp/instance.h | 3 +- 12 files changed, 1 insertion(+), 793 deletions(-) delete mode 100644 synfig-studio/src/synfigapp/cvs.cpp delete mode 100644 synfig-studio/src/synfigapp/cvs.h diff --git a/synfig-studio/po/POTFILES.in b/synfig-studio/po/POTFILES.in index 031c6467b36..9058081a225 100644 --- a/synfig-studio/po/POTFILES.in +++ b/synfig-studio/po/POTFILES.in @@ -503,8 +503,6 @@ src/synfigapp/blineconvert.cpp src/synfigapp/blineconvert.h src/synfigapp/canvasinterface.cpp src/synfigapp/canvasinterface.h -src/synfigapp/cvs.cpp -src/synfigapp/cvs.h src/synfigapp/editmode.h src/synfigapp/inputdevice.cpp src/synfigapp/inputdevice.h diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index 95644522373..bbc6290334d 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -3926,15 +3926,6 @@ App::open(std::string filename, /* std::string as, */ synfig::FileContainerZip:: throw (String)strprintf(_("Unable to create instance for \"%s\""),filename.c_str()); one_moment.hide(); - - if(instance->is_updated() && App::dialog_message_2b( - _("Newer version of this file available on the CVS repository!"), - _("repository. Would you like to update now? (It would probably be a good idea)"), - Gtk::MESSAGE_QUESTION, - _("Cancel"), - _("Update Anyway")) - ) - instance->dialog_cvs_update(); } } catch(String &x) @@ -4037,15 +4028,6 @@ App::open_from_temporary_filesystem(std::string temporary_filename) one_moment.hide(); - if(instance->is_updated() && App::dialog_message_2b( - _("Newer version of this file available on the CVS repository!"), - _("Would you like to update now? (It would probably be a good idea)"), - Gtk::MESSAGE_QUESTION, - _("Cancel"), - _("Update Anyway")) - ) - instance->dialog_cvs_update(); - // This file isn't saved! mark it as such instance->inc_action_count(); } diff --git a/synfig-studio/src/gui/canvasview.cpp b/synfig-studio/src/gui/canvasview.cpp index 14cde2e465e..84904b2286a 100644 --- a/synfig-studio/src/gui/canvasview.cpp +++ b/synfig-studio/src/gui/canvasview.cpp @@ -1472,20 +1472,6 @@ CanvasView::init_menus() action_group->add( Gtk::Action::create("revert", Gtk::Stock::REVERT_TO_SAVED), sigc::hide_return(sigc::mem_fun(*get_instance().get(), &Instance::safe_revert)) ); - /* - action_group->add( Gtk::Action::create("cvs-add", Gtk::StockID("synfig-cvs_add")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &Instance::dialog_cvs_add)) - ); - action_group->add( Gtk::Action::create("cvs-update", Gtk::StockID("synfig-cvs_update")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &Instance::dialog_cvs_update)) - ); - action_group->add( Gtk::Action::create("cvs-revert", Gtk::StockID("synfig-cvs_revert")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &Instance::dialog_cvs_revert)) - ); - action_group->add( Gtk::Action::create("cvs-commit", Gtk::StockID("synfig-cvs_commit")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &Instance::dialog_cvs_commit)) - ); - */ action_group->add( Gtk::Action::create("import", _("Import...")), sigc::hide_return(sigc::mem_fun(*this, &CanvasView::image_import)) ); @@ -1952,15 +1938,6 @@ CanvasView::update_title() : filename + " (" + canvas_title + ")"; if (modified) title = "*" + title; - if (get_instance()->Instance::in_repository()) { - title += " (CVS"; - if (get_instance()->Instance::is_modified()) - title += _("-MODIFIED"); - if (get_instance()->Instance::is_updated()) - title += _("-UPDATED"); - title += ')'; - } - set_local_name(title); App::dock_manager->update_window_titles(); } diff --git a/synfig-studio/src/gui/iconcontroller.cpp b/synfig-studio/src/gui/iconcontroller.cpp index f26671b75e7..123e22266d1 100644 --- a/synfig-studio/src/gui/iconcontroller.cpp +++ b/synfig-studio/src/gui/iconcontroller.cpp @@ -352,11 +352,6 @@ IconController::init_icons(const synfig::String& path_to_icons) INIT_STOCK_ICON(utils_chain_link_off, "utils_chain_link_off_icon." IMAGE_EXT, _("Unlinked")); INIT_STOCK_ICON(utils_timetrack_align, "utils_timetrack_align_icon." IMAGE_EXT, _("Utils Timetrack align")); - INIT_STOCK_ICON_CLONE(cvs_add, _("CVS Add")); - INIT_STOCK_ICON_CLONE(cvs_update, _("CVS Update")); - INIT_STOCK_ICON_CLONE(cvs_commit, _("CVS Commit")); - INIT_STOCK_ICON_CLONE(cvs_revert, _("CVS Revert")); - #undef INIT_STOCK_ICON #undef INIT_STOCK_ICON_CLONE #undef INIT_STOCK_ITEM diff --git a/synfig-studio/src/gui/instance.cpp b/synfig-studio/src/gui/instance.cpp index e3bc74c1a41..abd5467eba6 100644 --- a/synfig-studio/src/gui/instance.cpp +++ b/synfig-studio/src/gui/instance.cpp @@ -720,222 +720,6 @@ Instance::refresh_canvas_tree() insert_canvas(row,get_canvas()); } -void -Instance::dialog_cvs_commit() -{ - calc_repository_info(); - if(!in_repository()) - { - App::dialog_message_1b( - "ERROR", - _("You must first add this composition to the repository"), - "details", - _("Close")); - - return; - } - try - { - string message; - - if(synfigapp::Instance::get_action_count()) - { - if (!App::dialog_message_2b( - _("CVS Commit"), - _("This will save any changes you have made. Are you sure?"), - Gtk::MESSAGE_QUESTION, - _("Cancel"), - _("Commit")) - ) - return; - - save(); - } - - if(!is_modified()) - { - App::dialog_message_1b( - "ERROR", - _("The local copy of the file hasn't been changed since the last update. Nothing to commit!"), - "details", - _("Close")); - - return; - } - - if(!App::dialog_entry(_("CVS Commit"), - _("Log Message: "), - message, - _("Cancel"), - _("Commit")) - ) - return; - - OneMoment one_moment; - cvs_commit(message); - } - catch(...) - { - App::dialog_message_1b( - "ERROR", - _("An error has occurred when trying to COMMIT"), - "details", - _("Close")); - } - update_all_titles(); -} - -void -Instance::dialog_cvs_add() -{ - calc_repository_info(); - if(in_repository()) - { - App::dialog_message_1b( - "ERROR", - _("This composition has already been added to the repository"), - "details", - _("Close")); - return; - } - try - { - string message; - - //if(!App::dialog_entry(_("CVS Add"),_("Enter a log message describing the file"), message)) - // return; - OneMoment one_moment; - cvs_add(); - } - catch(...) - { - App::dialog_message_1b( - "ERROR", - _("An error has occurred when trying to ADD"), - "details", - _("Close")); - } - update_all_titles(); -} - -void -Instance::dialog_cvs_update() -{ - calc_repository_info(); - if(!in_repository()) - { - App::dialog_message_1b( - "ERROR", - _("This file is not under version control, so there is nothing to update from!"), - "details", - _("Close")); - - return; - } - if(!is_updated()) - { - App::dialog_message_1b( - "INFO", - _("This file is up-to-date"), - "details", - _("Close")); - - return; - } - - try - { - String filename(get_file_name()); - if(synfigapp::Instance::get_action_count()) - { - if (!App::dialog_message_2b( - _("CVS Update"), - _("This will save any changes you have made. Are you sure?"), - Gtk::MESSAGE_QUESTION, - _("Cancel"), - _("Update")) - ) - return; - - save(); - } - OneMoment one_moment; - time_t oldtime=get_original_timestamp(); - cvs_update(); - calc_repository_info(); - // If something has been updated... - if(oldtime!=get_original_timestamp()) - { - revert(); - } - } - catch(...) - { - App::dialog_message_1b( - "ERROR", - _("An error has occurred when trying to UPDATE"), - "details", - _("Close")); - } - //update_all_titles(); -} - -void -Instance::dialog_cvs_revert() -{ - calc_repository_info(); - if(!in_repository()) -{ - App::dialog_message_1b( - "ERROR", - _("This file is not under version control, so there is nothing to revert to!"), - "details", - _("Close")); - return; - } - try - { - String filename(get_file_name()); - - if (!App::dialog_message_2b( - _("CVS Revert"), - _("This will abandon all changes you have made since the last time you " - "performed a commit operation. This cannot be undone! " - "Are you sure you want to do this?"), - Gtk::MESSAGE_QUESTION, - _("Cancel"), - _("Revert")) - ) - return; - - OneMoment one_moment; - - // Remove the old file - if(remove(get_file_name().c_str())!=0) - { - App::dialog_message_1b( - "ERROR", - _("Unable to remove previous version"), - "details", - _("Close")); - - return; - } - - cvs_update(); - revert(); - } - catch(...) - { - App::dialog_message_1b( - "ERROR", - _("An error has occurred when trying to UPDATE"), - "details", - _("Close")); - } - //update_all_titles(); -} - void Instance::revert() { @@ -1035,29 +819,6 @@ Instance::safe_close() return false; } while (true); - if(is_modified()) - { - string message = strprintf(_("Commit changes of \"%s\" to the CVS repository?"), - basename(get_file_name()).c_str()); - - string details = (_("If you don't commit, changes not yet on the CVS repository will " - "be permanently lost.")); - - int answer=uim->yes_no_cancel( - message, - details, - _("Close without Committing"), - _("Cancel"), - _("Commit…"), - synfigapp::UIInterface::RESPONSE_YES - ); - - if(answer==synfigapp::UIInterface::RESPONSE_YES) - dialog_cvs_commit(); - if(answer==synfigapp::UIInterface::RESPONSE_CANCEL) - return false; - } - close(); return true; diff --git a/synfig-studio/src/gui/instance.h b/synfig-studio/src/gui/instance.h index 3548c65844c..716da4f2f4f 100644 --- a/synfig-studio/src/gui/instance.h +++ b/synfig-studio/src/gui/instance.h @@ -197,14 +197,6 @@ class Instance : public synfigapp::Instance Status save(); - void dialog_cvs_commit(); - - void dialog_cvs_add(); - - void dialog_cvs_update(); - - void dialog_cvs_revert(); - //! Closes the instance of this composition void close(bool remove_temporary_files = true); diff --git a/synfig-studio/src/synfigapp/CMakeLists.txt b/synfig-studio/src/synfigapp/CMakeLists.txt index aa18602fefa..43f67d2b1b7 100644 --- a/synfig-studio/src/synfigapp/CMakeLists.txt +++ b/synfig-studio/src/synfigapp/CMakeLists.txt @@ -10,7 +10,6 @@ target_sources(synfigapp "${CMAKE_CURRENT_LIST_DIR}/blineconvert.cpp" "${CMAKE_CURRENT_LIST_DIR}/wplistconverter.cpp" "${CMAKE_CURRENT_LIST_DIR}/canvasinterface.cpp" - "${CMAKE_CURRENT_LIST_DIR}/cvs.cpp" "${CMAKE_CURRENT_LIST_DIR}/inputdevice.cpp" "${CMAKE_CURRENT_LIST_DIR}/instance.cpp" "${CMAKE_CURRENT_LIST_DIR}/main.cpp" diff --git a/synfig-studio/src/synfigapp/Makefile.am b/synfig-studio/src/synfigapp/Makefile.am index 631020a42ec..f51086b20ce 100644 --- a/synfig-studio/src/synfigapp/Makefile.am +++ b/synfig-studio/src/synfigapp/Makefile.am @@ -323,7 +323,6 @@ SYNFIGAPPHH = \ blineconvert.h \ wplistconverter.h \ canvasinterface.h \ - cvs.h \ inputdevice.h \ instance.h \ main.h \ @@ -341,7 +340,6 @@ SYNFIGAPPCC = \ blineconvert.cpp \ wplistconverter.cpp \ canvasinterface.cpp \ - cvs.cpp \ inputdevice.cpp \ instance.cpp \ main.cpp \ diff --git a/synfig-studio/src/synfigapp/cvs.cpp b/synfig-studio/src/synfigapp/cvs.cpp deleted file mode 100644 index 19d36f352cd..00000000000 --- a/synfig-studio/src/synfigapp/cvs.cpp +++ /dev/null @@ -1,386 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cvs.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package 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 package 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. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "cvs.h" -#include -#include -#include -#include - - -#include -#include - -#include - -#include - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace synfigapp; - -/* === M A C R O S ========================================================= */ - -#define cvs_command synfig::String("cvs -z4") - -#ifndef _WIN32 -#define HAVE_STRPTIME -#endif - -#if defined(__APPLE__) || defined(__OpenBSD__) -time_t _daylight_() { time_t t(time(0)); return localtime(&t)->tm_gmtoff; } -#define daylight _daylight_() -#elif defined(_MSC_VER) -time_t _daylight_() { time_t t(time(0)); return localtime(&t)->tm_isdst; } -#define daylight _daylight_() -#endif - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CVSInfo::CVSInfo(const synfig::String& file_name) -{ - update_available_=false; - set_file_name(file_name); -} - -CVSInfo::CVSInfo(): - in_sandbox_(), - in_repository_(), - update_available_(false), - original_timestamp_() -{ } - -CVSInfo::~CVSInfo() -{ -} - -void -CVSInfo::set_file_name(const synfig::String& file_name) -{ - file_name_=file_name; - - std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str()); - - if(file) - { - in_sandbox_=true; - calc_repository_info(); - } - else - in_sandbox_=false; -} - -void -CVSInfo::calc_repository_info() -{ -#ifdef _DEBUG - synfig::info("in_sandbox() = %d",in_sandbox()); -#endif - - if(!in_sandbox_) - return; - - std::ifstream file((dirname(file_name_)+"/CVS/Entries").c_str()); - - while(file) - { - String line; - getline(file,line); - if(line.find(basename(file_name_))!=String::npos) - { - in_repository_=true; - String::size_type s,f; - - // Grab the version - s=line.find('/',1); - assert(s!=String::npos); - s++; - f=line.find('/',s+1); - assert(f!=String::npos); - cvs_version_=String(line,s,f-s); - - // Grab the time -#ifdef HAVE_STRPTIME - s=f+1; - f=line.find('/',s+1); - assert(f!=String::npos); - tm time_struct; - strptime(String(line,s,f-s).c_str(),"%c",&time_struct); - original_timestamp_=mktime(&time_struct); -#endif - - if( - system(strprintf( - "cd '%s' && cvs status '%s' | grep -q -e 'Needs Patch'", - dirname(file_name_).c_str(), - basename(file_name_).c_str() - ).c_str())==0 - ) - { - synfig::info("UPDATE_AVAILABLE=TRUE"); - update_available_=true; - } - else - { - system(strprintf( - "cd '%s' && cvs status '%s'", - dirname(file_name_).c_str(), - basename(file_name_).c_str() - ).c_str()); - synfig::info("UPDATE_AVAILABLE=FALSE"); - update_available_=false; - } - - -#ifdef _DEBUG - synfig::info("in_repository() = %d",in_repository()); - synfig::info("get_cvs_version() = %s",get_cvs_version().c_str()); - synfig::info("get_original_timestamp() = %s",ctime(&get_original_timestamp())); - time_t t(get_current_timestamp()); - synfig::info("get_current_timestamp() = %s",ctime(&t)); - synfig::info("get_cvs_root() = %s",get_cvs_root().c_str()); - synfig::info("get_cvs_module() = %s",get_cvs_module().c_str()); -#endif - return; - } - } - - in_repository_=false; - cvs_version_.clear(); - original_timestamp_=0; - -#ifdef _DEBUG - synfig::info("in_repository() = %d",in_repository()); -#endif -} - -bool -CVSInfo::in_sandbox()const -{ - return in_sandbox_; -} - -bool -CVSInfo::in_repository()const -{ - if(!in_sandbox_) - return false; - return in_repository_; -} - -bool -CVSInfo::is_modified()const -{ - if(!in_sandbox() || !in_repository()) - return false; -#ifdef _DEBUG - synfig::info("%d-%d=%d",get_current_timestamp(),get_original_timestamp(),get_current_timestamp()-get_original_timestamp()); -#endif - return get_current_timestamp()!=get_original_timestamp() && abs(get_current_timestamp()-get_original_timestamp())!=3600; -} - -bool -CVSInfo::is_updated()const -{ - return update_available_; -} - -const synfig::String& -CVSInfo::get_cvs_version()const -{ - return cvs_version_; -} - -const time_t& -CVSInfo::get_original_timestamp()const -{ - return original_timestamp_; -} - -time_t -CVSInfo::get_current_timestamp()const -{ - struct stat st; - if(stat(file_name_.c_str(),&st)<0) - { - synfig::error("Unable to get file stats"); - return false; - } - time_t ret((daylight-1)*3600); - //ret+=timezone; - ret+=st.st_mtime; - return ret; -} - -synfig::String -CVSInfo::get_cvs_root()const -{ - if(!in_sandbox_) - return synfig::String(); - - std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str()); - - if(file) - { - String ret; - getline(file,ret); - return ret; - } - - return synfig::String(); -} - -synfig::String -CVSInfo::get_cvs_module()const -{ - if(!in_sandbox_) - return synfig::String(); - - std::ifstream file((dirname(file_name_)+"/CVS/Repository").c_str()); - - if(file) - { - String ret; - getline(file,ret); - return ret; - } - - return synfig::String(); -} - -// This function pre-processes the message so that we -// don't get any CVS syntax errors. -inline synfig::String fix_msg(const synfig::String& message) -{ - synfig::String ret; - int i; - for(i=0;i<(int)message.size();i++) - { - if(message[i]=='\'') - ret+="'\"'\"'"; - else - ret+=message[i]; - } - return ret; -} - -void -CVSInfo::cvs_add(const synfig::String& message) -{ - if(!in_sandbox_) - { - synfig::error("cvs_add(): Not in a sand box"); - throw int(); - return; - } - - synfig::String command(strprintf("cd '%s' && %s add -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str())); - - int ret(system(command.c_str())); - - calc_repository_info(); - - switch(ret) - { - case 0: - break; - default: - synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str()); - throw(ret); - break; - } -} - -void -CVSInfo::cvs_update() -{ - if(!in_sandbox_) - { - synfig::error("cvs_update(): Not in a sand box"); - throw int(); - return; - } - - synfig::String command(strprintf("cd '%s' && %s update '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),basename(file_name_).c_str())); - - int ret(system(command.c_str())); - - calc_repository_info(); - - switch(ret) - { - case 0: - break; - default: - synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str()); - throw(ret); - break; - } -} - -void -CVSInfo::cvs_commit(const synfig::String& message) -{ - if(!in_sandbox_) - { - synfig::error("cvs_commit(): Not in a sand box"); - throw int(); - return; - } - - synfig::String command(strprintf("cd '%s' && %s commit -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str())); - - int ret(system(command.c_str())); - - calc_repository_info(); - - switch(ret) - { - case 0: - break; - default: - synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str()); - if(is_modified()) - throw(ret); - break; - } -} diff --git a/synfig-studio/src/synfigapp/cvs.h b/synfig-studio/src/synfigapp/cvs.h deleted file mode 100644 index 6962afb215b..00000000000 --- a/synfig-studio/src/synfigapp/cvs.h +++ /dev/null @@ -1,104 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cvs.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package 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 package 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. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_CVS_H -#define __SYNFIG_CVS_H - -/* === H E A D E R S ======================================================= */ - -#include -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace synfigapp { - -class CVSInfo -{ - synfig::String file_name_; - - bool in_sandbox_; - bool in_repository_; - bool update_available_; - - synfig::String cvs_version_; - time_t original_timestamp_; - - -public: - void calc_repository_info(); - - CVSInfo(const synfig::String& file_name); - CVSInfo(); - ~CVSInfo(); - - void set_file_name(const synfig::String& file_name); - -// READ OPERATIONS -------------------------------------------------- - - //! Returns TRUE if \a file_name is in a sandbox - bool in_sandbox()const; - - //! Returns TRUE if \a file_name is in the repository - bool in_repository()const; - - //! Returns TRUE if \a file_name has modifications not yet on the repository - bool is_modified()const; - - //! Returns TRUE if there is a new version of \a file_name on the repository - bool is_updated()const; - - //! Returns the CVS version string - const synfig::String& get_cvs_version()const; - - //! Returns the unix timestamp of the repository file - const time_t &get_original_timestamp()const; - - //! Returns the unix timestamp of the checked out file - time_t get_current_timestamp()const; - - //! Returns the Root - synfig::String get_cvs_root()const; - - //! Returns the name of the module - synfig::String get_cvs_module()const; - -// WRITE OPERATIONS ------------------------------------------------- - - void cvs_add(const synfig::String& message=synfig::String()); - - void cvs_update(); - - void cvs_commit(const synfig::String& message=synfig::String()); -}; // END of class CVSInfo - -}; // END of namespace synfigapp - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/synfigapp/instance.cpp b/synfig-studio/src/synfigapp/instance.cpp index bbadbb4a6fb..642ebaabbc9 100644 --- a/synfig-studio/src/synfigapp/instance.cpp +++ b/synfig-studio/src/synfigapp/instance.cpp @@ -128,7 +128,6 @@ synfigapp::find_instance(etl::handle canvas) /* === M E T H O D S ======================================================= */ Instance::Instance(etl::handle canvas, synfig::FileSystem::Handle container): - CVSInfo(canvas->get_file_name()), canvas_(canvas), container_(container) { @@ -158,7 +157,6 @@ void Instance::set_file_name(const synfig::String &name) { get_canvas()->set_file_name(name); - CVSInfo::set_file_name(name); } Instance::~Instance() @@ -700,7 +698,6 @@ Instance::save_as(const synfig::String &file_name) { signal_saved_(); signal_filename_changed_(); - if (is_filename_changed) CVSInfo::set_file_name(new_canvas_filename); return true; } diff --git a/synfig-studio/src/synfigapp/instance.h b/synfig-studio/src/synfigapp/instance.h index a4f0a917d6b..3d95537d1d3 100644 --- a/synfig-studio/src/synfigapp/instance.h +++ b/synfig-studio/src/synfigapp/instance.h @@ -38,7 +38,6 @@ #include #include "action_system.h" #include "selectionmanager.h" -#include "cvs.h" #include /* === M A C R O S ========================================================= */ @@ -52,7 +51,7 @@ namespace synfigapp { class CanvasInterface; -class Instance : public Action::System , public CVSInfo +class Instance : public Action::System { friend class PassiveGrouper; /*