From 595a6e60c6aafad9006327dbeb822b608e7f9b33 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 18:03:26 -0600 Subject: Rename kioslaves --- buildtools/lib/base/Makefile.am | 2 +- buildtools/lib/parsers/autotools/Makefile.am | 2 +- buildtools/lib/parsers/qmake/Makefile.am | 2 +- buildtools/lib/widgets/Makefile.am | 2 +- kdevprj2tdevelop | 6 +- .../cpp/app_templates/kscons_kxt/SConscript-src | 2 +- .../cpp/app_templates/kscons_tdemdi/SConscript-src | 4 +- languages/cpp/app_templates/tdeioslave/slave.cpp | 28 +- languages/cpp/app_templates/tdeioslave/slave.h | 6 +- .../cpp/app_templates/tdeioslave/slave.protocol | 2 +- .../cpp/app_templates/tdeioslave/src-Makefile.am | 8 +- languages/csharp/CMakeLists.txt | 4 +- languages/csharp/Makefile.am | 8 +- languages/csharp/csharpdoc.cpp | 4 +- languages/csharp/csharpdoc.protocol | 2 +- languages/lib/debugger/Makefile.am | 2 +- languages/lib/designer_integration/Makefile.am | 2 +- languages/lib/interfaces/Makefile.am | 2 +- languages/perl/CMakeLists.txt | 4 +- languages/perl/Makefile.am | 8 +- languages/perl/perldoc.cpp | 4 +- languages/perl/perldoc.protocol | 2 +- languages/python/CMakeLists.txt | 4 +- languages/python/Makefile.am | 8 +- languages/python/pydoc.cpp | 6 +- languages/python/pydoc.protocol | 2 +- lib/catalog/Makefile.am | 2 +- lib/interfaces/Makefile.am | 2 +- lib/interfaces/extensions/Makefile.am | 2 +- lib/interfaces/external/Mainpage.dox | 2 +- lib/interfaces/external/Makefile.am | 2 +- lib/interfaces/extras/Makefile.am | 2 +- lib/util/Makefile.am | 2 +- lib/widgets/Makefile.am | 2 +- lib/widgets/propeditor/Makefile.am | 2 +- parts/documentation/interfaces/Makefile.am | 2 +- parts/documentation/protocols/chm/CMakeLists.txt | 4 +- parts/documentation/protocols/chm/Makefile.am | 8 +- parts/documentation/protocols/chm/chm.cpp | 12 +- parts/documentation/protocols/chm/chm.protocol | 2 +- parts/outputviews/makeactionfilter.cpp | 4 +- src/Makefile.am | 2 +- src/profileengine/lib/Makefile.am | 2 +- vcs/subversion/CMakeLists.txt | 6 +- vcs/subversion/Makefile.am | 8 +- vcs/subversion/kdevsvn+file.protocol | 2 +- vcs/subversion/kdevsvn+http.protocol | 2 +- vcs/subversion/kdevsvn+https.protocol | 2 +- vcs/subversion/kdevsvn+ssh.protocol | 2 +- vcs/subversion/kdevsvn+svn.protocol | 2 +- vcs/subversion/svn_kio.cpp | 2155 -------------------- vcs/subversion/svn_kio.h | 163 -- vcs/subversion/svn_tdeio.cpp | 2155 ++++++++++++++++++++ vcs/subversion/svn_tdeio.h | 163 ++ 54 files changed, 2420 insertions(+), 2420 deletions(-) delete mode 100644 vcs/subversion/svn_kio.cpp delete mode 100644 vcs/subversion/svn_kio.h create mode 100644 vcs/subversion/svn_tdeio.cpp create mode 100644 vcs/subversion/svn_tdeio.h diff --git a/buildtools/lib/base/Makefile.am b/buildtools/lib/base/Makefile.am index dbb9850b..7e1083ef 100644 --- a/buildtools/lib/base/Makefile.am +++ b/buildtools/lib/base/Makefile.am @@ -9,7 +9,7 @@ libkdevbuildbase_la_SOURCES = kdevbuildtool.cpp tdevelopbuildtoolsincludedir = $(includedir)/tdevelop/buildtools/base tdevelopbuildtoolsinclude_HEADERS = kdevbuildtool.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevextensions +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevextensions DOXYGEN_PROJECTNAME = KDevelop Buildtool Base Library DOXYGEN_DOCDIRPREFIX = kdevbt include ../../../Doxyfile.am diff --git a/buildtools/lib/parsers/autotools/Makefile.am b/buildtools/lib/parsers/autotools/Makefile.am index fc8cdc9a..e1483112 100644 --- a/buildtools/lib/parsers/autotools/Makefile.am +++ b/buildtools/lib/parsers/autotools/Makefile.am @@ -18,7 +18,7 @@ parser: EXTRA_DIST = autotools.yy autotools.ll -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KDevelop AutoTools Parser DOXYGEN_DOCDIRPREFIX = kdevparser include ../../../../Doxyfile.am diff --git a/buildtools/lib/parsers/qmake/Makefile.am b/buildtools/lib/parsers/qmake/Makefile.am index 5f7ec787..115d2488 100644 --- a/buildtools/lib/parsers/qmake/Makefile.am +++ b/buildtools/lib/parsers/qmake/Makefile.am @@ -23,7 +23,7 @@ parser: EXTRA_DIST = qmake.yy qmake.ll -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KDevelop QMake parser DOXYGEN_DOCDIRPREFIX = kdevparser include ../../../../Doxyfile.am diff --git a/buildtools/lib/widgets/Makefile.am b/buildtools/lib/widgets/Makefile.am index 5528ab85..9a88b0fb 100644 --- a/buildtools/lib/widgets/Makefile.am +++ b/buildtools/lib/widgets/Makefile.am @@ -23,7 +23,7 @@ tdevelopbuildtoolsinclude_HEADERS = addenvvardlg.h addfilesdialog.h \ makeoptionswidgetbase.h removesubprojectdialog.h removesubprojectdlgbase.h runoptionswidget.h \ runoptionswidgetbase.h subclassesdlg.h subclassesdlgbase.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevutil +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevutil DOXYGEN_PROJECTNAME = KDevelop Buildtool Widgets Library DOXYGEN_DOCDIRPREFIX = kdevbt include ../../../Doxyfile.am diff --git a/kdevprj2tdevelop b/kdevprj2tdevelop index 086abe5d..09d3ebaa 100755 --- a/kdevprj2tdevelop +++ b/kdevprj2tdevelop @@ -100,7 +100,7 @@ if ($project_type eq "normal_c" # Choose project management $projectmanagement = "KDevCustomProject"; if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ - || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/) { + || $project_type =~ /kde2_normal|kicker_app|tdeio_slave|kc_module|kpart_plugin|ktheme/) { $projectmanagement = "KDevTDEAutoProject"; } if ($project_type =~ /normal_cpp/) { @@ -109,11 +109,11 @@ if ($project_type =~ /normal_cpp/) { # Keywords if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ - || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/) { + || $project_type =~ /kde2_normal|kicker_app|tdeio_slave|kc_module|kpart_plugin|ktheme/) { $keywords = $keywords . ",KDE"; } if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ - || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/ + || $project_type =~ /kde2_normal|kicker_app|tdeio_slave|kc_module|kpart_plugin|ktheme/ || $project_type =~ /normal_qt|normal_qt2|mdi_qt2|mdi_qextmdi/) { $keywords = $keywords . ",Qt"; } diff --git a/languages/cpp/app_templates/kscons_kxt/SConscript-src b/languages/cpp/app_templates/kscons_kxt/SConscript-src index a60cb116..173b458f 100644 --- a/languages/cpp/app_templates/kscons_kxt/SConscript-src +++ b/languages/cpp/app_templates/kscons_kxt/SConscript-src @@ -37,7 +37,7 @@ myenv.TDEprogram( "%{APPNAMELC}", %{APPNAMELC}_sources ) myenv.TDEaddpaths_includes( "./ ../" ) ## Necessary libraries to link against -myenv.TDEaddlibs( "qt-mt kio tdecore tdeprint" ) +myenv.TDEaddlibs( "tqt-mt tqtinterface tdeio tdecore tdeprint" ) ## This shows how to add other link flags to the program # myenv.TDEaddflags_link('-export-dynamic') diff --git a/languages/cpp/app_templates/kscons_tdemdi/SConscript-src b/languages/cpp/app_templates/kscons_tdemdi/SConscript-src index 97f5140c..26fa3265 100644 --- a/languages/cpp/app_templates/kscons_tdemdi/SConscript-src +++ b/languages/cpp/app_templates/kscons_tdemdi/SConscript-src @@ -22,7 +22,7 @@ prefs.ui # Now that we have our list of sources we can build the program myenv.TDEprogram( '%{APPNAMELC}', %{APPNAMELC}_sources ) # main program myenv.TDEaddpaths_includes( './ ../' ) # additional paths -myenv.TDEaddlibs( 'qt-mt tdecore kio tdeparts tdemdi' ) # additional libraries +myenv.TDEaddlibs( 'tqt-mt tqtinterface tdecore tdeio tdeparts tdemdi' ) # additional libraries ## Next, the kpart library ## using TDEshlib, the .so and .la are installed automatically when needed @@ -31,7 +31,7 @@ myenv2=env.Copy() %{APPNAMELC}part_sources = '%{APPNAMELC}_part.cpp' myenv2.TDEshlib( 'lib%{APPNAMELC}part', %{APPNAMELC}part_sources) myenv2.TDEaddpaths_includes( './ #/' ) # the '#' means the top-level directory -myenv2.TDEaddlibs( 'qt-mt kio tdecore tdeprint tdeparts' ) +myenv2.TDEaddlibs( 'tqt-mt tqtinterface tdeio tdecore tdeprint tdeparts' ) # myenv2.TDEaddflags_link( '-DQT_THREAD_SUPPORT' ) ############################# diff --git a/languages/cpp/app_templates/tdeioslave/slave.cpp b/languages/cpp/app_templates/tdeioslave/slave.cpp index 3c780e7f..683d959e 100644 --- a/languages/cpp/app_templates/tdeioslave/slave.cpp +++ b/languages/cpp/app_templates/tdeioslave/slave.cpp @@ -26,22 +26,22 @@ using namespace TDEIO; -kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol(const TQCString &pool_socket, const TQCString &app_socket) - : SlaveBase("kio_%{APPNAMELC}", pool_socket, app_socket) +tdeio_%{APPNAMELC}Protocol::tdeio_%{APPNAMELC}Protocol(const TQCString &pool_socket, const TQCString &app_socket) + : SlaveBase("tdeio_%{APPNAMELC}", pool_socket, app_socket) { - kdDebug() << "kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol()" << endl; + kdDebug() << "tdeio_%{APPNAMELC}Protocol::tdeio_%{APPNAMELC}Protocol()" << endl; } -kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol() +tdeio_%{APPNAMELC}Protocol::~tdeio_%{APPNAMELC}Protocol() { - kdDebug() << "kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol()" << endl; + kdDebug() << "tdeio_%{APPNAMELC}Protocol::~tdeio_%{APPNAMELC}Protocol()" << endl; } -void kio_%{APPNAMELC}Protocol::get(const KURL& url ) +void tdeio_%{APPNAMELC}Protocol::get(const KURL& url ) { - kdDebug() << "kio_%{APPNAMELC}::get(const KURL& url)" << endl ; + kdDebug() << "tdeio_%{APPNAMELC}::get(const KURL& url)" << endl ; kdDebug() << "Seconds: " << url.query() << endl; TQString remoteServer = url.host(); @@ -52,14 +52,14 @@ void kio_%{APPNAMELC}Protocol::get(const KURL& url ) // Send the mimeType as soon as it is known mimeType("text/plain"); // Send the data - TQString theData = "This is a test of kio_%{APPNAMELC}"; + TQString theData = "This is a test of tdeio_%{APPNAMELC}"; data(TQCString(theData.local8Bit())); data(TQByteArray()); // empty array means we're done sending the data finished(); } -void kio_%{APPNAMELC}Protocol::mimetype(const KURL & /*url*/) +void tdeio_%{APPNAMELC}Protocol::mimetype(const KURL & /*url*/) { mimeType("text/plain"); finished(); @@ -70,19 +70,19 @@ extern "C" { int kdemain(int argc, char **argv) { - TDEInstance instance( "kio_%{APPNAMELC}" ); + TDEInstance instance( "tdeio_%{APPNAMELC}" ); - kdDebug(7101) << "*** Starting kio_%{APPNAMELC} " << endl; + kdDebug(7101) << "*** Starting tdeio_%{APPNAMELC} " << endl; if (argc != 4) { - kdDebug(7101) << "Usage: kio_%{APPNAMELC} protocol domain-socket1 domain-socket2" << endl; + kdDebug(7101) << "Usage: tdeio_%{APPNAMELC} protocol domain-socket1 domain-socket2" << endl; exit(-1); } - kio_%{APPNAMELC}Protocol slave(argv[2], argv[3]); + tdeio_%{APPNAMELC}Protocol slave(argv[2], argv[3]); slave.dispatchLoop(); - kdDebug(7101) << "*** kio_%{APPNAMELC} Done" << endl; + kdDebug(7101) << "*** tdeio_%{APPNAMELC} Done" << endl; return 0; } } diff --git a/languages/cpp/app_templates/tdeioslave/slave.h b/languages/cpp/app_templates/tdeioslave/slave.h index 672e6121..a77090cc 100644 --- a/languages/cpp/app_templates/tdeioslave/slave.h +++ b/languages/cpp/app_templates/tdeioslave/slave.h @@ -11,11 +11,11 @@ class TQCString; -class kio_%{APPNAMELC}Protocol : public TDEIO::SlaveBase +class tdeio_%{APPNAMELC}Protocol : public TDEIO::SlaveBase { public: - kio_%{APPNAMELC}Protocol(const TQCString &pool_socket, const TQCString &app_socket); - virtual ~kio_%{APPNAMELC}Protocol(); + tdeio_%{APPNAMELC}Protocol(const TQCString &pool_socket, const TQCString &app_socket); + virtual ~tdeio_%{APPNAMELC}Protocol(); virtual void mimetype(const KURL& url); virtual void get(const KURL& url); }; diff --git a/languages/cpp/app_templates/tdeioslave/slave.protocol b/languages/cpp/app_templates/tdeioslave/slave.protocol index 5a1f6445..c9347839 100644 --- a/languages/cpp/app_templates/tdeioslave/slave.protocol +++ b/languages/cpp/app_templates/tdeioslave/slave.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_%{APPNAMELC} +exec=tdeio_%{APPNAMELC} protocol=%{APPNAMELC} input=none output=stream diff --git a/languages/cpp/app_templates/tdeioslave/src-Makefile.am b/languages/cpp/app_templates/tdeioslave/src-Makefile.am index b160d973..c7ed36ea 100644 --- a/languages/cpp/app_templates/tdeioslave/src-Makefile.am +++ b/languages/cpp/app_templates/tdeioslave/src-Makefile.am @@ -1,10 +1,10 @@ INCLUDES = $(all_includes) -kde_module_LTLIBRARIES = kio_%{APPNAMELC}.la +kde_module_LTLIBRARIES = tdeio_%{APPNAMELC}.la -kio_%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp -kio_%{APPNAMELC}_la_LIBADD = -lkio -kio_%{APPNAMELC}_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_PLUGIN) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_KPARTS) +tdeio_%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +tdeio_%{APPNAMELC}_la_LIBADD = -ltdeio +tdeio_%{APPNAMELC}_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_PLUGIN) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_KPARTS) protocol_DATA = %{APPNAMELC}.protocol protocoldir = $(kde_servicesdir) diff --git a/languages/csharp/CMakeLists.txt b/languages/csharp/CMakeLists.txt index 362a22fe..5e148431 100644 --- a/languages/csharp/CMakeLists.txt +++ b/languages/csharp/CMakeLists.txt @@ -50,9 +50,9 @@ tde_add_kpart( libkdevcsharpsupport AUTOMOC ) -##### kio_csharpdoc (module) #################### +##### tdeio_csharpdoc (module) #################### -tde_add_kpart( kio_csharpdoc AUTOMOC +tde_add_kpart( tdeio_csharpdoc AUTOMOC SOURCES csharpdoc.cpp LINK tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} diff --git a/languages/csharp/Makefile.am b/languages/csharp/Makefile.am index 9524ed00..d04f1481 100644 --- a/languages/csharp/Makefile.am +++ b/languages/csharp/Makefile.am @@ -6,15 +6,15 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces \ SUBDIRS = app_templates file_templates doc -kde_module_LTLIBRARIES = libkdevcsharpsupport.la kio_csharpdoc.la +kde_module_LTLIBRARIES = libkdevcsharpsupport.la tdeio_csharpdoc.la libkdevcsharpsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) libkdevcsharpsupport_la_LIBADD = $(top_builddir)/lib/libtdevelop.la libkdevcsharpsupport_la_SOURCES = csharpsupportpart.cpp csharpconfigwidget.cpp csharpconfigwidgetbase.ui -kio_csharpdoc_la_SOURCES = csharpdoc.cpp -kio_csharpdoc_la_LIBADD = $(LIB_KIO) -kio_csharpdoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_csharpdoc_la_SOURCES = csharpdoc.cpp +tdeio_csharpdoc_la_LIBADD = $(LIB_KIO) +tdeio_csharpdoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) METASOURCES = AUTO diff --git a/languages/csharp/csharpdoc.cpp b/languages/csharp/csharpdoc.cpp index 1657d268..d9d2e548 100644 --- a/languages/csharp/csharpdoc.cpp +++ b/languages/csharp/csharpdoc.cpp @@ -116,11 +116,11 @@ extern "C" { int kdemain(int argc, char **argv) { - TDEInstance instance( "kio_csharpdoc" ); + TDEInstance instance( "tdeio_csharpdoc" ); TDEGlobal::locale()->setMainCatalogue("tdevelop"); if (argc != 4) { - fprintf(stderr, "Usage: kio_csharpdoc protocol domain-socket1 domain-socket2\n"); + fprintf(stderr, "Usage: tdeio_csharpdoc protocol domain-socket1 domain-socket2\n"); exit(-1); } diff --git a/languages/csharp/csharpdoc.protocol b/languages/csharp/csharpdoc.protocol index 9b813b02..337316f1 100644 --- a/languages/csharp/csharpdoc.protocol +++ b/languages/csharp/csharpdoc.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_csharpdoc +exec=tdeio_csharpdoc protocol=csharpdoc input=none output=filesystem diff --git a/languages/lib/debugger/Makefile.am b/languages/lib/debugger/Makefile.am index 1a6b7d2e..326f9805 100644 --- a/languages/lib/debugger/Makefile.am +++ b/languages/lib/debugger/Makefile.am @@ -7,7 +7,7 @@ liblang_debugger_la_SOURCES = kdevdebugger.cpp debugger.cpp langincludedirdir = $(includedir)/tdevelop/languages/debugger langincludedir_HEADERS = debugger.h kdevdebugger.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces kdevutil +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces kdevutil DOXYGEN_PROJECTNAME = KDevelop Debugger Support Library DOXYGEN_DOCDIRPREFIX = kdevlang include ../../../Doxyfile.am diff --git a/languages/lib/designer_integration/Makefile.am b/languages/lib/designer_integration/Makefile.am index 250b8be6..6e9680a9 100644 --- a/languages/lib/designer_integration/Makefile.am +++ b/languages/lib/designer_integration/Makefile.am @@ -11,6 +11,6 @@ libdesignerintegration_la_SOURCES = implementationwidgetbase.ui \ langincludedirdir = $(includedir)/tdevelop/languages/designer_integration langincludedir_HEADERS = qtdesignerintegration.h implementationwidget.h implementationwidgetbase.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces kdevutil +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces kdevutil DOXYGEN_PROJECTNAME = KDevelop Designer Integration Support Library include ../../../Doxyfile.am diff --git a/languages/lib/interfaces/Makefile.am b/languages/lib/interfaces/Makefile.am index 3edd1097..c3ed3d00 100644 --- a/languages/lib/interfaces/Makefile.am +++ b/languages/lib/interfaces/Makefile.am @@ -10,7 +10,7 @@ INCLUDES = $(all_includes) servicetypedir = $(kde_servicetypesdir) servicetype_DATA = tdeveloppcsimporter.desktop -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces kdevutil +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces kdevutil DOXYGEN_PROJECTNAME = KDevelop Language Support Interfaces Library DOXYGEN_DOCDIRPREFIX = kdevlang include ../../../Doxyfile.am diff --git a/languages/perl/CMakeLists.txt b/languages/perl/CMakeLists.txt index f67ec9c0..e458c240 100644 --- a/languages/perl/CMakeLists.txt +++ b/languages/perl/CMakeLists.txt @@ -45,9 +45,9 @@ tde_add_kpart( libkdevperlsupport AUTOMOC ) -##### kio_perldoc (module) ###################### +##### tdeio_perldoc (module) ###################### -tde_add_kpart( kio_perldoc +tde_add_kpart( tdeio_perldoc SOURCES perldoc.cpp LINK tdeio-shared diff --git a/languages/perl/Makefile.am b/languages/perl/Makefile.am index c0fa3598..bf8f9388 100644 --- a/languages/perl/Makefile.am +++ b/languages/perl/Makefile.am @@ -6,15 +6,15 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces \ SUBDIRS = app_templates file_templates doc -kde_module_LTLIBRARIES = libkdevperlsupport.la kio_perldoc.la +kde_module_LTLIBRARIES = libkdevperlsupport.la tdeio_perldoc.la libkdevperlsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) libkdevperlsupport_la_LIBADD = $(top_builddir)/lib/libtdevelop.la libkdevperlsupport_la_SOURCES = perlparser.cpp perlsupportpart.cpp perlconfigwidget.cpp perlconfigwidgetbase.ui -kio_perldoc_la_SOURCES = perldoc.cpp -kio_perldoc_la_LIBADD = $(LIB_KIO) -kio_perldoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_perldoc_la_SOURCES = perldoc.cpp +tdeio_perldoc_la_LIBADD = $(LIB_KIO) +tdeio_perldoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) METASOURCES = AUTO diff --git a/languages/perl/perldoc.cpp b/languages/perl/perldoc.cpp index dee9b6d0..85aee7b3 100644 --- a/languages/perl/perldoc.cpp +++ b/languages/perl/perldoc.cpp @@ -116,11 +116,11 @@ extern "C" { int kdemain(int argc, char **argv) { - TDEInstance instance( "kio_perldoc" ); + TDEInstance instance( "tdeio_perldoc" ); TDEGlobal::locale()->setMainCatalogue("tdevelop"); if (argc != 4) { - fprintf(stderr, "Usage: kio_perldoc protocol domain-socket1 domain-socket2\n"); + fprintf(stderr, "Usage: tdeio_perldoc protocol domain-socket1 domain-socket2\n"); exit(-1); } diff --git a/languages/perl/perldoc.protocol b/languages/perl/perldoc.protocol index 031ca931..9da10d69 100644 --- a/languages/perl/perldoc.protocol +++ b/languages/perl/perldoc.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_perldoc +exec=tdeio_perldoc protocol=perldoc input=none output=filesystem diff --git a/languages/python/CMakeLists.txt b/languages/python/CMakeLists.txt index 93ba69c2..989ea1b1 100644 --- a/languages/python/CMakeLists.txt +++ b/languages/python/CMakeLists.txt @@ -49,9 +49,9 @@ tde_add_kpart( libkdevpythonsupport AUTOMOC ) -##### kio_pydoc (module) ######################## +##### tdeio_pydoc (module) ######################## -tde_add_kpart( kio_pydoc +tde_add_kpart( tdeio_pydoc SOURCES pydoc.cpp LINK tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} diff --git a/languages/python/Makefile.am b/languages/python/Makefile.am index 3474eceb..4b8da707 100644 --- a/languages/python/Makefile.am +++ b/languages/python/Makefile.am @@ -7,7 +7,7 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/languages/lib/designer SUBDIRS = app_templates file_templates doc -kde_module_LTLIBRARIES = libkdevpythonsupport.la kio_pydoc.la +kde_module_LTLIBRARIES = libkdevpythonsupport.la tdeio_pydoc.la libkdevpythonsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) libkdevpythonsupport_la_LIBADD = $(top_builddir)/lib/libtdevelop.la \ @@ -15,9 +15,9 @@ libkdevpythonsupport_la_LIBADD = $(top_builddir)/lib/libtdevelop.la \ libkdevpythonsupport_la_SOURCES = pythonsupportpart.cpp pythonconfigwidget.cpp pythonconfigwidgetbase.ui \ pythonimplementationwidget.cpp qtdesignerpythonintegration.cpp -kio_pydoc_la_SOURCES = pydoc.cpp -kio_pydoc_la_LIBADD = $(LIB_KIO) -kio_pydoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_pydoc_la_SOURCES = pydoc.cpp +tdeio_pydoc_la_LIBADD = $(LIB_KIO) +tdeio_pydoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) METASOURCES = AUTO diff --git a/languages/python/pydoc.cpp b/languages/python/pydoc.cpp index 760728c7..c021b368 100644 --- a/languages/python/pydoc.cpp +++ b/languages/python/pydoc.cpp @@ -20,7 +20,7 @@ PydocProtocol::PydocProtocol(const TQCString &pool, const TQCString &app) : SlaveBase("pydoc", pool, app), key() { python = TDEGlobal::dirs()->findExe("python"); - script = locate("data", "kio_pydoc/kde_pydoc.py"); + script = locate("data", "tdeio_pydoc/kde_pydoc.py"); } @@ -96,11 +96,11 @@ extern "C" { int kdemain(int argc, char **argv) { - TDEInstance instance( "kio_pydoc" ); + TDEInstance instance( "tdeio_pydoc" ); TDEGlobal::locale()->setMainCatalogue("tdevelop"); if (argc != 4) { - fprintf(stderr, "Usage: kio_pydoc protocol domain-socket1 domain-socket2\n"); + fprintf(stderr, "Usage: tdeio_pydoc protocol domain-socket1 domain-socket2\n"); exit(-1); } diff --git a/languages/python/pydoc.protocol b/languages/python/pydoc.protocol index 4801357f..10e04d7d 100644 --- a/languages/python/pydoc.protocol +++ b/languages/python/pydoc.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_pydoc +exec=tdeio_pydoc protocol=pydoc input=none output=filesystem diff --git a/lib/catalog/Makefile.am b/lib/catalog/Makefile.am index 1aaa40ef..c8c7ddc1 100644 --- a/lib/catalog/Makefile.am +++ b/lib/catalog/Makefile.am @@ -7,7 +7,7 @@ libkdevcatalog_la_LIBADD = -l$(DB3LIB) $(LIB_TDECORE) $(LIB_QT) kdevcatalogincludedir = $(includedir)/tdevelop/catalog kdevcataloginclude_HEADERS = catalog.h tag.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = TDevelop Catalog Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/interfaces/Makefile.am b/lib/interfaces/Makefile.am index 21deec16..ba43ce86 100644 --- a/lib/interfaces/Makefile.am +++ b/lib/interfaces/Makefile.am @@ -33,7 +33,7 @@ METASOURCES = AUTO SUBDIRS = extensions external extras -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions DOXYGEN_PROJECTNAME = TDevelop Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/interfaces/extensions/Makefile.am b/lib/interfaces/extensions/Makefile.am index 211439b0..a6d00bc2 100644 --- a/lib/interfaces/extensions/Makefile.am +++ b/lib/interfaces/extensions/Makefile.am @@ -16,7 +16,7 @@ libkdevextensions_la_SOURCES = kdevappfrontend.cpp kdevmakefrontend.cpp INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) METASOURCES = AUTO -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Extension Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am diff --git a/lib/interfaces/external/Mainpage.dox b/lib/interfaces/external/Mainpage.dox index b66b8795..4ed571dd 100644 --- a/lib/interfaces/external/Mainpage.dox +++ b/lib/interfaces/external/Mainpage.dox @@ -45,7 +45,7 @@ KDevelop version >= 3.1 comes with a customized version (fork ;)) of %Qt Designe - KDevDesigner uses %KDE icons and dialogs and thus provides better integration with a system. . -It is safe to preview forms with some %KDE widgets from tdeui and kio libraries - KDevDesigner part is linked to those libraries so it will not crash under some circumstances. +It is safe to preview forms with some %KDE widgets from tdeui and tdeio libraries - KDevDesigner part is linked to those libraries so it will not crash under some circumstances. KDevDesigner will not create .ui.h files - this feature is completely disabled. Integrated KDevDesigner will use subclassing approach, standalone does not allow to enter code. diff --git a/lib/interfaces/external/Makefile.am b/lib/interfaces/external/Makefile.am index 8d022993..63d3b4db 100644 --- a/lib/interfaces/external/Makefile.am +++ b/lib/interfaces/external/Makefile.am @@ -10,6 +10,6 @@ libkinterfacedesigner_la_LIBADD = $(LIB_QT) $(LIB_KPARTS) $(LIB_TDEUI) libkinterfacedesigner_la_LDFLAGS = $(all_libraries) libkinterfacedesigner_la_SOURCES = designer.cpp -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KInterfaceDesigner Library include ../../../Doxyfile.am diff --git a/lib/interfaces/extras/Makefile.am b/lib/interfaces/extras/Makefile.am index a554ad30..67615223 100644 --- a/lib/interfaces/extras/Makefile.am +++ b/lib/interfaces/extras/Makefile.am @@ -12,7 +12,7 @@ libkdevextras_la_SOURCES = kdevcompileroptions.cpp kdevvcsintegrator.cpp servicetype_DATA = tdevelopcompileroptions.desktop \ tdevelopvcsintegrator.desktop -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces DOXYGEN_PROJECTNAME = TDevelop Extra Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am diff --git a/lib/util/Makefile.am b/lib/util/Makefile.am index 4dbaa33b..8bf28091 100644 --- a/lib/util/Makefile.am +++ b/lib/util/Makefile.am @@ -12,7 +12,7 @@ tdevelopincludedir = $(includedir)/tdevelop/util tdevelopinclude_HEADERS = domutil.h execcommand.h filetemplate.h urlutil.h \ configwidgetproxy.h rurl.h tdescriptactionmanager.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevextensions kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevextensions kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Utility Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index ecf57f7f..7d65a18f 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -24,7 +24,7 @@ rcdir = $(kde_datadir)/tdevelop rc_DATA = kdevhtml_partui.rc -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Widgets Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/widgets/propeditor/Makefile.am b/lib/widgets/propeditor/Makefile.am index 0c037873..e6217ec6 100644 --- a/lib/widgets/propeditor/Makefile.am +++ b/lib/widgets/propeditor/Makefile.am @@ -13,6 +13,6 @@ pcolorcombo.cpp pdoublenuminput.cpp ppixmapedit.cpp propertylist.cpp ps kdevpropeditorincludedir = $(includedir)/tdevelop/propeditor kdevpropeditorinclude_HEADERS = childproperty.h pcombobox.h pdummywidget.h ppointedit.h propertymachinefactory.h pcursoredit.h pfontbutton.h prectedit.h propertywidget.h pdateedit.h pfontcombo.h property.h psizeedit.h pdatetimeedit.h plineedit.h propertyeditor.h psizepolicyedit.h pdoublenuminput.h ppixmapedit.h propertylist.h pspinbox.h propertywidgetproxy.h multiproperty.h pyesnobutton.h purledit.h psymbolcombo.h pstringlistedit.h pcolorcombo.h pcolorbutton.h pcheckbox.h plinestyleedit.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KDevelop Property Editing Library include ../../../Doxyfile.am diff --git a/parts/documentation/interfaces/Makefile.am b/parts/documentation/interfaces/Makefile.am index 6e66b46c..cd68e6f3 100644 --- a/parts/documentation/interfaces/Makefile.am +++ b/parts/documentation/interfaces/Makefile.am @@ -10,7 +10,7 @@ partincludedir_HEADERS = kdevdocumentationplugin.h servicetypedir = $(kde_servicetypesdir) servicetype_DATA = tdevelopdocumentationplugins.desktop -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Documentation Part Interfaces Library DOXYGEN_DOCDIRPREFIX = kdevdoc include ../../../Doxyfile.am diff --git a/parts/documentation/protocols/chm/CMakeLists.txt b/parts/documentation/protocols/chm/CMakeLists.txt index 3a7ae935..c444c226 100644 --- a/parts/documentation/protocols/chm/CMakeLists.txt +++ b/parts/documentation/protocols/chm/CMakeLists.txt @@ -30,9 +30,9 @@ install( FILES DESTINATION ${SERVICES_INSTALL_DIR} ) -##### kio_chm (module) ########################## +##### tdeio_chm (module) ########################## -tde_add_kpart( kio_chm +tde_add_kpart( tdeio_chm SOURCES decompress.cpp chmfile.cpp chm.cpp LINK tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} diff --git a/parts/documentation/protocols/chm/Makefile.am b/parts/documentation/protocols/chm/Makefile.am index 933f4685..ba5601d3 100644 --- a/parts/documentation/protocols/chm/Makefile.am +++ b/parts/documentation/protocols/chm/Makefile.am @@ -2,11 +2,11 @@ INCLUDES = -I$(top_srcdir)/lib/widgets $(all_includes) -kde_module_LTLIBRARIES = kio_chm.la libkchmpart.la +kde_module_LTLIBRARIES = tdeio_chm.la libkchmpart.la -kio_chm_la_SOURCES = decompress.cpp chmfile.cpp chm.cpp -kio_chm_la_LIBADD = $(LIB_KIO) -kio_chm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_chm_la_SOURCES = decompress.cpp chmfile.cpp chm.cpp +tdeio_chm_la_LIBADD = $(LIB_KIO) +tdeio_chm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) libkchmpart_la_SOURCES = kchmpart.cpp libkchmpart_la_LIBADD = -ltdehtml $(LIB_KPARTS) $(top_builddir)/lib/widgets/libkdevwidgets.la diff --git a/parts/documentation/protocols/chm/chm.cpp b/parts/documentation/protocols/chm/chm.cpp index 7c8421a8..08a46136 100644 --- a/parts/documentation/protocols/chm/chm.cpp +++ b/parts/documentation/protocols/chm/chm.cpp @@ -41,25 +41,25 @@ extern "C" { int kdemain( int argc, char **argv ) { - TDEInstance instance( "kio_chm" ); + TDEInstance instance( "tdeio_chm" ); - kdDebug() << "*** Starting kio_chm " << endl; + kdDebug() << "*** Starting tdeio_chm " << endl; if (argc != 4) { - kdDebug() << "Usage: kio_chm protocol domain-socket1 domain-socket2" << endl; + kdDebug() << "Usage: tdeio_chm protocol domain-socket1 domain-socket2" << endl; exit(-1); } ChmProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); - kdDebug() << "*** kio_chm Done" << endl; + kdDebug() << "*** tdeio_chm Done" << endl; return 0; } } ChmProtocol::ChmProtocol(const TQCString &pool_socket, const TQCString &app_socket) -: SlaveBase("kio_chm", pool_socket, app_socket) +: SlaveBase("tdeio_chm", pool_socket, app_socket) { kdDebug() << "ChmProtocol::ChmProtocol()" << endl; } @@ -80,7 +80,7 @@ void ChmProtocol::get( const KURL& url ) * of the node, an integer representing a node's ID, the Title of the Node, and it's hyperlink. * When :contents is appended, all contained htm- and html-files will be printed, each in a line. */ - kdDebug() << "kio_chm::get(const KURL& url) " << url.path() << endl; + kdDebug() << "tdeio_chm::get(const KURL& url) " << url.path() << endl; bool catalog = false; bool contents = false; diff --git a/parts/documentation/protocols/chm/chm.protocol b/parts/documentation/protocols/chm/chm.protocol index 492524e0..e311c74e 100644 --- a/parts/documentation/protocols/chm/chm.protocol +++ b/parts/documentation/protocols/chm/chm.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_chm +exec=tdeio_chm protocol=ms-its input=none output=filesystem diff --git a/parts/outputviews/makeactionfilter.cpp b/parts/outputviews/makeactionfilter.cpp index 1f0d6cd5..e7285c82 100644 --- a/parts/outputviews/makeactionfilter.cpp +++ b/parts/outputviews/makeactionfilter.cpp @@ -234,7 +234,7 @@ void MakeActionFilter::test() "-fno-builtin -g3 -fno-exceptions -fno-check-new -fno-common -o libtdefilereplacepart.la.closure libtdefilereplacepart_la_closure.lo " "-module -no-undefined -L/usr/X11R6/lib -L/usr/lib/qt3/lib -L/opt/trinity/lib -version-info 1:0:0 tdefilereplacepart.lo tdefilereplacedoc.lo " "tdefilereplaceview.lo kabouttdefilereplace.lo kaddstringdlg.lo tdeconfirmdlg.lo kernel.lo kexpression.lo tdefilereplacepref.lo " - "klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -lkio -ltdeparts -ltdehtml", + "klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -ltdeio -ltdeparts -ltdehtml", "linking", "libtool", "libtdefilereplacepart.la.closure") << TestItem( //libtool, linking 3 "/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic " @@ -242,7 +242,7 @@ void MakeActionFilter::test() "-fno-builtin -g3 -fno-exceptions -fno-check-new -fno-common -o libtdefilereplacepart.la -rpath /opt/trinity/lib/trinity " "-module -no-undefined -L/usr/X11R6/lib -L/usr/lib/qt3/lib -L/opt/trinity/lib -version-info 1:0:0 tdefilereplacepart.lo " "tdefilereplacedoc.lo tdefilereplaceview.lo kabouttdefilereplace.lo kaddstringdlg.lo tdeconfirmdlg.lo kernel.lo kexpression.lo " - "tdefilereplacepref.lo klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -lkio -ltdeparts -ltdehtml", + "tdefilereplacepref.lo klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -ltdeio -ltdeparts -ltdehtml", "linking", "libtool", "libtdefilereplacepart.la") << TestItem( //automake, builddir!=srcdir, libtool=no, compiling " g++ -DHAVE_CONFIG_H -I. -I/home/andris/cvs-developement/head/quanta/quanta/project " diff --git a/src/Makefile.am b/src/Makefile.am index d2d434da..41c483ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,7 @@ shellinclude_HEADERS = api.h core.h documentationpart.h editorproxy.h \ statusbar.h toplevel.h generalinfowidgetbase.h mimewarningdialog.h settingswidget.h \ simplemainwindow.h multibuffer.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevextensions +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces kdevextensions DOXYGEN_PROJECTNAME = KDevelop Generic Shell DOXYGEN_DOCDIRPREFIX = kdevshell include ../Doxyfile.am diff --git a/src/profileengine/lib/Makefile.am b/src/profileengine/lib/Makefile.am index 5a37fdf5..e3b29560 100644 --- a/src/profileengine/lib/Makefile.am +++ b/src/profileengine/lib/Makefile.am @@ -10,7 +10,7 @@ libprofileengine_la_SOURCES = profileengine.cpp profile.cpp profileincludedir = $(includedir)/tdevelop/shell/profileengine profileinclude_HEADERS = profileengine.h profile.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Shell Profiles Library DOXYGEN_DOCDIRPREFIX = kdevprofiles include ../../../Doxyfile.am diff --git a/vcs/subversion/CMakeLists.txt b/vcs/subversion/CMakeLists.txt index 0e902488..fb51fe3d 100644 --- a/vcs/subversion/CMakeLists.txt +++ b/vcs/subversion/CMakeLists.txt @@ -59,11 +59,11 @@ tde_add_kpart( libkdevsubversion AUTOMOC ) -##### kio_kdevsvn (module) ###################### +##### tdeio_kdevsvn (module) ###################### -tde_add_kpart( kio_kdevsvn AUTOMOC +tde_add_kpart( tdeio_kdevsvn AUTOMOC SOURCES - svn_kio.cpp + svn_tdeio.cpp LINK tdeio-shared ${SVN_LIBRARIES} ${APR_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/vcs/subversion/Makefile.am b/vcs/subversion/Makefile.am index ce853943..ba5d6c0f 100644 --- a/vcs/subversion/Makefile.am +++ b/vcs/subversion/Makefile.am @@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util -I$(top_srcdi METASOURCES = AUTO -kde_module_LTLIBRARIES = libkdevsubversion.la kio_kdevsvn.la kded_kdevsvnd.la +kde_module_LTLIBRARIES = libkdevsubversion.la tdeio_kdevsvn.la kded_kdevsvnd.la libkdevsubversion_la_SOURCES = subversion_core.cpp subversion_fileinfo.cpp \ subversion_fileinfo.skel subversion_part.cpp subversion_widget.cpp subversiondiff.ui \ @@ -14,9 +14,9 @@ libkdevsubversion_la_LIBADD = $(top_builddir)/lib/libtdevelop.la $(top_builddir) libkdevsubversion_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -kio_kdevsvn_la_SOURCES = svn_kio.cpp -kio_kdevsvn_la_LIBADD = $(LIB_KIO) -kio_kdevsvn_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) $(SVN_LIB) +tdeio_kdevsvn_la_SOURCES = svn_tdeio.cpp +tdeio_kdevsvn_la_LIBADD = $(LIB_KIO) +tdeio_kdevsvn_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) $(SVN_LIB) kded_kdevsvnd_la_SOURCES = commitdlg.cpp commitdlgbase.ui kdevsvnd.cpp \ kdevsvnd.skel kdevsvnd_widgets.cpp svnssltrustpromptbase.ui diff --git a/vcs/subversion/kdevsvn+file.protocol b/vcs/subversion/kdevsvn+file.protocol index 8ac6ec11..412c3800 100644 --- a/vcs/subversion/kdevsvn+file.protocol +++ b/vcs/subversion/kdevsvn+file.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_kdevsvn +exec=tdeio_kdevsvn protocol=kdevsvn+file input=none output=filesystem diff --git a/vcs/subversion/kdevsvn+http.protocol b/vcs/subversion/kdevsvn+http.protocol index 2c02d3d7..5a063b85 100644 --- a/vcs/subversion/kdevsvn+http.protocol +++ b/vcs/subversion/kdevsvn+http.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_kdevsvn +exec=tdeio_kdevsvn protocol=kdevsvn+http input=none output=filesystem diff --git a/vcs/subversion/kdevsvn+https.protocol b/vcs/subversion/kdevsvn+https.protocol index 82f9f22f..d064e575 100644 --- a/vcs/subversion/kdevsvn+https.protocol +++ b/vcs/subversion/kdevsvn+https.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_kdevsvn +exec=tdeio_kdevsvn protocol=kdevsvn+https input=none output=filesystem diff --git a/vcs/subversion/kdevsvn+ssh.protocol b/vcs/subversion/kdevsvn+ssh.protocol index efc67f6c..512b4a90 100644 --- a/vcs/subversion/kdevsvn+ssh.protocol +++ b/vcs/subversion/kdevsvn+ssh.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_kdevsvn +exec=tdeio_kdevsvn protocol=kdevsvn+ssh input=none output=filesystem diff --git a/vcs/subversion/kdevsvn+svn.protocol b/vcs/subversion/kdevsvn+svn.protocol index c4b56816..8f496854 100644 --- a/vcs/subversion/kdevsvn+svn.protocol +++ b/vcs/subversion/kdevsvn+svn.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_kdevsvn +exec=tdeio_kdevsvn protocol=kdevsvn+svn input=none output=filesystem diff --git a/vcs/subversion/svn_kio.cpp b/vcs/subversion/svn_kio.cpp deleted file mode 100644 index 1680595a..00000000 --- a/vcs/subversion/svn_kio.cpp +++ /dev/null @@ -1,2155 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Mickael Marchand - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "svn_kio.h" -#include -// #include "commitdlg.h" -#include - -using namespace TDEIO; -using namespace SvnGlobal; - -typedef struct -{ - /* Holds the directory that corresponds to the REPOS_URL at RA->open() - * time. When callbacks specify a relative path, they are joined with - * this base directory. */ - const char *base_dir; - svn_wc_adm_access_t *base_access; - - /* An array of svn_client_commit_item_t * structures, present only - * during working copy commits. */ - apr_array_header_t *commit_items; - - /* A hash of svn_config_t's, keyed off file name (i.e. the contents of - * ~/.subversion/config end up keyed off of 'config'). */ - apr_hash_t *config; - - /* The pool to use for session-related items. */ - apr_pool_t *pool; - -} svn_client__callback_baton_t; - -static svn_error_t * -open_tmp_file (apr_file_t **fp, - void *callback_baton, - apr_pool_t *pool) -{ - svn_client__callback_baton_t *cb = (svn_client__callback_baton_t *) callback_baton; - const char *truepath; - const char *ignored_filename; - - if (cb->base_dir) - truepath = apr_pstrdup (pool, cb->base_dir); - else - truepath = ""; - - /* Tack on a made-up filename. */ - truepath = svn_path_join (truepath, "tempfile", pool); - - /* Open a unique file; use APR_DELONCLOSE. */ - SVN_ERR (svn_io_open_unique_file (fp, &ignored_filename, - truepath, ".tmp", TRUE, pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t *write_to_string(void *baton, const char *data, apr_size_t *len) { - kbaton *tb = ( kbaton* )baton; - svn_stringbuf_appendbytes(tb->target_string, data, *len); - return SVN_NO_ERROR; -} - -static int -compare_items_as_paths (const svn_sort__item_t*a, const svn_sort__item_t*b) { - return svn_path_compare_paths ((const char *)a->key, (const char *)b->key); -} - -kio_svnProtocol::kio_svnProtocol(const TQCString &pool_socket, const TQCString &app_socket) - : SlaveBase("kio_svn", pool_socket, app_socket) { - kdDebug(9036) << "kio_svnProtocol::kio_svnProtocol()" << endl; - - m_counter = 0; - - apr_initialize(); - // Make sure to properly initialize svn client, besides other things, this sets up - // NLS support for environments that don't use UTF-8 - svn_cmdline_init("kdevsvnd",NULL); - // CleanUP ctx preventing crash in svn_client_update and other - memset(&ctx, 0, sizeof(ctx)); - pool = svn_pool_create (NULL); - - svn_error_t *err = svn_client_create_context(&ctx, pool); - if ( err ) { - kdDebug(9036) << "kio_svnProtocol::kio_svnProtocol() create_context ERROR" << endl; - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - return; - } - - err = svn_config_ensure (NULL,pool); - if ( err ) { - kdDebug(9036) << "kio_svnProtocol::kio_svnProtocol() configensure ERROR" << endl; - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - return; - } - svn_config_get_config (&ctx->config, NULL, pool); - - ctx->log_msg_func = kio_svnProtocol::commitLogPrompt; - ctx->log_msg_baton = this; //pass this so that we can get a dcopClient from it - //TODO - ctx->cancel_func = NULL; - // progress notifications - ctx->progress_func = kio_svnProtocol::progressCallback; - ctx->progress_baton = this; - - apr_array_header_t *providers = apr_array_make(pool, 15, sizeof(svn_auth_provider_object_t *)); - - svn_auth_provider_object_t *provider; - - //disk cache - svn_client_get_simple_provider(&provider,pool); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; - svn_client_get_username_provider(&provider,pool); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; - - //interactive prompt - svn_client_get_simple_prompt_provider (&provider,kio_svnProtocol::checkAuth,this,2,pool); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; - //we always ask user+pass, no need for a user only question -/* svn_client_get_username_prompt_provider - * (&provider,kio_svnProtocol::checkAuth,this,2,pool); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider;*/ - - //SSL disk cache, keep that one, because it does nothing bad :) - svn_client_get_ssl_server_trust_file_provider (&provider, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - svn_client_get_ssl_client_cert_file_provider (&provider, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - svn_client_get_ssl_client_cert_pw_file_provider (&provider, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - - //SSL interactive prompt, where things get hard - svn_client_get_ssl_server_trust_prompt_provider (&provider, kio_svnProtocol::trustSSLPrompt, (void*)this, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - svn_client_get_ssl_client_cert_prompt_provider (&provider, kio_svnProtocol::clientCertSSLPrompt, (void*)this, 2, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - svn_client_get_ssl_client_cert_pw_prompt_provider (&provider, kio_svnProtocol::clientCertPasswdPrompt, (void*)this, 2, pool); - APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; - - svn_auth_open(&ctx->auth_baton, providers, pool); -} - -kio_svnProtocol::~kio_svnProtocol(){ - kdDebug(9036) << "kio_svnProtocol::~kio_svnProtocol()" << endl; - svn_pool_destroy(pool); - apr_terminate(); -} - -void kio_svnProtocol::initNotifier(bool is_checkout, bool is_export, bool suppress_final_line, apr_pool_t *spool) { - m_counter=0;//reset counter - ctx->notify_func = kio_svnProtocol::notify; - struct notify_baton *nb = ( struct notify_baton* )apr_palloc(spool, sizeof( struct notify_baton ) ); - nb->master = this; - nb->received_some_change = FALSE; - nb->sent_first_txdelta = FALSE; - nb->is_checkout = is_checkout; - nb->is_export = is_export; - nb->suppress_final_line = suppress_final_line; - nb->in_external = FALSE; - nb->had_print_error = FALSE; - nb->pool = svn_pool_create (spool); - - ctx->notify_baton = nb; -} - -svn_error_t* kio_svnProtocol::checkAuth(svn_auth_cred_simple_t **cred, void *baton, const char *realm, const char *username, svn_boolean_t may_save, apr_pool_t *pool) { - kdDebug(9036) << "kio_svnProtocol::checkAuth() " << endl; - kio_svnProtocol *p = ( kio_svnProtocol* )baton; - svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t*)apr_pcalloc (pool, sizeof (*ret)); - - p->info.keepPassword = true; - p->info.verifyPath=true; - kdDebug(9036 ) << "auth current URL : " << p->myURL.url() << endl; - p->info.url = p->myURL; - p->info.username = username; //( const char* )svn_auth_get_parameter( p->ctx->auth_baton, SVN_AUTH_PARAM_DEFAULT_USERNAME ); - if (realm) { - p->info.prompt = i18n("Username and Password for %1.").arg(realm); - } - -// if ( !p->checkCachedAuthentication( p->info ) ){ - p->openPassDlg( p->info ); -// } - ret->username = apr_pstrdup(pool, p->info.username.utf8()); - ret->password = apr_pstrdup(pool, p->info.password.utf8()); - if (may_save) ret->may_save = p->info.keepPassword; - *cred = ret; - return SVN_NO_ERROR; -} - -void kio_svnProtocol::recordCurrentURL(const KURL& url) { - myURL = url; -} - -//don't implement mimeType() until we don't need to download the whole file - -void kio_svnProtocol::get(const KURL& url ){ - kdDebug(9036) << "kio_svn::get(const KURL& url)" << endl ; - - TQString remoteServer = url.host(); - infoMessage(i18n("Looking for %1...").arg( remoteServer ) ); - - apr_pool_t *subpool = svn_pool_create (pool); - kbaton *bt = (kbaton*)apr_pcalloc(subpool, sizeof(*bt)); - bt->target_string = svn_stringbuf_create("", subpool); - bt->string_stream = svn_stream_create(bt,subpool); - svn_stream_set_write(bt->string_stream,write_to_string); - - TQString target = makeSvnURL( url ); - kdDebug(9036) << "SvnURL: " << target << endl; - recordCurrentURL( KURL( target ) ); - - //find the requested revision - svn_opt_revision_t rev; - svn_opt_revision_t endrev; - int idx = target.findRev( "?rev=" ); - if ( idx != -1 ) { - TQString revstr = target.mid( idx+5 ); -#if 0 - kdDebug(9036) << "revision string found " << revstr << endl; - if ( revstr == "HEAD" ) { - rev.kind = svn_opt_revision_head; - kdDebug(9036) << "revision searched : HEAD" << endl; - } else { - rev.kind = svn_opt_revision_number; - rev.value.number = revstr.toLong(); - kdDebug(9036) << "revision searched : " << rev.value.number << endl; - } -#endif - svn_opt_parse_revision( &rev, &endrev, revstr.utf8(), subpool ); - target = target.left( idx ); - kdDebug(9036) << "new target : " << target << endl; - } else { - kdDebug(9036) << "no revision given. searching HEAD " << endl; - rev.kind = svn_opt_revision_head; - } - initNotifier(false, false, false, subpool); - - svn_error_t *err = svn_client_cat (bt->string_stream, svn_path_canonicalize( target.utf8(),subpool ),&rev,ctx, subpool); - if ( err ) { - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - svn_pool_destroy( subpool ); - return; - } - - // Send the mimeType as soon as it is known - TQByteArray *cp = new TQByteArray(); - cp->setRawData( bt->target_string->data, bt->target_string->len ); - KMimeType::Ptr mt = KMimeType::findByContent(*cp); - kdDebug(9036) << "KMimeType returned : " << mt->name() << endl; - mimeType( mt->name() ); - - totalSize(bt->target_string->len); - - //send data - data(*cp); - - data(TQByteArray()); // empty array means we're done sending the data - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::stat(const KURL & url){ - kdDebug(9036) << "kio_svn::stat(const KURL& url) : " << url.url() << endl ; - - void *ra_baton, *session; - svn_ra_plugin_t *ra_lib; - svn_node_kind_t kind; - apr_pool_t *subpool = svn_pool_create (pool); - - TQString target = makeSvnURL( url); - kdDebug(9036) << "SvnURL: " << target << endl; - recordCurrentURL( KURL( target ) ); - - //find the requested revision - svn_opt_revision_t rev; - svn_opt_revision_t endrev; - int idx = target.findRev( "?rev=" ); - if ( idx != -1 ) { - TQString revstr = target.mid( idx+5 ); -#if 0 - kdDebug(9036) << "revision string found " << revstr << endl; - if ( revstr == "HEAD" ) { - rev.kind = svn_opt_revision_head; - kdDebug(9036) << "revision searched : HEAD" << endl; - } else { - rev.kind = svn_opt_revision_number; - rev.value.number = revstr.toLong(); - kdDebug(9036) << "revision searched : " << rev.value.number << endl; - } -#endif - svn_opt_parse_revision( &rev, &endrev, revstr.utf8( ), subpool ); - target = target.left( idx ); - kdDebug(9036) << "new target : " << target << endl; - } else { - kdDebug(9036) << "no revision given. searching HEAD " << endl; - rev.kind = svn_opt_revision_head; - } - - //init - svn_error_t *err = svn_ra_init_ra_libs(&ra_baton,subpool); - if ( err ) { - kdDebug(9036) << "init RA libs failed : " << err->message << endl; - return; - } - //find RA libs - err = svn_ra_get_ra_library(&ra_lib,ra_baton,svn_path_canonicalize( target.utf8(), subpool ),subpool); - if ( err ) { - kdDebug(9036) << "RA get libs failed : " << err->message << endl; - return; - } - kdDebug(9036) << "RA init completed" << endl; - - //start session - svn_ra_callbacks_t *cbtable = (svn_ra_callbacks_t*)apr_pcalloc(subpool, sizeof(*cbtable)); - kio_svn_callback_baton_t *callbackbt = (kio_svn_callback_baton_t*)apr_pcalloc(subpool, sizeof( *callbackbt )); - - cbtable->open_tmp_file = open_tmp_file; - cbtable->get_wc_prop = NULL; - cbtable->set_wc_prop = NULL; - cbtable->push_wc_prop = NULL; - cbtable->auth_baton = ctx->auth_baton; - - callbackbt->base_dir = target.utf8(); - callbackbt->pool = subpool; - callbackbt->config = ctx->config; - - err = ra_lib->open(&session,svn_path_canonicalize( target.utf8(), subpool ),cbtable,callbackbt,ctx->config,subpool); - if ( err ) { - kdDebug(9036)<< "Open session " << err->message << endl; - return; - } - kdDebug(9036) << "Session opened to " << target << endl; - //find number for HEAD - if (rev.kind == svn_opt_revision_head) { - err = ra_lib->get_latest_revnum(session,&rev.value.number,subpool); - if ( err ) { - kdDebug(9036)<< "Latest RevNum " << err->message << endl; - return; - } - kdDebug(9036) << "Got rev " << rev.value.number << endl; - } - - //get it - ra_lib->check_path(session,"",rev.value.number,&kind,subpool); - kdDebug(9036) << "Checked Path" << endl; - UDSEntry entry; - switch ( kind ) { - case svn_node_file: - kdDebug(9036) << "::stat result : file" << endl; - createUDSEntry(url.filename(),"",0,false,0,entry); - statEntry( entry ); - break; - case svn_node_dir: - kdDebug(9036) << "::stat result : directory" << endl; - createUDSEntry(url.filename(),"",0,true,0,entry); - statEntry( entry ); - break; - case svn_node_unknown: - case svn_node_none: - //error XXX - default: - kdDebug(9036) << "::stat result : UNKNOWN ==> WOW :)" << endl; - ; - } - finished(); - svn_pool_destroy( subpool ); -} - -void kio_svnProtocol::listDir(const KURL& url){ - kdDebug(9036) << "kio_svn::listDir(const KURL& url) : " << url.url() << endl ; - - apr_pool_t *subpool = svn_pool_create (pool); - apr_hash_t *dirents; - - TQString target = makeSvnURL( url); - kdDebug(9036) << "SvnURL: " << target << endl; - recordCurrentURL( KURL( target ) ); - - //find the requested revision - svn_opt_revision_t rev; - svn_opt_revision_t endrev; - int idx = target.findRev( "?rev=" ); - if ( idx != -1 ) { - TQString revstr = target.mid( idx+5 ); - svn_opt_parse_revision( &rev, &endrev, revstr.utf8(), subpool ); -#if 0 - kdDebug(9036) << "revision string found " << revstr << endl; - if ( revstr == "HEAD" ) { - rev.kind = svn_opt_revision_head; - kdDebug(9036) << "revision searched : HEAD" << endl; - } else { - rev.kind = svn_opt_revision_number; - rev.value.number = revstr.toLong(); - kdDebug(9036) << "revision searched : " << rev.value.number << endl; - } -#endif - target = target.left( idx ); - kdDebug(9036) << "new target : " << target << endl; - } else { - kdDebug(9036) << "no revision given. searching HEAD " << endl; - rev.kind = svn_opt_revision_head; - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_ls (&dirents, svn_path_canonicalize( target.utf8(), subpool ), &rev, false, ctx, subpool); - if ( err ) { - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - svn_pool_destroy( subpool ); - return; - } - - apr_array_header_t *array; - int i; - - array = svn_sort__hash (dirents, compare_items_as_paths, subpool); - - UDSEntry entry; - for (i = 0; i < array->nelts; ++i) { - entry.clear(); - const char *utf8_entryname, *native_entryname; - svn_dirent_t *dirent; - svn_sort__item_t *item; - - item = &APR_ARRAY_IDX (array, i, svn_sort__item_t); - - utf8_entryname = (const char*)item->key; - - dirent = (svn_dirent_t*)apr_hash_get (dirents, utf8_entryname, item->klen); - - svn_utf_cstring_from_utf8 (&native_entryname, utf8_entryname, subpool); - const char *native_author = NULL; - - //XXX BUGGY -/* apr_time_exp_t timexp; - apr_time_exp_lt(&timexp, dirent->time); - apr_os_exp_time_t *ostime; - apr_os_exp_time_get( &ostime, &timexp); - - time_t mtime = mktime( ostime );*/ - - if (dirent->last_author) - svn_utf_cstring_from_utf8 (&native_author, dirent->last_author, subpool); - - if ( createUDSEntry(TQString( native_entryname ), TQString( native_author ), dirent->size, - dirent->kind==svn_node_dir ? true : false, 0, entry) ) - listEntry( entry, false ); - } - listEntry( entry, true ); - - finished(); - svn_pool_destroy (subpool); -} - -bool kio_svnProtocol::createUDSEntry( const TQString& filename, const TQString& user, long long int size, bool isdir, time_t mtime, UDSEntry& entry) { - kdDebug(9036) << "MTime : " << ( long )mtime << endl; - kdDebug(9036) << "UDS filename : " << filename << endl; - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = filename; - entry.append( atom ); - - atom.m_uds = TDEIO::UDS_FILE_TYPE; - atom.m_long = isdir ? S_IFDIR : S_IFREG; - entry.append( atom ); - - atom.m_uds = TDEIO::UDS_SIZE; - atom.m_long = size; - entry.append( atom ); - - atom.m_uds = TDEIO::UDS_MODIFICATION_TIME; - atom.m_long = mtime; - entry.append( atom ); - - atom.m_uds = TDEIO::UDS_USER; - atom.m_str = user; - entry.append( atom ); - - return true; -} - -// not used, at least for KDevelop -// void kio_svnProtocol::copy(const KURL & src, const KURL& dest, int /*permissions*/, bool /*overwrite*/) { -// kdDebug(9036) << "kio_svnProtocol::copy() Source : " << src.url() << " Dest : " << dest.url() << endl; -// -// apr_pool_t *subpool = svn_pool_create (pool); -// svn_client_commit_info_t *commit_info = NULL; -// -// KURL nsrc = src; -// KURL ndest = dest; -// nsrc.setProtocol( chooseProtocol( src.protocol() ) ); -// ndest.setProtocol( chooseProtocol( dest.protocol() ) ); -// TQString srcsvn = nsrc.url(); -// TQString destsvn = ndest.url(); -// -// recordCurrentURL( nsrc ); -// -// //find the requested revision -// svn_opt_revision_t rev; -// int idx = srcsvn.findRev( "?rev=" ); -// if ( idx != -1 ) { -// TQString revstr = srcsvn.mid( idx+5 ); -// kdDebug(9036) << "revision string found " << revstr << endl; -// if ( revstr == "HEAD" ) { -// rev.kind = svn_opt_revision_head; -// kdDebug(9036) << "revision searched : HEAD" << endl; -// } else { -// rev.kind = svn_opt_revision_number; -// rev.value.number = revstr.toLong(); -// kdDebug(9036) << "revision searched : " << rev.value.number << endl; -// } -// srcsvn = srcsvn.left( idx ); -// kdDebug(9036) << "new src : " << srcsvn << endl; -// } else { -// kdDebug(9036) << "no revision given. searching HEAD " << endl; -// rev.kind = svn_opt_revision_head; -// } -// -// initNotifier(false, false, false, subpool); -// svn_error_t *err = svn_client_copy(&commit_info, srcsvn.utf8(), &rev, destsvn.utf8(), ctx, subpool); -// if ( err ) { -// error( TDEIO::ERR_SLAVE_DEFINED, err->message ); -// svn_pool_destroy (subpool); -// } -// -// finished(); -// svn_pool_destroy (subpool); -// } - -void kio_svnProtocol::mkdir( const KURL::List& list, int /*permissions*/ ) { - kdDebug(9036) << "kio_svnProtocol::mkdir(LIST) : " << list << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - - recordCurrentURL( list[ 0 ] ); - - apr_array_header_t *targets = apr_array_make(subpool, list.count()+1, sizeof(const char *)); - - KURL::List::const_iterator it = list.begin(), end = list.end(); - for ( ; it != end; ++it ) { - TQString cur = makeSvnURL( *it ); - kdDebug( 9036 ) << "kio_svnProtocol::mkdir raw url for subversion : " << cur << endl; - const char *_target = apr_pstrdup( subpool, svn_path_canonicalize( apr_pstrdup( subpool, cur.utf8() ), subpool ) ); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = _target; - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_mkdir(&commit_info,targets,ctx,subpool); - if ( err ) { - error( TDEIO::ERR_COULD_NOT_MKDIR, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::mkdir( const KURL& url, int /*permissions*/ ) { - kdDebug(9036) << "kio_svnProtocol::mkdir() : " << url.url() << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - - TQString target = makeSvnURL( url); - kdDebug(9036) << "SvnURL: " << target << endl; - recordCurrentURL( KURL( target ) ); - - apr_array_header_t *targets = apr_array_make(subpool, 2, sizeof(const char *)); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = apr_pstrdup( subpool, target.utf8() ); - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_mkdir(&commit_info,targets,ctx,subpool); - if ( err ) { - error( TDEIO::ERR_COULD_NOT_MKDIR, err->message ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::del( const KURL& url, bool /*isfile*/ ) { - kdDebug(9036) << "kio_svnProtocol::del() : " << url.url() << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - - TQString target = makeSvnURL(url); - kdDebug(9036) << "SvnURL: " << target << endl; - recordCurrentURL( KURL( target ) ); - - apr_array_header_t *targets = apr_array_make(subpool, 2, sizeof(const char *)); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = apr_pstrdup( subpool, target.utf8() ); - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_delete(&commit_info,targets,false/*force remove locally modified files in wc*/,ctx,subpool); - if ( err ) { - error( TDEIO::ERR_CANNOT_DELETE, err->message ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::rename(const KURL& src, const KURL& dest, bool /*overwrite*/) { - kdDebug(9036) << "kio_svnProtocol::rename() Source : " << src.url() << " Dest : " << dest.url() << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - - KURL nsrc = src; - KURL ndest = dest; - nsrc.setProtocol( chooseProtocol( src.protocol() ) ); - ndest.setProtocol( chooseProtocol( dest.protocol() ) ); - TQString srcsvn = nsrc.url(); - TQString destsvn = ndest.url(); - - recordCurrentURL( nsrc ); - - //find the requested revision - svn_opt_revision_t rev; - int idx = srcsvn.findRev( "?rev=" ); - if ( idx != -1 ) { - TQString revstr = srcsvn.mid( idx+5 ); - kdDebug(9036) << "revision string found " << revstr << endl; - if ( revstr == "HEAD" ) { - rev.kind = svn_opt_revision_head; - kdDebug(9036) << "revision searched : HEAD" << endl; - } else { - rev.kind = svn_opt_revision_number; - rev.value.number = revstr.toLong(); - kdDebug(9036) << "revision searched : " << rev.value.number << endl; - } - srcsvn = srcsvn.left( idx ); - kdDebug(9036) << "new src : " << srcsvn << endl; - } else { - kdDebug(9036) << "no revision given. searching HEAD " << endl; - rev.kind = svn_opt_revision_head; - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_move(&commit_info, srcsvn.utf8(), &rev, destsvn.utf8(), false/*force remove locally modified files in wc*/, ctx, subpool); - if ( err ) { - error( TDEIO::ERR_CANNOT_RENAME, err->message ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::special( const TQByteArray& data ) { -// kdDebug(9036) << "kio_svnProtocol::special" << endl; - - TQDataStream stream(data, IO_ReadOnly); - int tmp; - - stream >> tmp; - kdDebug(9036) << "kio_svnProtocol::special " << tmp << endl; - - switch ( tmp ) { - case SVN_CHECKOUT: - { - KURL repository, wc; - int revnumber; - TQString revkind; - stream >> repository; - stream >> wc; - stream >> revnumber; - stream >> revkind; - kdDebug(9036) << "kio_svnProtocol CHECKOUT from " << repository.url() << " to " << wc.url() << " at " << revnumber << " or " << revkind << endl; - checkout( repository, wc, revnumber, revkind ); - break; - } - case SVN_UPDATE: - { - KURL::List list; - int revnumber; - TQString revkind; - stream >> list; - stream >> revnumber; - stream >> revkind; - kdDebug(9036) << "kio_svnProtocol UPDATE " << endl; - update( list, revnumber, revkind ); - break; - } - case SVN_COMMIT: - { - KURL::List wclist; - while ( !stream.atEnd() ) { - KURL tmp; - stream >> tmp; - wclist << tmp; - } - kdDebug(9036) << "kio_svnProtocol COMMIT" << endl; - commit( wclist ); - break; - } - case SVN_COMMIT_2: - { - bool recurse, keeplocks; - KURL::List wclist; - stream >> recurse; - stream >> keeplocks; - while ( !stream.atEnd() ) { - KURL tmp; - stream >> tmp; - wclist << tmp; - } - kdDebug(9036) << "kio_svnProtocol COMMIT2" << endl; - commit2( recurse, keeplocks, wclist ); - break; - } - case SVN_LOG: - { - kdDebug(9036) << "kio_svnProtocol LOG" << endl; - int revstart, revend; - TQString revkindstart, revkindend; - bool discorverChangedPath, strictNodeHistory; - KURL::List targets; - - stream >> revstart; - stream >> revkindstart; - stream >> revend; - stream >> revkindend; - stream >> discorverChangedPath; - stream >> strictNodeHistory; - while ( !stream.atEnd() ) { - KURL tmp; - stream >> tmp; - targets << tmp; - } - svn_log( revstart, revkindstart, revend, revkindend, - discorverChangedPath, strictNodeHistory, targets ); - break; - } - case SVN_IMPORT: - { - KURL wc,repos; - stream >> repos; - stream >> wc; - kdDebug(9036) << "kio_svnProtocol IMPORT" << endl; - import(repos,wc); - break; - } - case SVN_ADD: - { - KURL::List wcList; - stream >> wcList; - kdDebug(9036) << "kio_svnProtocol ADD" << endl; - add(wcList); - break; - } - case SVN_DEL: - { - KURL::List wclist; - stream >> wclist; - kdDebug(9036) << "kio_svnProtocol DEL" << endl; - wc_delete(wclist); - break; - } - case SVN_REVERT: - { - KURL::List wclist; - stream >> wclist; - kdDebug(9036) << "kio_svnProtocol REVERT" << endl; - wc_revert(wclist); - break; - } - case SVN_STATUS: - { - KURL wc; - bool checkRepos=false; - bool fullRecurse=false; - stream >> wc; - stream >> checkRepos; - stream >> fullRecurse; - wc_status(wc,checkRepos,fullRecurse); - break; - } - case SVN_STATUS_2: - { - KURL wc; - TQString revkind; - int revnumber; - bool checkRepos, fullRecurse, getAll, noIgnore; - stream >> checkRepos; - stream >> fullRecurse; - stream >> getAll; - stream >> noIgnore; - stream >> revnumber; - stream >> revkind; - stream >> wc; - wc_status2(wc,checkRepos,fullRecurse, getAll, noIgnore, revnumber, revkind); - break; - } - case SVN_MKDIR: - { - KURL::List list; - stream >> list; - kdDebug(9036) << "kio_svnProtocol MKDIR" << endl; - mkdir(list,0); - break; - } - case SVN_RESOLVE: - { - KURL url; - bool recurse; - stream >> url; - stream >> recurse; - kdDebug(9036) << "kio_svnProtocol RESOLVE" << endl; - wc_resolve(url,recurse); - break; - } - case SVN_SWITCH: - { - KURL wc,url; - bool recurse; - int revnumber; - TQString revkind; - stream >> wc; - stream >> url; - stream >> recurse; - stream >> revnumber; - stream >> revkind; - kdDebug(9036) << "kio_svnProtocol SWITCH" << endl; - svn_switch(wc,url,revnumber,revkind,recurse); - break; - } - case SVN_SWITCH_RELOCATE: - { - KURL wc, origUrl, newUrl; - bool recurse; - stream >> wc; - stream >> origUrl; - stream >> newUrl; - stream >> recurse; - svn_switch_relocate( wc, origUrl, newUrl, recurse ); - break; - } - case SVN_DIFF: - { - KURL url1,url2; - int rev1, rev2; - bool recurse, pegdiff; - TQString revkind1, revkind2; - stream >> url1; - stream >> url2; - stream >> rev1; - stream >> revkind1; - stream >> rev2; - stream >> revkind2; - stream >> recurse >> pegdiff; - kdDebug(9036) << "kio_svnProtocol DIFF" << endl; - svn_diff(url1,url2,rev1,rev2,revkind1,revkind2,recurse,pegdiff); - break; - } - case SVN_BLAME: - { - KURL url; - int urlMode; - int pegRev, startRev, endRev; - TQString pegRevKind, startRevKind, endRevKind; - stream >> url; - stream >> urlMode; -// stream >> pegRev; -// stream >> pegRevKind; - stream >> startRev; - stream >> startRevKind; - stream >> endRev; - stream >> endRevKind; - - blame(url, (UrlMode)urlMode, startRev, startRevKind, endRev, endRevKind); - break; - } - case SVN_INFO: - { - KURL pathOrUrl; - int pegRev, rev; - TQString pegRevKind, revKind; - bool recurse = false; - stream >> pathOrUrl; - stream >> pegRev; - stream >> pegRevKind; - stream >> rev; - stream >> revKind; - stream >> recurse; - svn_info( pathOrUrl, pegRev, pegRevKind, rev, revKind, recurse ); - break; - } - case SVN_COPY: - { - KURL src, dest; - int srcRev; - TQString srcRevKind; - stream >> src; - stream >> srcRev; - stream >> srcRevKind; - stream >> dest; - svn_copy( src, srcRev, srcRevKind, dest ); - break; - } - case SVN_MERGE: - { - KURL src1, src2, wc_target; - int rev1, rev2; - TQString revKind1, revKind2; - bool recurse, ignore_ancestry, force, dry_run; - stream >> src1 >> rev1 >> revKind1; - stream >> src2 >> rev2 >> revKind2; - stream >> wc_target; - stream >> recurse >> ignore_ancestry >> force >> dry_run; - svn_merge( src1, rev1, revKind1, src2, rev2, revKind2, wc_target, - recurse, ignore_ancestry, force, dry_run ); - break; - } - default: - { - kdDebug(9036) << "kio_svnProtocol DEFAULT" << endl; - break; - } - } -} -/** - * not used anywhere, anymore -*/ -void kio_svnProtocol::popupMessage( const TQString& message ) { -// TQByteArray params; -// TQDataStream stream(params, IO_WriteOnly); -// stream << message; -// -// if ( !dcopClient()->send( "kded","ksvnd","popupMessage(TQString)", params ) ) -// kdWarning() << "Communication with KDED:KSvnd failed" << endl; -} - -void kio_svnProtocol::blame( KURL url, UrlMode /*mode*/,/* int pegRev, TQString pegRevKind,*/ int startRev, TQString startRevKind, int endRev, TQString endRevKind ) -{ - kdDebug(9036) << " __TIME__ " << __TIME__ << endl; -// kdDebug(9036) << " PegRev " << pegRev << pegRevKind << endl; - kdDebug(9036) << " StartRev" << startRev << startRevKind << endl; - kdDebug(9036) << " EndRev" << endRev << endRevKind << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - const char* path_or_url = apr_pstrdup( subpool, url.pathOrURL().utf8() );; - - svn_opt_revision_t rev1 = createRevision( startRev, startRevKind, subpool ); - svn_opt_revision_t rev2 = createRevision( endRev, endRevKind, subpool ); -// svn_opt_revision_t revPeg = createRevision( pegRev, pegRevKind, subpool ); - - //initNotifier(false, false, false, subpool); - svn_client_blame_receiver_t receiver = kio_svnProtocol::blameReceiver; - svn_error_t *err = svn_client_blame( path_or_url, &rev1, &rev2, receiver, (void*)this, ctx, subpool ); - if ( err ) - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - finished(); - svn_pool_destroy (subpool); - -} - -svn_error_t* kio_svnProtocol::blameReceiver( void *baton, apr_int64_t line_no, svn_revnum_t rev, const char *author, const char *date, const char *line, apr_pool_t *pool ) -{ - kio_svnProtocol *p = (kio_svnProtocol*)baton; - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "LINE", TQString::number(line_no) ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REV", TQString::number(rev) ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "AUTHOR", author ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "DATE", date ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "CONTENT", TQString::fromLocal8Bit(line) ); - - p->incCounter(); - return SVN_NO_ERROR; -} - -/** - KDevelop has no way to retrieve URL of working copy. - Thus retreiving URL from WC should be done here, using subversion native API. - Thus, svn_log should get another flag (bool repositHistory )specifying between file:/// or URL -*/ -void kio_svnProtocol::svn_log( int revstart, const TQString& revkindstart, int revend, const TQString& revkindend, - bool discorverChangedPaths, bool strictNodeHistory, - const KURL::List& urls ) -{ -// kdDebug(9036) << " from revision " << revstart << " or " << revkindstart << " to " << " revision " << revend << " or " << revkindend << endl; - kdDebug(9036) << " __TIME__ " << __TIME__ << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - - // TODO HEAD:1 was removed from SVN API 1.2, instead callers should specify HEAD:0 - svn_opt_revision_t rev1 = createRevision( revstart, revkindstart, subpool ); - svn_opt_revision_t rev2 = createRevision( revend, revkindend, subpool ); - - m_counter = 0; - apr_array_header_t *targets = apr_array_make(subpool, 1+urls.count(), sizeof(const char *)); - - for ( TQValueListConstIterator it = urls.begin(); it != urls.end() ; ++it ) { - KURL nurl = *it; - const char *path = - apr_pstrdup( subpool, svn_path_canonicalize( nurl.pathOrURL().utf8(), subpool ) ); - kdDebug(9036) << path << endl; - *(( const char ** )apr_array_push(( apr_array_header_t* )targets)) = path; - - setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "requrl", nurl.pathOrURL() ); - incCounter(); - } - - svn_log_message_receiver_t receiver = kio_svnProtocol::receiveLogMessage; - svn_error_t *err = svn_client_log2(targets, &rev1, &rev2, 0, discorverChangedPaths, strictNodeHistory, receiver, this, ctx, subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -// save for one revision -svn_error_t* kio_svnProtocol::receiveLogMessage(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, - const char *author, const char *date, const char *message, apr_pool_t *pool ) -{ - kio_svnProtocol *p = (kio_svnProtocol*)baton; - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number(revision) ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "author", author ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "date", date ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "logmsg", TQString::fromLocal8Bit(message) ); - if( changed_paths != NULL ){ - TQString pathlist; - void *onePath; - const char *pathkey; - apr_hash_index_t *hi; - for (hi = apr_hash_first(pool, changed_paths); hi; hi = apr_hash_next(hi)) { - apr_hash_this(hi, (const void**) &pathkey, NULL, &onePath); - svn_log_changed_path_t *cp = (svn_log_changed_path_t*)onePath; - kdDebug(9036) << "OnePath: " << cp->copyfrom_path << " and key: " << pathkey << endl; - pathlist += cp->action; - pathlist += " "; -// pathlist += cp->copyfrom_path; - pathlist += pathkey; - pathlist += "\n"; - } - kdDebug(9036) << "pathlist: " << pathlist <setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "pathlist", pathlist ); - } - p->incCounter(); - return SVN_NO_ERROR; -} - -svn_opt_revision_t kio_svnProtocol::createRevision( int revision, const TQString& revkind, apr_pool_t *pool ) { - svn_opt_revision_t result;//,endrev; - // TODO support svn_opt_revision_date - if ( revision != -1 ) { - result.value.number = revision; - result.kind = svn_opt_revision_number; - } else if ( revkind == "WORKING" ) { - result.kind = svn_opt_revision_working; - } else if ( revkind == "BASE" ) { - result.kind = svn_opt_revision_base; - } else if ( revkind == "HEAD" ) { - result.kind = svn_opt_revision_head; - } else if ( revkind == "COMMITTED" ) { - result.kind = svn_opt_revision_committed; - } else if ( revkind == "PREV" ) { - result.kind = svn_opt_revision_previous; - } -// } else if ( !revkind.isNull() ) { -// svn_opt_parse_revision(&result,&endrev,revkind.utf8(),pool); - else if ( revkind == "UNSPECIFIED" ){ - result.kind = svn_opt_revision_unspecified; - } - else { - result.kind = svn_opt_revision_unspecified; - } - return result; -} - -void kio_svnProtocol::svn_diff(const KURL & url1, const KURL& url2,int rev1, int rev2,const TQString& revkind1,const TQString& revkind2,bool recurse, bool pegdiff ) -{ - kdDebug(9036) << "kio_svn::diff : " << url1.path() << " at revision " << rev1 << " or " << revkind1 << " with " - << url2.path() << " at revision " << rev2 << " or " << revkind2 - << endl ; - - apr_pool_t *subpool = svn_pool_create (pool); - apr_array_header_t *options = svn_cstring_split( "", "\t\r\n", TRUE, subpool ); - -// KURL nurl1 = url1; -// KURL nurl2 = url2; -// nurl1.setProtocol( chooseProtocol( url1.protocol() ) ); //svn+https -> https for eg -// nurl2.setProtocol( chooseProtocol( url2.protocol() ) ); -// recordCurrentURL( nurl1 ); -// TQString source = makeSvnURL( nurl1 ); -// TQString target = makeSvnURL( nurl2 ); - -// const char *path1 = svn_path_canonicalize( apr_pstrdup( subpool, source.utf8() ), subpool ); -// const char *path2 = svn_path_canonicalize( apr_pstrdup( subpool, target.utf8() ), subpool ); - - //remove file:/// so we can diff for working copies, needs a better check (so we support URL for file:/// _repositories_ ) -// if ( nurl1.protocol() == "file" ) { -// path1 = svn_path_canonicalize( apr_pstrdup( subpool, nurl1.path().utf8() ), subpool ); -// } -// if ( nurl2.protocol() == "file" ) { -// path2 = svn_path_canonicalize( apr_pstrdup( subpool, nurl2.path().utf8() ), subpool ); -// } - - // all the commentted codes above are redundancy. url1/url2 is only file:// , svn:// or https:// - // svn+https etc. are not handed out here. - const char *path1 = apr_pstrdup( subpool, url1.pathOrURL().utf8() ); - const char *path2 = apr_pstrdup( subpool, url2.pathOrURL().utf8() );; - - kdDebug( 9036 ) << "1 : " << path1 << " 2: " << path2 << endl; - - svn_opt_revision_t revision1,revision2; - revision1 = createRevision(rev1, revkind1, subpool); - revision2 = createRevision(rev2, revkind2, subpool); - - char *templ; - templ = apr_pstrdup ( subpool, "/tmp/tmpfile_XXXXXX" ); - apr_file_t *outfile = NULL; - apr_file_mktemp( &outfile, templ , APR_READ|APR_WRITE|APR_CREATE|APR_TRUNCATE, subpool ); - - initNotifier(false, false, false, subpool); - svn_error_t *err = 0; - if( pegdiff ){ - svn_opt_revision_t peg_rev = createRevision(-1, "BASE", subpool ); - err = svn_client_diff_peg( options, path1, &peg_rev, &revision1, &revision2, - recurse, false, false, outfile, NULL, ctx, subpool ); - } else{ - err = svn_client_diff( options, path1, &revision1, path2, &revision2, recurse, - false, false, outfile, NULL, ctx, subpool ); - } - - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - //read the content of the outfile now - TQStringList tmp; - apr_file_close(outfile); - TQFile file(templ); - if ( file.open( IO_ReadOnly ) ) { - TQTextStream stream( &file ); - TQString line; - while ( !stream.atEnd() ) { - line = stream.readLine(); - tmp << line; - } - file.close(); - } - for ( TQStringList::Iterator itt = tmp.begin(); itt != tmp.end(); itt++ ) { - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "diffresult", ( *itt ) ); - m_counter++; - } - //delete temp file - file.remove(); - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::svn_switch( const KURL& wc, const KURL& repos, int revnumber, const TQString& revkind, bool recurse) { - kdDebug(9036) << "kio_svn::switch : " << wc.path() << " at revision " << revnumber << " or " << revkind << endl ; - - apr_pool_t *subpool = svn_pool_create (pool); - - KURL nurl = repos; - KURL dest = wc; - nurl.setProtocol( chooseProtocol( repos.protocol() ) ); - dest.setProtocol( "file" ); -// recordCurrentURL( nurl ); -// TQString source = dest.path(); -// TQString target = makeSvnURL( repos ); - - const char *path = svn_path_canonicalize( apr_pstrdup( subpool, dest.path().utf8() ), subpool ); - const char *url = svn_path_canonicalize( apr_pstrdup( subpool, nurl.url().utf8() ), subpool ); - kdDebug(9036) << " WC path: " << path << " Repository URL: " << url << endl; - - svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_switch (NULL/*result revision*/, path, url, &rev, recurse, ctx, subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::svn_switch_relocate( const KURL &wc, const KURL &origUrl, const KURL &newUrl, - bool recurse ) -{ - apr_pool_t *subpool = svn_pool_create( pool ); - - const char *wcPath = svn_path_canonicalize( apr_pstrdup( subpool, wc.path().utf8() ), subpool ); - const char *fromUrl = apr_pstrdup( subpool, origUrl.url().utf8() ); - const char *toUrl = apr_pstrdup( subpool, newUrl.url().utf8() ); - kdDebug(9036) << " WC path: " << wcPath << " from: " << fromUrl << " to: " << toUrl << endl; - - svn_error_t *err = svn_client_relocate( wcPath, fromUrl, toUrl, recurse, ctx, pool ); - - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); - svn_pool_destroy (subpool); - return; - } - m_counter = 0L; - setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", - TQString("switched to %1").arg( toUrl ) ); - finished(); - svn_pool_destroy( subpool ); -} - -void kio_svnProtocol::update( const KURL::List &list, int revnumber, const TQString& revkind ) { - kdDebug(9036) << "kio_svn::update : __TIME__" << __TIME__ << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - - apr_array_header_t *targets = apr_array_make(subpool, 1+list.count(), sizeof(const char *)); - svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); - - for( TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it ){ - KURL nurl = *it; - *( const char ** )apr_array_push(targets) = svn_path_canonicalize( nurl.path().utf8(), subpool ); - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_update2( NULL, targets, &rev, - true/*recurse*/, false/*ignore_external*/, - ctx, subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::import( const KURL& repos, const KURL& wc ) { - kdDebug(9036) << "kio_svnProtocol::import() : " << wc.url() << " into " << repos.url() << endl; - - apr_pool_t *subpool = svn_pool_create (pool); -// svn_client_commit_info_t *commit_info = -// (svn_client_commit_info_t*) apr_palloc( subpool, sizeof(svn_client_commit_info_t) ); - svn_commit_info_t *commit_info = svn_create_commit_info( subpool ); - bool nonrecursive = false; - - const char *path = apr_pstrdup( subpool, svn_path_canonicalize( wc.path().utf8(), subpool ) ); - const char *url = apr_pstrdup( subpool, svn_path_canonicalize( repos.url().utf8(), subpool ) ); - - initNotifier(false, false, false, subpool); - kdDebug(9036) << " Executing import: " << path << " to " << url << endl; - - svn_error_t *err = svn_client_import2(&commit_info, path, url, nonrecursive, false, ctx, subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - svn_pool_destroy (subpool); - finished(); -} - -void kio_svnProtocol::checkout( const KURL& repos, const KURL& wc, int revnumber, const TQString& revkind ) { - kdDebug(9036) << "kio_svn::checkout : " << repos.url() << " into " << wc.path() << " at revision " << revnumber << " or " << revkind << endl ; - - apr_pool_t *subpool = svn_pool_create (pool); - KURL nurl = repos; - KURL dest = wc; - nurl.setProtocol( chooseProtocol( repos.protocol() ) ); - dest.setProtocol( "file" ); - TQString target = makeSvnURL( repos ); - recordCurrentURL( nurl ); - TQString dpath = dest.path(); - - //find the requested revision - svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); - - initNotifier(true, false, false, subpool); - svn_error_t *err = svn_client_checkout (NULL/* rev actually checkedout */, svn_path_canonicalize( target.utf8(), subpool ), svn_path_canonicalize ( dpath.utf8(), subpool ), &rev, true, ctx, subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::commit(const KURL::List& wc) -{ - commit2(true, true, wc); -} - -void kio_svnProtocol::commit2(bool recurse, bool keeplocks, const KURL::List& wc) { - kdDebug(9036) << "kio_svnProtocol::commit2() : " << wc << endl; - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - - apr_array_header_t *targets = apr_array_make(subpool, 1+wc.count(), sizeof(const char *)); - - for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { - KURL nurl = *it; - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); - } - - initNotifier(false, false, false, subpool); - kdDebug(9036) << "recurse: " << recurse << " keeplocks: " << keeplocks <apr_err, errbuf, 512); - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) + "\n: " + TQString::fromLocal8Bit(errbuf) ); - svn_pool_destroy (subpool); - return; - } - - if ( commit_info ) { - for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { - KURL nurl = *it; - nurl.setProtocol( "file" ); - - TQString userstring = i18n ( "Nothing to commit." ); - if ( SVN_IS_VALID_REVNUM( commit_info->revision ) ) - userstring = i18n( "Committed revision %1." ).arg(commit_info->revision); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "path", nurl.path() ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "action", "0" ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "kind", "0" ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "mime_t", "" ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "content", "0" ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "prop", "0" ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "rev" , TQString::number( commit_info->revision ) ); - setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "string", userstring ); - m_counter++; - } - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::add(const KURL::List& list) { - kdDebug(9036) << "kio_svnProtocol::add() __TIME__" << __TIME__ << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - bool nonrecursive = false; - initNotifier(false, false, false, subpool); - - svn_error_t *err = NULL; - for( TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it ){ - - KURL nurl = (*it); - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - kdDebug(9036) << " Schedule to Add: " << nurl.path().utf8() << endl; - err = svn_client_add( svn_path_canonicalize( nurl.path().utf8(), subpool ), - nonrecursive, ctx, subpool); - if( err ) break; - } - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::wc_delete(const KURL::List& wc) { - kdDebug(9036) << "kio_svnProtocol::wc_delete() : " << wc << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_client_commit_info_t *commit_info = NULL; - bool force = false; - - apr_array_header_t *targets = apr_array_make(subpool, 1+wc.count(), sizeof(const char *)); - - for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { - KURL nurl = *it; - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_delete(&commit_info,targets,force,ctx,subpool); - - if ( err ) - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::wc_revert(const KURL::List& wc) { - kdDebug(9036) << "kio_svnProtocol::revert() : " << wc << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - bool nonrecursive = false; - - apr_array_header_t *targets = apr_array_make(subpool, 1 + wc.count(), sizeof(const char *)); - - for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { - KURL nurl = *it; - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); - } - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_revert(targets,nonrecursive,ctx,subpool); - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::wc_status(const KURL& wc, bool checkRepos, bool fullRecurse, bool getAll, int revnumber, const TQString& revkind) { - kdDebug(9036) << "kio_svnProtocol::wc_status() : " << wc.url() << " checkRepos " << checkRepos << " fullRecurse " << fullRecurse << " getAll " << getAll << endl; - - wc_status2( wc, checkRepos, fullRecurse, getAll, false, revnumber, revkind ); -} - -void kio_svnProtocol::wc_status2(const KURL& wc, bool checkRepos, bool fullRecurse, bool getAll, bool noIgnore, int revnumber, const TQString& revkind) { - kdDebug(9036) << "kio_svnProtocol::wc_status2() : " << wc.url() << " checkRepos " << checkRepos << " fullRecurse " << fullRecurse << " getAll " << getAll << " noIgnore " << noIgnore << " revnumber " << revnumber << " revkind " << revkind << endl; - kdDebug(9036) << " __TIME__ " << __TIME__ << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_revnum_t result_rev; - - KURL nurl = wc; - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - - svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); - - initNotifier(false, false, false, subpool); - - svn_error_t *err = svn_client_status(&result_rev, svn_path_canonicalize( nurl.path().utf8(), subpool ), &rev, kio_svnProtocol::status, this, fullRecurse, getAll, checkRepos, noIgnore, ctx, subpool); - - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::svn_info( KURL pathOrUrl, int pegRev, TQString pegRevKind, int rev, TQString revKind, bool recurse ) -{ - kdDebug(9036) << " kio_svnProtocol::svn_info(): pegRev " << pegRev << " pegKind " << pegRevKind << " rev " << rev << " revKind " << revKind << " recurse " << recurse << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - svn_opt_revision_t peg_rev = createRevision( pegRev, pegRevKind, subpool ); - svn_opt_revision_t revision = createRevision( rev, revKind, subpool ); - - svn_error_t *err = svn_client_info( pathOrUrl.pathOrURL().utf8(), - &peg_rev, &revision, - kio_svnProtocol::infoReceiver, - this, - recurse, - ctx, pool ); - - if ( err ){ - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); - svn_pool_destroy (subpool); - return; - } - svn_pool_destroy( subpool ); - finished(); -} - -svn_error_t* kio_svnProtocol::infoReceiver( void *baton, const char *path, - const svn_info_t *info, apr_pool_t *pool) -{ - kio_svnProtocol *p= (kio_svnProtocol*)baton ; - if( !p ) - return SVN_NO_ERROR; - - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "PATH", TQString::fromUtf8( path )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "URL", TQString( info->URL ) ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REV", TQString::number( info->rev )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "KIND", TQString::number( info->kind )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REPOS_ROOT_URL", TQString( info->repos_root_URL ) ); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REPOS_UUID", TQString(info->repos_UUID) ); - p->incCounter(); - - return SVN_NO_ERROR; -} - -void kio_svnProtocol::svn_copy( const KURL &srcUrl, int srcRev, const TQString &srcRevKind, - const KURL &destUrl ) -{ - kdDebug(9036) << " kio: svn_copy src: " << srcUrl << " Dest Url: " << destUrl << " revnum: " << srcRev << " revKind: " << srcRevKind << endl; - apr_pool_t *subpool = svn_pool_create (pool); - svn_commit_info_t *commit_info = svn_create_commit_info( subpool ); - - svn_opt_revision_t rev = createRevision( srcRev, srcRevKind, subpool ); - - // TODO more elegant notification mechanism - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_copy2( &commit_info, - srcUrl.pathOrURL().utf8(), &rev, - destUrl.pathOrURL().utf8(), - ctx, subpool); - - if ( err ) { - apr_status_t errcode = err->apr_err; - char buf[512]; - svn_strerror(errcode, buf, 512); - error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(buf) ); - svn_pool_destroy (subpool); - return; - } - - if( commit_info ){ - setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", - i18n("Copied Revision %1").arg( commit_info->revision) ); - } else { - setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", - i18n("Copied") ); - } - - finished(); - svn_pool_destroy (subpool); -} - -void kio_svnProtocol::svn_merge(const KURL &src1, int revNum1, TQString revKind1, - const KURL &src2, int revNum2, TQString revKind2, - const KURL &target_wc, - bool recurse, bool ignore_ancestry, bool force, bool dry_run ) -{ - kdDebug(9036) << " TDEIO::svn_merge src1 " << src1.pathOrURL().utf8() << " src2 " << src2.pathOrURL().utf8() << " target " << target_wc.pathOrURL().utf8() << endl; - apr_pool_t *subpool = svn_pool_create( pool ); - - svn_opt_revision_t rev1 = createRevision( revNum1, revKind1, subpool ); - svn_opt_revision_t rev2 = createRevision( revNum2, revKind2, subpool ); - - initNotifier( false, false, false, subpool ); - svn_error_t *err = svn_client_merge( src1.pathOrURL().utf8(), &rev1, - src2.pathOrURL().utf8(), &rev2, - target_wc.pathOrURL().utf8(), - recurse, ignore_ancestry, force, dry_run, - ctx, pool ); - if ( err ) { - apr_status_t errcode = err->apr_err; - char buf[512]; - svn_strerror(errcode, buf, 512); - error( TDEIO::ERR_SLAVE_DEFINED, - TQString::fromLocal8Bit(err->message) + "\n "+ TQString::fromLocal8Bit(buf) ); - svn_pool_destroy (subpool); - return; - } - - finished(); - svn_pool_destroy( subpool ); -} - -//change the proto and remove trailing / -//remove double / also -TQString kio_svnProtocol::makeSvnURL ( const KURL& url ) const { - TQString kproto = url.protocol(); - KURL tpURL = url; - tpURL.cleanPath( true ); - TQString svnUrl; - if ( kproto == "kdevsvn+http" ) { - kdDebug(9036) << "http:/ " << url.url() << endl; - tpURL.setProtocol("http"); - svnUrl = tpURL.url(-1); - return svnUrl; - } - else if ( kproto == "kdevsvn+https" ) { - kdDebug(9036) << "https:/ " << url.url() << endl; - tpURL.setProtocol("https"); - svnUrl = tpURL.url(-1); - return svnUrl; - } - else if ( kproto == "kdevsvn+ssh" ) { - kdDebug(9036) << "svn+ssh:/ " << url.url() << endl; - tpURL.setProtocol("svn+ssh"); - svnUrl = tpURL.url(-1); - return svnUrl; - } - else if ( kproto == "kdevsvn+svn" ) { - kdDebug(9036) << "svn:/ " << url.url() << endl; - tpURL.setProtocol("svn"); - svnUrl = tpURL.url(-1); - return svnUrl; - } - else if ( kproto == "kdevsvn+file" ) { - kdDebug(9036) << "file:/ " << url.url() << endl; - tpURL.setProtocol("file"); - svnUrl = tpURL.url(-1); - //hack : add one more / after file:/ - int idx = svnUrl.find("/"); - svnUrl.insert( idx, "//" ); - return svnUrl; - } - return tpURL.url(-1); -} - -TQString kio_svnProtocol::chooseProtocol ( const TQString& kproto ) const { - if ( kproto == "svn+http" ) return TQString( "http" ); - else if ( kproto == "svn+https" ) return TQString( "https" ); - else if ( kproto == "svn+ssh" ) return TQString( "svn+ssh" ); - else if ( kproto == "svn" ) return TQString( "svn" ); - else if ( kproto == "svn+file" ) return TQString( "file" ); - return kproto; -} -/** Certificate is not yet valid. */ -#define SVN_AUTH_SSL_NOTYETVALID 0x00000001 -/** Certificate has expired. */ -#define SVN_AUTH_SSL_EXPIRED 0x00000002 -/** Certificate's CN (hostname) does not match the remote hostname. */ -#define SVN_AUTH_SSL_CNMISMATCH 0x00000004 -/** @brief Certificate authority is unknown (i.e. not trusted) */ -#define SVN_AUTH_SSL_UNKNOWNCA 0x00000008 -/** @brief Other failure. This can happen if neon has introduced a new - * failure bit that we do not handle yet. */ -#define SVN_AUTH_SSL_OTHER 0x40000000 -svn_error_t *kio_svnProtocol::trustSSLPrompt(svn_auth_cred_ssl_server_trust_t **cred_p, void *baton, const char *realm, apr_uint32_t failures, const svn_auth_ssl_server_cert_info_t *ci, svn_boolean_t may_save, apr_pool_t *pool) -{ - kio_svnProtocol *p = (kio_svnProtocol*)baton; - // prepare params. - TQByteArray params, replyData; - TQCString replyType; - TQDataStream arg(params, IO_WriteOnly); - - arg << i18n( "The certificate from the server could not be trusted automatically. Do you want to trust this certificate? " ); - arg << TQString::fromLocal8Bit(ci->hostname); - arg << TQString::fromLocal8Bit(ci->fingerprint); - arg << TQString::fromLocal8Bit(ci->valid_from) << TQString::fromLocal8Bit(ci->valid_until); - arg << TQString::fromLocal8Bit(ci->issuer_dname) << TQString::fromLocal8Bit(ci->ascii_cert) ; - // call dcop - int ret = p->dcopClient()->call( "kded", "kdevsvnd", - "sslServerTrustPrompt(TQString, TQString, TQString, TQString, TQString, TQString, TQString)", - params, replyType, replyData ); - if (!ret){ - kdWarning() << " failed to prompt SSL_Server_Trust_Prompt " << endl; - return SVN_NO_ERROR; - } - if (replyType != "int"){ - kdWarning() << " abnormal reply type " << endl; - return SVN_NO_ERROR; - } - int resultCode; - TQDataStream replyStream( replyData, IO_ReadOnly ); - replyStream >> resultCode; - - if( resultCode == -1 ){ - kdWarning() << " SSL server trust rejected " << endl; - *cred_p = 0L; //FIXME when rejected, maybe more elegant methods.. - } else if( resultCode == 0 ){ //accept once - *cred_p = (svn_auth_cred_ssl_server_trust_t*)apr_pcalloc (pool, sizeof (svn_auth_cred_ssl_server_trust_t)); - kdDebug(9036) << " accept once " << endl; - (*cred_p)->may_save = false; - (*cred_p)->accepted_failures = 0; - } else if( resultCode == 1 ){ //accept permanently - *cred_p = (svn_auth_cred_ssl_server_trust_t*)apr_pcalloc (pool, sizeof (svn_auth_cred_ssl_server_trust_t)); - kdDebug(9036) << " accept permanently " << endl; - (*cred_p)->may_save = true; - (*cred_p)->accepted_failures = failures; - } else{ - kdWarning() << " SSL server trust failed for some reason" << endl; - *cred_p = 0L; - } - - return SVN_NO_ERROR; -} -/** TODO fully implemented, but there is no way to test this yet.*/ -svn_error_t *kio_svnProtocol::clientCertSSLPrompt( - svn_auth_cred_ssl_client_cert_t **cred_p, void *baton, const char *realm, svn_boolean_t may_save, apr_pool_t *pool) -{ - kdDebug(9036) << " clientCertSSLPrompt " << endl; -// kio_svnProtocol *p = (kio_svnProtocol*)baton; -// TQByteArray reply; -// TQByteArray params; -// TQCString replyType; -// call dcop -// if (!p->dcopClient()->call("kded","kdevsvnd", "sslCertFile()",params,replyType,reply)) { -// kdWarning()<<" Communication with dcop failed - fail to get certfile "<> fileName; -// allocate memory -// *cred_p = (svn_auth_cred_ssl_client_cert_t*) apr_palloc (pool, sizeof(svn_auth_cred_ssl_client_cert_t)); -// (*cred_p)->cert_file = apr_pstrdup( pool, fileName.utf8() ); -// (*cred_p)->may_save = may_save; - return SVN_NO_ERROR; -} - -/** TODO fully implemented, but there is no way to test this yet.*/ -svn_error_t *kio_svnProtocol::clientCertPasswdPrompt( - svn_auth_cred_ssl_client_cert_pw_t **cred_p, void *baton, const char *realm, svn_boolean_t may_save, apr_pool_t *pool) -{ - kdDebug(9036) << " Password Prompt Callback " << endl; - kdDebug(9036) << " realm " << realm << " <--realm " << endl; -// kio_svnProtocol *p = ( kio_svnProtocol* )baton; -// // prepare dcop -// TQByteArray reply; -// TQByteArray params; -// TQCString replyType; -// TQDataStream arg( params, IO_WriteOnly ); -// arg << i18n( "Enter password for subversion repository access" ) + "\n" + TQString(realm); -// // call dcop -// if (!p->dcopClient()->call("kded","kdevsvnd", "sslPasswdDlg(TQString)",params,replyType,reply)) { -// kdWarning()<<" Communication with dcop failed - fail to show passwd dlg"<> retstr; -// -// if( retstr.left(1) == "-1" ){ -// kdDebug(9036) << " Null string received for passwd " << endl; -// } else{ -// passwd = retstr.right( retstr.length() - 1 ); -// kdDebug(9036) << " PassWD : " << passwd << endl; -// } -// -// svn_auth_cred_ssl_client_cert_pw_t *newcred = (svn_auth_cred_ssl_client_cert_pw_t*) apr_palloc (pool, sizeof (svn_auth_cred_ssl_client_cert_pw_t ) ); -// -// newcred->password = apr_pstrdup(pool, (const char*) passwd ); -// newcred->may_save = false; -// *cred_p = newcred; - - return SVN_NO_ERROR; -} - - -svn_error_t *kio_svnProtocol::commitLogPrompt( const char **log_msg, const char **file, - apr_array_header_t *commit_items, void *baton, apr_pool_t *pool ) -{ - *file = NULL; // if omitting this, it will segfault at import operation. - TQCString replyType; - TQByteArray params; - TQByteArray reply; - TQString result;// slist; - TQStringList slist; - kio_svnProtocol *p = ( kio_svnProtocol* )baton; - svn_stringbuf_t *message = NULL; - - for (int i = 0; i < commit_items->nelts; i++) { - TQString list; - svn_client_commit_item_t *item = ((svn_client_commit_item_t **) commit_items->elts)[i]; - const char *path = item->path; - char text_mod = '_', prop_mod = ' '; - - if (! path) - path = item->url; - else if (! *path) - path = "."; - - if (! path) - path = "."; - - if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) && (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)) - text_mod = 'R'; - else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD) - text_mod = 'A'; - else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) - text_mod = 'D'; - else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_TEXT_MODS) - text_mod = 'M'; - if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_PROP_MODS) - prop_mod = 'M'; - - list += text_mod; - list += " "; - list += prop_mod; - list += " "; - list += path; - kdDebug(9036) << " Commiting items : " << list << endl; - slist << list; -// slist += list; - } - - TQDataStream stream(params, IO_WriteOnly); - stream << slist.join("\n"); - - kdDebug(9036) << " __TIME__ " << __TIME__ << endl; - if ( !p->dcopClient()->call( "kded","kdevsvnd","commitDialog(TQString)", params, replyType, reply ) ) { - kdWarning() << "Communication with KDED:KDevSvnd failed" << endl; - svn_error_t *err = svn_error_create( SVN_ERR_EXTERNAL_PROGRAM, NULL, - apr_pstrdup( pool, "Fail to call kded_kdevsvnd via DCOP. If this is your first problem, try to restart KDE" ) ); - return err; - } - - if ( replyType != TQSTRING_OBJECT_NAME_STRING ) { - kdWarning() << "Unexpected reply type" << endl; - svn_error_t *err = svn_error_create( SVN_ERR_EXTERNAL_PROGRAM, NULL, - apr_pstrdup( pool, "Fail to call kded_kdevsvnd via DCOP." ) ); - return err; - } - - TQDataStream stream2 ( reply, IO_ReadOnly ); - stream2 >> result; - - if ( result.isNull() ) { //cancelled - *log_msg = NULL; - svn_error_t *err = svn_error_create( SVN_ERR_CANCELLED, NULL, - apr_pstrdup( pool, "Commit interruppted" ) ); - return err; - } - - message = svn_stringbuf_create( result.utf8(), pool ); - *log_msg = message->data; - - return SVN_NO_ERROR; -} - -void kio_svnProtocol::notify(void *baton, const char *path, svn_wc_notify_action_t action, svn_node_kind_t kind, const char *mime_type, svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state, svn_revnum_t revision) { - kdDebug(9036) << "NOTIFY : " << path << " updated at revision " << revision << " action : " << action << ", kind : " << kind << " , content_state : " << content_state << ", prop_state : " << prop_state << endl; - - TQString userstring; - struct notify_baton *nb = ( struct notify_baton* ) baton; - - //// Convert notification to a user readable string - switch ( action ) { - case svn_wc_notify_add : //add - if (mime_type && (svn_mime_type_is_binary (mime_type))) - userstring = i18n( "A (bin) %1" ).arg( path ); - else - userstring = i18n( "A %1" ).arg( path ); - break; - case svn_wc_notify_copy: //copy - userstring = i18n( "Copied %1 " ).arg( path ); - break; - case svn_wc_notify_delete: //delete - nb->received_some_change = TRUE; - userstring = i18n( "D %1" ).arg( path ); - break; - case svn_wc_notify_restore : //restore - userstring=i18n( "Restored %1." ).arg( path ); - break; - case svn_wc_notify_revert : //revert - userstring=i18n( "Reverted %1." ).arg( path ); - break; - case svn_wc_notify_failed_revert: //failed revert - userstring=i18n( "Failed to revert %1.\nTry updating instead." ).arg( path ); - break; - case svn_wc_notify_resolved: //resolved - userstring=i18n( "Resolved conflicted state of %1." ).arg( path ); - break; - case svn_wc_notify_skip: //skip - if ( content_state == svn_wc_notify_state_missing ) - userstring=i18n("Skipped missing target %1.").arg( path ); - else - userstring=i18n("Skipped %1.").arg( path ); - break; - case svn_wc_notify_update_delete: //update_delete - nb->received_some_change = TRUE; - userstring=i18n( "D %1" ).arg( path ); - break; - case svn_wc_notify_update_add: //update_add - nb->received_some_change = TRUE; - userstring=i18n( "A %1" ).arg( path ); - break; - case svn_wc_notify_update_update: //update_update - { - /* If this is an inoperative dir change, do no notification. - An inoperative dir change is when a directory gets closed - without any props having been changed. */ - if (! ((kind == svn_node_dir) - && ((prop_state == svn_wc_notify_state_inapplicable) - || (prop_state == svn_wc_notify_state_unknown) - || (prop_state == svn_wc_notify_state_unchanged)))) { - nb->received_some_change = TRUE; - - if (kind == svn_node_file) { - if (content_state == svn_wc_notify_state_conflicted) - userstring = "C"; - else if (content_state == svn_wc_notify_state_merged) - userstring = "G"; - else if (content_state == svn_wc_notify_state_changed) - userstring = "U"; - } - - if (prop_state == svn_wc_notify_state_conflicted) - userstring += "C"; - else if (prop_state == svn_wc_notify_state_merged) - userstring += "G"; - else if (prop_state == svn_wc_notify_state_changed) - userstring += "U"; - else - userstring += " "; - - if (! ((content_state == svn_wc_notify_state_unchanged - || content_state == svn_wc_notify_state_unknown) - && (prop_state == svn_wc_notify_state_unchanged - || prop_state == svn_wc_notify_state_unknown))) - userstring += TQString( " " ) + path; - } - break; - } - case svn_wc_notify_update_completed: //update_completed - { - if (! nb->suppress_final_line) { - if (SVN_IS_VALID_REVNUM (revision)) { - if (nb->is_export) { - if ( nb->in_external ) - userstring = i18n("Exported external at revision %1.").arg( revision ); - else - userstring = i18n("Exported revision %1.").arg( revision ); - } else if (nb->is_checkout) { - if ( nb->in_external ) - userstring = i18n("Checked out external at revision %1.").arg( revision ); - else - userstring = i18n("Checked out revision %1.").arg( revision); - } else { - if (nb->received_some_change) { - if ( nb->in_external ) - userstring=i18n("Updated external to revision %1.").arg( revision ); - else - userstring = i18n("Updated to revision %1.").arg( revision); - } else { - if ( nb->in_external ) - userstring = i18n("External at revision %1.").arg( revision ); - else - userstring = i18n("At revision %1.").arg( revision); - } - } - } else /* no revision */ { - if (nb->is_export) { - if ( nb->in_external ) - userstring = i18n("External export complete."); - else - userstring = i18n("Export complete."); - } else if (nb->is_checkout) { - if ( nb->in_external ) - userstring = i18n("External checkout complete."); - else - userstring = i18n("Checkout complete."); - } else { - if ( nb->in_external ) - userstring = i18n("External update complete."); - else - userstring = i18n("Update complete."); - } - } - } - } - if (nb->in_external) - nb->in_external = FALSE; - break; - case svn_wc_notify_update_external: //update_external - nb->in_external = TRUE; - userstring = i18n("Fetching external item into %1." ).arg( path ); - break; - case svn_wc_notify_status_completed: //status_completed - if (SVN_IS_VALID_REVNUM (revision)) - userstring = i18n( "Status against revision: %1.").arg( revision ); - break; - case svn_wc_notify_status_external: //status_external - userstring = i18n("Performing status on external item at %1.").arg( path ); - break; - case svn_wc_notify_commit_modified: //commit_modified - userstring = i18n( "Sending %1").arg( path ); - break; - case svn_wc_notify_commit_added: //commit_added - if (mime_type && svn_mime_type_is_binary (mime_type)) { - userstring = i18n( "Adding (bin) %1.").arg( path ); - } else { - userstring = i18n( "Adding %1.").arg( path ); - } - break; - case svn_wc_notify_commit_deleted: //commit_deleted - userstring = i18n( "Deleting %1.").arg( path ); - break; - case svn_wc_notify_commit_replaced: //commit_replaced - userstring = i18n( "Replacing %1.").arg( path ); - break; - case svn_wc_notify_commit_postfix_txdelta: //commit_postfix_txdelta - if (! nb->sent_first_txdelta) { - nb->sent_first_txdelta = TRUE; - userstring=i18n("Transmitting file data "); - } else { - userstring="."; - } - break; - - break; - case svn_wc_notify_blame_revision: //blame_revision - userstring = i18n("Blame %1.").arg(path); - break; - default: - break; - } - //// End convert - kio_svnProtocol *p = ( kio_svnProtocol* )nb->master; - if (!p) kdDebug(9036) << " Null Pointer at Line " << __LINE__ << endl; - - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , TQString::fromUtf8( path )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "action", TQString::number( action )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "kind", TQString::number( kind )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "mime_t", TQString::fromUtf8( mime_type )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "content", TQString::number( content_state )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( prop_state )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( revision )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "string", userstring ); - kdDebug(9036) << " kio_svnProtocol::notify() userstring " << userstring << endl; - p->incCounter(); -} - -void kio_svnProtocol::status(void *baton, const char *path, svn_wc_status_t *status) { - kdDebug(9036) << "STATUS : " << path << ", wc text status : " << status->text_status - << ", wc prop status : " << status->prop_status - << ", repos text status : " << status->repos_text_status - << ", repos prop status : " << status->repos_prop_status - << endl; - - TQByteArray params; - kio_svnProtocol *p = ( kio_svnProtocol* )baton; - - TQDataStream stream(params, IO_WriteOnly); - long int rev = status->entry ? status->entry->revision : 0; - stream << TQString::fromUtf8( path ) << status->text_status << status->prop_status << status->repos_text_status << status->repos_prop_status << rev; - - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path", TQString::fromUtf8( path )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "text", TQString::number( status->text_status )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( status->prop_status )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "reptxt", TQString::number( status->repos_text_status )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "repprop", TQString::number( status->repos_prop_status )); - p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( rev )); - p->incCounter(); -} - -void kio_svnProtocol::progressCallback( apr_off_t processed, apr_off_t total, void *baton, apr_pool_t *pool) -{ - kio_svnProtocol *p = (kio_svnProtocol*)baton; - if( total > -1 ) - p->totalSize( total ); - if( processed > -1 ) - p->processedSize( processed ); -} - -void kio_svnProtocol::wc_resolve( const KURL& wc, bool recurse ) { - kdDebug(9036) << "kio_svnProtocol::wc_resolve() : " << wc.url() << endl; - - apr_pool_t *subpool = svn_pool_create (pool); - - KURL nurl = wc; - nurl.setProtocol( "file" ); - recordCurrentURL( nurl ); - - initNotifier(false, false, false, subpool); - svn_error_t *err = svn_client_resolved(svn_path_canonicalize( nurl.path().utf8(), subpool ), recurse,ctx,subpool); - if ( err ) - error( TDEIO::ERR_SLAVE_DEFINED, err->message ); - - finished(); - svn_pool_destroy (subpool); -} - -extern "C" -{ - KDE_EXPORT int kdemain(int argc, char **argv) { - TDEInstance instance( "kio_kdevsvn" ); - - kdDebug(9036) << "*** Starting kio_kdevsvn " << endl; - - if (argc != 4) { - kdDebug(9036) << "Usage: kio_kdevsvn protocol domain-socket1 domain-socket2" << endl; - exit(-1); - } - - kio_svnProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - - kdDebug(9036) << "*** kio_kdevsvn Done" << endl; - return 0; - } -} - diff --git a/vcs/subversion/svn_kio.h b/vcs/subversion/svn_kio.h deleted file mode 100644 index b00cddb8..00000000 --- a/vcs/subversion/svn_kio.h +++ /dev/null @@ -1,163 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Mickael Marchand - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _svn_H_ -#define _svn_H_ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "subversion_global.h" - -class TQCString; -class kio_svnProtocol; - -typedef struct kbaton { - svn_stream_t *target_stream; - svn_stringbuf_t *target_string; - svn_stream_t *string_stream; -} kbaton; - -typedef struct kio_svn_callback_baton_t { - const char* base_dir; - apr_hash_t *config; - apr_pool_t *pool; -} kio_svn_callback_baton_t; - -typedef struct notify_baton { - svn_boolean_t received_some_change; - svn_boolean_t is_checkout; - svn_boolean_t is_export; - svn_boolean_t suppress_final_line; - svn_boolean_t sent_first_txdelta; - svn_boolean_t in_external; - svn_boolean_t had_print_error; /* Used to not keep printing error messages - when we've already had one print error. */ - apr_pool_t *pool; /* this pool is cleared after every notification, - so don't keep anything here! */ - kio_svnProtocol *master; -} notify_baton; - - -class kio_svnProtocol : public TDEIO::SlaveBase -{ - public: - kio_svnProtocol(const TQCString &pool_socket, const TQCString &app_socket); - virtual ~kio_svnProtocol(); - virtual void special( const TQByteArray& data ); - virtual void get(const KURL& url); - virtual void listDir(const KURL& url); - virtual void stat(const KURL& url); - virtual void mkdir(const KURL& url, int permissions); - virtual void mkdir(const KURL::List& list, int permissions); - virtual void del( const KURL& url, bool isfile ); -// virtual void copy(const KURL & src, const KURL& dest, int permissions, bool overwrite); - virtual void rename(const KURL& src, const KURL& dest, bool overwrite); - void checkout( const KURL& repos, const KURL& wc, int revnumber, const TQString& revkind ); - void import( const KURL& repos, const KURL& wc ); - void svn_switch( const KURL& wc, const KURL& url, int revnumber, const TQString& revkind, bool recurse); - void svn_switch_relocate( const KURL &wc, const KURL &origUrl, const KURL &newUrl, - bool recurse ); - void svn_diff( const KURL& url1, const KURL& url2, int rev1, int rev2, const TQString& revkind1, const TQString& revkind2, bool recurse, bool pegdiff); - //TODO fix with svn 1.2 : support a KURL::List -> svn_client_update2() - void update( const KURL::List &list, int revnumber, const TQString& revkind ); - void commit( const KURL::List& wc ); - void commit2( bool recurse, bool keeplocks, const KURL::List& wc ); - void blame( KURL url, SvnGlobal::UrlMode mode, /*int pegRev, TQString pegRevKind,*/ int startRev, TQString startRevKind, int endRev, TQString endRevKind ); - static svn_error_t* blameReceiver( void *baton, apr_int64_t line_no, svn_revnum_t rev, const char *author, const char *date, const char *line, apr_pool_t *pool ); - void svn_log( int revstart, const TQString &revkindstart, int revend, const TQString &revkindend, bool discorverChangedPath, bool strictNodeHistory, const KURL::List& targets ); - static svn_error_t* receiveLogMessage(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool ); - void add( const KURL::List& wcList ); - //these work using the working copy - void wc_resolve( const KURL& wc, bool recurse = true ); - void wc_delete( const KURL::List& wc ); - void wc_revert( const KURL::List& wc ); - void wc_status(const KURL& wc, bool checkRepos=false, bool fullRecurse=true, bool getAll=true, int revnumber=-1, const TQString& revkind="HEAD"); - void wc_status2(const KURL& wc, bool checkRepos=false, bool fullRecurse=true, bool getAll=true, bool noIgnore=false, int revnumber=-1, const TQString& revkind="WORKING"); - void svn_info( KURL pathOrUrl, int pegRev, TQString pegRevKind, int rev, TQString revKind, bool recurse ); - static svn_error_t* infoReceiver( void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool); - void svn_copy( const KURL &srcUrl, int srcRev, const TQString &srcRevKind, const KURL &destUrl ); - void svn_merge( const KURL &src1, int rev1, TQString revKind1, const KURL &src2, int rev2, TQString revKind2, - const KURL &target_wc, - bool recurse, bool ignore_ancestry, bool force, bool dry_run ); - - static svn_error_t* checkAuth(svn_auth_cred_simple_t **cred, void *baton, const char *realm, const char *username, svn_boolean_t may_save, apr_pool_t *pool); - static svn_error_t *trustSSLPrompt(svn_auth_cred_ssl_server_trust_t **cred_p, void *, const char *realm, apr_uint32_t failures, const svn_auth_ssl_server_cert_info_t *cert_info, svn_boolean_t may_save, apr_pool_t *pool); - static svn_error_t *clientCertSSLPrompt(svn_auth_cred_ssl_client_cert_t **cred_p, void *, const char *realm, svn_boolean_t may_save, apr_pool_t *pool); - static svn_error_t *clientCertPasswdPrompt(svn_auth_cred_ssl_client_cert_pw_t **cred_p, void *, const char *realm, svn_boolean_t may_save, apr_pool_t *pool); - static svn_error_t *commitLogPrompt( const char **log_msg, const char **tmp_file, apr_array_header_t *commit_items, void *baton, apr_pool_t *pool ); - static void notify(void *baton, const char *path, svn_wc_notify_action_t action, svn_node_kind_t kind, const char *mime_type, svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state, svn_revnum_t revision); - static void status(void *baton, const char *path, svn_wc_status_t *status); - static void progressCallback( apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool); - - TQString chooseProtocol ( const TQString& kproto ) const; - TQString makeSvnURL ( const KURL& url ) const; - void initNotifier(bool is_checkout, bool is_export, bool suppress_final_line, apr_pool_t *spool); - - void recordCurrentURL(const KURL& url); - void popupMessage( const TQString& message ); - int counter() { return m_counter; } - void incCounter() { m_counter++; } - svn_opt_revision_t createRevision( int revision, const TQString& revkind, apr_pool_t *pool ); - - KURL myURL; - svn_client_ctx_t *ctx; - TDEIO::AuthInfo info; - - enum SVN_METHOD { - SVN_CHECKOUT=1, //KURL repository, KURL workingcopy, int revnumber=-1, TQString revkind(HEAD, ...) //revnumber==-1 => use of revkind - SVN_UPDATE=2, // KURL wc (svn:///tmp/test, int revnumber=-1, TQString revkind(HEAD, ...) // revnumber==-1 => use of revkind - SVN_COMMIT=3, - SVN_LOG=4, - SVN_IMPORT=5, - SVN_ADD=6, - SVN_DEL=7, - SVN_REVERT=8, - SVN_STATUS=9, - SVN_MKDIR=10, - SVN_RESOLVE=11, - SVN_SWITCH=12, - SVN_DIFF=13, - SVN_BLAME=14, - SVN_INFO = 15, - SVN_SWITCH_RELOCATE = 16, - SVN_COPY = 17, - SVN_MERGE = 18, - SVN_COMMIT_2=103, - SVN_STATUS_2=109 - - }; - - private: - bool createUDSEntry( const TQString& filename, const TQString& user, long long int size, bool isdir, time_t mtime, TDEIO::UDSEntry& entry); - apr_pool_t *pool; - unsigned long int m_counter; -}; - -#endif diff --git a/vcs/subversion/svn_tdeio.cpp b/vcs/subversion/svn_tdeio.cpp new file mode 100644 index 00000000..21ef2d2f --- /dev/null +++ b/vcs/subversion/svn_tdeio.cpp @@ -0,0 +1,2155 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Mickael Marchand + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "svn_tdeio.h" +#include +// #include "commitdlg.h" +#include + +using namespace TDEIO; +using namespace SvnGlobal; + +typedef struct +{ + /* Holds the directory that corresponds to the REPOS_URL at RA->open() + * time. When callbacks specify a relative path, they are joined with + * this base directory. */ + const char *base_dir; + svn_wc_adm_access_t *base_access; + + /* An array of svn_client_commit_item_t * structures, present only + * during working copy commits. */ + apr_array_header_t *commit_items; + + /* A hash of svn_config_t's, keyed off file name (i.e. the contents of + * ~/.subversion/config end up keyed off of 'config'). */ + apr_hash_t *config; + + /* The pool to use for session-related items. */ + apr_pool_t *pool; + +} svn_client__callback_baton_t; + +static svn_error_t * +open_tmp_file (apr_file_t **fp, + void *callback_baton, + apr_pool_t *pool) +{ + svn_client__callback_baton_t *cb = (svn_client__callback_baton_t *) callback_baton; + const char *truepath; + const char *ignored_filename; + + if (cb->base_dir) + truepath = apr_pstrdup (pool, cb->base_dir); + else + truepath = ""; + + /* Tack on a made-up filename. */ + truepath = svn_path_join (truepath, "tempfile", pool); + + /* Open a unique file; use APR_DELONCLOSE. */ + SVN_ERR (svn_io_open_unique_file (fp, &ignored_filename, + truepath, ".tmp", TRUE, pool)); + + return SVN_NO_ERROR; +} + +static svn_error_t *write_to_string(void *baton, const char *data, apr_size_t *len) { + kbaton *tb = ( kbaton* )baton; + svn_stringbuf_appendbytes(tb->target_string, data, *len); + return SVN_NO_ERROR; +} + +static int +compare_items_as_paths (const svn_sort__item_t*a, const svn_sort__item_t*b) { + return svn_path_compare_paths ((const char *)a->key, (const char *)b->key); +} + +tdeio_svnProtocol::tdeio_svnProtocol(const TQCString &pool_socket, const TQCString &app_socket) + : SlaveBase("tdeio_svn", pool_socket, app_socket) { + kdDebug(9036) << "tdeio_svnProtocol::tdeio_svnProtocol()" << endl; + + m_counter = 0; + + apr_initialize(); + // Make sure to properly initialize svn client, besides other things, this sets up + // NLS support for environments that don't use UTF-8 + svn_cmdline_init("kdevsvnd",NULL); + // CleanUP ctx preventing crash in svn_client_update and other + memset(&ctx, 0, sizeof(ctx)); + pool = svn_pool_create (NULL); + + svn_error_t *err = svn_client_create_context(&ctx, pool); + if ( err ) { + kdDebug(9036) << "tdeio_svnProtocol::tdeio_svnProtocol() create_context ERROR" << endl; + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + return; + } + + err = svn_config_ensure (NULL,pool); + if ( err ) { + kdDebug(9036) << "tdeio_svnProtocol::tdeio_svnProtocol() configensure ERROR" << endl; + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + return; + } + svn_config_get_config (&ctx->config, NULL, pool); + + ctx->log_msg_func = tdeio_svnProtocol::commitLogPrompt; + ctx->log_msg_baton = this; //pass this so that we can get a dcopClient from it + //TODO + ctx->cancel_func = NULL; + // progress notifications + ctx->progress_func = tdeio_svnProtocol::progressCallback; + ctx->progress_baton = this; + + apr_array_header_t *providers = apr_array_make(pool, 15, sizeof(svn_auth_provider_object_t *)); + + svn_auth_provider_object_t *provider; + + //disk cache + svn_client_get_simple_provider(&provider,pool); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; + svn_client_get_username_provider(&provider,pool); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; + + //interactive prompt + svn_client_get_simple_prompt_provider (&provider,tdeio_svnProtocol::checkAuth,this,2,pool); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider; + //we always ask user+pass, no need for a user only question +/* svn_client_get_username_prompt_provider + * (&provider,tdeio_svnProtocol::checkAuth,this,2,pool); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t*) = provider;*/ + + //SSL disk cache, keep that one, because it does nothing bad :) + svn_client_get_ssl_server_trust_file_provider (&provider, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + svn_client_get_ssl_client_cert_file_provider (&provider, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + svn_client_get_ssl_client_cert_pw_file_provider (&provider, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + + //SSL interactive prompt, where things get hard + svn_client_get_ssl_server_trust_prompt_provider (&provider, tdeio_svnProtocol::trustSSLPrompt, (void*)this, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + svn_client_get_ssl_client_cert_prompt_provider (&provider, tdeio_svnProtocol::clientCertSSLPrompt, (void*)this, 2, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + svn_client_get_ssl_client_cert_pw_prompt_provider (&provider, tdeio_svnProtocol::clientCertPasswdPrompt, (void*)this, 2, pool); + APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider; + + svn_auth_open(&ctx->auth_baton, providers, pool); +} + +tdeio_svnProtocol::~tdeio_svnProtocol(){ + kdDebug(9036) << "tdeio_svnProtocol::~tdeio_svnProtocol()" << endl; + svn_pool_destroy(pool); + apr_terminate(); +} + +void tdeio_svnProtocol::initNotifier(bool is_checkout, bool is_export, bool suppress_final_line, apr_pool_t *spool) { + m_counter=0;//reset counter + ctx->notify_func = tdeio_svnProtocol::notify; + struct notify_baton *nb = ( struct notify_baton* )apr_palloc(spool, sizeof( struct notify_baton ) ); + nb->master = this; + nb->received_some_change = FALSE; + nb->sent_first_txdelta = FALSE; + nb->is_checkout = is_checkout; + nb->is_export = is_export; + nb->suppress_final_line = suppress_final_line; + nb->in_external = FALSE; + nb->had_print_error = FALSE; + nb->pool = svn_pool_create (spool); + + ctx->notify_baton = nb; +} + +svn_error_t* tdeio_svnProtocol::checkAuth(svn_auth_cred_simple_t **cred, void *baton, const char *realm, const char *username, svn_boolean_t may_save, apr_pool_t *pool) { + kdDebug(9036) << "tdeio_svnProtocol::checkAuth() " << endl; + tdeio_svnProtocol *p = ( tdeio_svnProtocol* )baton; + svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t*)apr_pcalloc (pool, sizeof (*ret)); + + p->info.keepPassword = true; + p->info.verifyPath=true; + kdDebug(9036 ) << "auth current URL : " << p->myURL.url() << endl; + p->info.url = p->myURL; + p->info.username = username; //( const char* )svn_auth_get_parameter( p->ctx->auth_baton, SVN_AUTH_PARAM_DEFAULT_USERNAME ); + if (realm) { + p->info.prompt = i18n("Username and Password for %1.").arg(realm); + } + +// if ( !p->checkCachedAuthentication( p->info ) ){ + p->openPassDlg( p->info ); +// } + ret->username = apr_pstrdup(pool, p->info.username.utf8()); + ret->password = apr_pstrdup(pool, p->info.password.utf8()); + if (may_save) ret->may_save = p->info.keepPassword; + *cred = ret; + return SVN_NO_ERROR; +} + +void tdeio_svnProtocol::recordCurrentURL(const KURL& url) { + myURL = url; +} + +//don't implement mimeType() until we don't need to download the whole file + +void tdeio_svnProtocol::get(const KURL& url ){ + kdDebug(9036) << "tdeio_svn::get(const KURL& url)" << endl ; + + TQString remoteServer = url.host(); + infoMessage(i18n("Looking for %1...").arg( remoteServer ) ); + + apr_pool_t *subpool = svn_pool_create (pool); + kbaton *bt = (kbaton*)apr_pcalloc(subpool, sizeof(*bt)); + bt->target_string = svn_stringbuf_create("", subpool); + bt->string_stream = svn_stream_create(bt,subpool); + svn_stream_set_write(bt->string_stream,write_to_string); + + TQString target = makeSvnURL( url ); + kdDebug(9036) << "SvnURL: " << target << endl; + recordCurrentURL( KURL( target ) ); + + //find the requested revision + svn_opt_revision_t rev; + svn_opt_revision_t endrev; + int idx = target.findRev( "?rev=" ); + if ( idx != -1 ) { + TQString revstr = target.mid( idx+5 ); +#if 0 + kdDebug(9036) << "revision string found " << revstr << endl; + if ( revstr == "HEAD" ) { + rev.kind = svn_opt_revision_head; + kdDebug(9036) << "revision searched : HEAD" << endl; + } else { + rev.kind = svn_opt_revision_number; + rev.value.number = revstr.toLong(); + kdDebug(9036) << "revision searched : " << rev.value.number << endl; + } +#endif + svn_opt_parse_revision( &rev, &endrev, revstr.utf8(), subpool ); + target = target.left( idx ); + kdDebug(9036) << "new target : " << target << endl; + } else { + kdDebug(9036) << "no revision given. searching HEAD " << endl; + rev.kind = svn_opt_revision_head; + } + initNotifier(false, false, false, subpool); + + svn_error_t *err = svn_client_cat (bt->string_stream, svn_path_canonicalize( target.utf8(),subpool ),&rev,ctx, subpool); + if ( err ) { + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + svn_pool_destroy( subpool ); + return; + } + + // Send the mimeType as soon as it is known + TQByteArray *cp = new TQByteArray(); + cp->setRawData( bt->target_string->data, bt->target_string->len ); + KMimeType::Ptr mt = KMimeType::findByContent(*cp); + kdDebug(9036) << "KMimeType returned : " << mt->name() << endl; + mimeType( mt->name() ); + + totalSize(bt->target_string->len); + + //send data + data(*cp); + + data(TQByteArray()); // empty array means we're done sending the data + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::stat(const KURL & url){ + kdDebug(9036) << "tdeio_svn::stat(const KURL& url) : " << url.url() << endl ; + + void *ra_baton, *session; + svn_ra_plugin_t *ra_lib; + svn_node_kind_t kind; + apr_pool_t *subpool = svn_pool_create (pool); + + TQString target = makeSvnURL( url); + kdDebug(9036) << "SvnURL: " << target << endl; + recordCurrentURL( KURL( target ) ); + + //find the requested revision + svn_opt_revision_t rev; + svn_opt_revision_t endrev; + int idx = target.findRev( "?rev=" ); + if ( idx != -1 ) { + TQString revstr = target.mid( idx+5 ); +#if 0 + kdDebug(9036) << "revision string found " << revstr << endl; + if ( revstr == "HEAD" ) { + rev.kind = svn_opt_revision_head; + kdDebug(9036) << "revision searched : HEAD" << endl; + } else { + rev.kind = svn_opt_revision_number; + rev.value.number = revstr.toLong(); + kdDebug(9036) << "revision searched : " << rev.value.number << endl; + } +#endif + svn_opt_parse_revision( &rev, &endrev, revstr.utf8( ), subpool ); + target = target.left( idx ); + kdDebug(9036) << "new target : " << target << endl; + } else { + kdDebug(9036) << "no revision given. searching HEAD " << endl; + rev.kind = svn_opt_revision_head; + } + + //init + svn_error_t *err = svn_ra_init_ra_libs(&ra_baton,subpool); + if ( err ) { + kdDebug(9036) << "init RA libs failed : " << err->message << endl; + return; + } + //find RA libs + err = svn_ra_get_ra_library(&ra_lib,ra_baton,svn_path_canonicalize( target.utf8(), subpool ),subpool); + if ( err ) { + kdDebug(9036) << "RA get libs failed : " << err->message << endl; + return; + } + kdDebug(9036) << "RA init completed" << endl; + + //start session + svn_ra_callbacks_t *cbtable = (svn_ra_callbacks_t*)apr_pcalloc(subpool, sizeof(*cbtable)); + tdeio_svn_callback_baton_t *callbackbt = (tdeio_svn_callback_baton_t*)apr_pcalloc(subpool, sizeof( *callbackbt )); + + cbtable->open_tmp_file = open_tmp_file; + cbtable->get_wc_prop = NULL; + cbtable->set_wc_prop = NULL; + cbtable->push_wc_prop = NULL; + cbtable->auth_baton = ctx->auth_baton; + + callbackbt->base_dir = target.utf8(); + callbackbt->pool = subpool; + callbackbt->config = ctx->config; + + err = ra_lib->open(&session,svn_path_canonicalize( target.utf8(), subpool ),cbtable,callbackbt,ctx->config,subpool); + if ( err ) { + kdDebug(9036)<< "Open session " << err->message << endl; + return; + } + kdDebug(9036) << "Session opened to " << target << endl; + //find number for HEAD + if (rev.kind == svn_opt_revision_head) { + err = ra_lib->get_latest_revnum(session,&rev.value.number,subpool); + if ( err ) { + kdDebug(9036)<< "Latest RevNum " << err->message << endl; + return; + } + kdDebug(9036) << "Got rev " << rev.value.number << endl; + } + + //get it + ra_lib->check_path(session,"",rev.value.number,&kind,subpool); + kdDebug(9036) << "Checked Path" << endl; + UDSEntry entry; + switch ( kind ) { + case svn_node_file: + kdDebug(9036) << "::stat result : file" << endl; + createUDSEntry(url.filename(),"",0,false,0,entry); + statEntry( entry ); + break; + case svn_node_dir: + kdDebug(9036) << "::stat result : directory" << endl; + createUDSEntry(url.filename(),"",0,true,0,entry); + statEntry( entry ); + break; + case svn_node_unknown: + case svn_node_none: + //error XXX + default: + kdDebug(9036) << "::stat result : UNKNOWN ==> WOW :)" << endl; + ; + } + finished(); + svn_pool_destroy( subpool ); +} + +void tdeio_svnProtocol::listDir(const KURL& url){ + kdDebug(9036) << "tdeio_svn::listDir(const KURL& url) : " << url.url() << endl ; + + apr_pool_t *subpool = svn_pool_create (pool); + apr_hash_t *dirents; + + TQString target = makeSvnURL( url); + kdDebug(9036) << "SvnURL: " << target << endl; + recordCurrentURL( KURL( target ) ); + + //find the requested revision + svn_opt_revision_t rev; + svn_opt_revision_t endrev; + int idx = target.findRev( "?rev=" ); + if ( idx != -1 ) { + TQString revstr = target.mid( idx+5 ); + svn_opt_parse_revision( &rev, &endrev, revstr.utf8(), subpool ); +#if 0 + kdDebug(9036) << "revision string found " << revstr << endl; + if ( revstr == "HEAD" ) { + rev.kind = svn_opt_revision_head; + kdDebug(9036) << "revision searched : HEAD" << endl; + } else { + rev.kind = svn_opt_revision_number; + rev.value.number = revstr.toLong(); + kdDebug(9036) << "revision searched : " << rev.value.number << endl; + } +#endif + target = target.left( idx ); + kdDebug(9036) << "new target : " << target << endl; + } else { + kdDebug(9036) << "no revision given. searching HEAD " << endl; + rev.kind = svn_opt_revision_head; + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_ls (&dirents, svn_path_canonicalize( target.utf8(), subpool ), &rev, false, ctx, subpool); + if ( err ) { + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + svn_pool_destroy( subpool ); + return; + } + + apr_array_header_t *array; + int i; + + array = svn_sort__hash (dirents, compare_items_as_paths, subpool); + + UDSEntry entry; + for (i = 0; i < array->nelts; ++i) { + entry.clear(); + const char *utf8_entryname, *native_entryname; + svn_dirent_t *dirent; + svn_sort__item_t *item; + + item = &APR_ARRAY_IDX (array, i, svn_sort__item_t); + + utf8_entryname = (const char*)item->key; + + dirent = (svn_dirent_t*)apr_hash_get (dirents, utf8_entryname, item->klen); + + svn_utf_cstring_from_utf8 (&native_entryname, utf8_entryname, subpool); + const char *native_author = NULL; + + //XXX BUGGY +/* apr_time_exp_t timexp; + apr_time_exp_lt(&timexp, dirent->time); + apr_os_exp_time_t *ostime; + apr_os_exp_time_get( &ostime, &timexp); + + time_t mtime = mktime( ostime );*/ + + if (dirent->last_author) + svn_utf_cstring_from_utf8 (&native_author, dirent->last_author, subpool); + + if ( createUDSEntry(TQString( native_entryname ), TQString( native_author ), dirent->size, + dirent->kind==svn_node_dir ? true : false, 0, entry) ) + listEntry( entry, false ); + } + listEntry( entry, true ); + + finished(); + svn_pool_destroy (subpool); +} + +bool tdeio_svnProtocol::createUDSEntry( const TQString& filename, const TQString& user, long long int size, bool isdir, time_t mtime, UDSEntry& entry) { + kdDebug(9036) << "MTime : " << ( long )mtime << endl; + kdDebug(9036) << "UDS filename : " << filename << endl; + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = filename; + entry.append( atom ); + + atom.m_uds = TDEIO::UDS_FILE_TYPE; + atom.m_long = isdir ? S_IFDIR : S_IFREG; + entry.append( atom ); + + atom.m_uds = TDEIO::UDS_SIZE; + atom.m_long = size; + entry.append( atom ); + + atom.m_uds = TDEIO::UDS_MODIFICATION_TIME; + atom.m_long = mtime; + entry.append( atom ); + + atom.m_uds = TDEIO::UDS_USER; + atom.m_str = user; + entry.append( atom ); + + return true; +} + +// not used, at least for KDevelop +// void tdeio_svnProtocol::copy(const KURL & src, const KURL& dest, int /*permissions*/, bool /*overwrite*/) { +// kdDebug(9036) << "tdeio_svnProtocol::copy() Source : " << src.url() << " Dest : " << dest.url() << endl; +// +// apr_pool_t *subpool = svn_pool_create (pool); +// svn_client_commit_info_t *commit_info = NULL; +// +// KURL nsrc = src; +// KURL ndest = dest; +// nsrc.setProtocol( chooseProtocol( src.protocol() ) ); +// ndest.setProtocol( chooseProtocol( dest.protocol() ) ); +// TQString srcsvn = nsrc.url(); +// TQString destsvn = ndest.url(); +// +// recordCurrentURL( nsrc ); +// +// //find the requested revision +// svn_opt_revision_t rev; +// int idx = srcsvn.findRev( "?rev=" ); +// if ( idx != -1 ) { +// TQString revstr = srcsvn.mid( idx+5 ); +// kdDebug(9036) << "revision string found " << revstr << endl; +// if ( revstr == "HEAD" ) { +// rev.kind = svn_opt_revision_head; +// kdDebug(9036) << "revision searched : HEAD" << endl; +// } else { +// rev.kind = svn_opt_revision_number; +// rev.value.number = revstr.toLong(); +// kdDebug(9036) << "revision searched : " << rev.value.number << endl; +// } +// srcsvn = srcsvn.left( idx ); +// kdDebug(9036) << "new src : " << srcsvn << endl; +// } else { +// kdDebug(9036) << "no revision given. searching HEAD " << endl; +// rev.kind = svn_opt_revision_head; +// } +// +// initNotifier(false, false, false, subpool); +// svn_error_t *err = svn_client_copy(&commit_info, srcsvn.utf8(), &rev, destsvn.utf8(), ctx, subpool); +// if ( err ) { +// error( TDEIO::ERR_SLAVE_DEFINED, err->message ); +// svn_pool_destroy (subpool); +// } +// +// finished(); +// svn_pool_destroy (subpool); +// } + +void tdeio_svnProtocol::mkdir( const KURL::List& list, int /*permissions*/ ) { + kdDebug(9036) << "tdeio_svnProtocol::mkdir(LIST) : " << list << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + + recordCurrentURL( list[ 0 ] ); + + apr_array_header_t *targets = apr_array_make(subpool, list.count()+1, sizeof(const char *)); + + KURL::List::const_iterator it = list.begin(), end = list.end(); + for ( ; it != end; ++it ) { + TQString cur = makeSvnURL( *it ); + kdDebug( 9036 ) << "tdeio_svnProtocol::mkdir raw url for subversion : " << cur << endl; + const char *_target = apr_pstrdup( subpool, svn_path_canonicalize( apr_pstrdup( subpool, cur.utf8() ), subpool ) ); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = _target; + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_mkdir(&commit_info,targets,ctx,subpool); + if ( err ) { + error( TDEIO::ERR_COULD_NOT_MKDIR, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::mkdir( const KURL& url, int /*permissions*/ ) { + kdDebug(9036) << "tdeio_svnProtocol::mkdir() : " << url.url() << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + + TQString target = makeSvnURL( url); + kdDebug(9036) << "SvnURL: " << target << endl; + recordCurrentURL( KURL( target ) ); + + apr_array_header_t *targets = apr_array_make(subpool, 2, sizeof(const char *)); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = apr_pstrdup( subpool, target.utf8() ); + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_mkdir(&commit_info,targets,ctx,subpool); + if ( err ) { + error( TDEIO::ERR_COULD_NOT_MKDIR, err->message ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::del( const KURL& url, bool /*isfile*/ ) { + kdDebug(9036) << "tdeio_svnProtocol::del() : " << url.url() << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + + TQString target = makeSvnURL(url); + kdDebug(9036) << "SvnURL: " << target << endl; + recordCurrentURL( KURL( target ) ); + + apr_array_header_t *targets = apr_array_make(subpool, 2, sizeof(const char *)); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = apr_pstrdup( subpool, target.utf8() ); + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_delete(&commit_info,targets,false/*force remove locally modified files in wc*/,ctx,subpool); + if ( err ) { + error( TDEIO::ERR_CANNOT_DELETE, err->message ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::rename(const KURL& src, const KURL& dest, bool /*overwrite*/) { + kdDebug(9036) << "tdeio_svnProtocol::rename() Source : " << src.url() << " Dest : " << dest.url() << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + + KURL nsrc = src; + KURL ndest = dest; + nsrc.setProtocol( chooseProtocol( src.protocol() ) ); + ndest.setProtocol( chooseProtocol( dest.protocol() ) ); + TQString srcsvn = nsrc.url(); + TQString destsvn = ndest.url(); + + recordCurrentURL( nsrc ); + + //find the requested revision + svn_opt_revision_t rev; + int idx = srcsvn.findRev( "?rev=" ); + if ( idx != -1 ) { + TQString revstr = srcsvn.mid( idx+5 ); + kdDebug(9036) << "revision string found " << revstr << endl; + if ( revstr == "HEAD" ) { + rev.kind = svn_opt_revision_head; + kdDebug(9036) << "revision searched : HEAD" << endl; + } else { + rev.kind = svn_opt_revision_number; + rev.value.number = revstr.toLong(); + kdDebug(9036) << "revision searched : " << rev.value.number << endl; + } + srcsvn = srcsvn.left( idx ); + kdDebug(9036) << "new src : " << srcsvn << endl; + } else { + kdDebug(9036) << "no revision given. searching HEAD " << endl; + rev.kind = svn_opt_revision_head; + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_move(&commit_info, srcsvn.utf8(), &rev, destsvn.utf8(), false/*force remove locally modified files in wc*/, ctx, subpool); + if ( err ) { + error( TDEIO::ERR_CANNOT_RENAME, err->message ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::special( const TQByteArray& data ) { +// kdDebug(9036) << "tdeio_svnProtocol::special" << endl; + + TQDataStream stream(data, IO_ReadOnly); + int tmp; + + stream >> tmp; + kdDebug(9036) << "tdeio_svnProtocol::special " << tmp << endl; + + switch ( tmp ) { + case SVN_CHECKOUT: + { + KURL repository, wc; + int revnumber; + TQString revkind; + stream >> repository; + stream >> wc; + stream >> revnumber; + stream >> revkind; + kdDebug(9036) << "tdeio_svnProtocol CHECKOUT from " << repository.url() << " to " << wc.url() << " at " << revnumber << " or " << revkind << endl; + checkout( repository, wc, revnumber, revkind ); + break; + } + case SVN_UPDATE: + { + KURL::List list; + int revnumber; + TQString revkind; + stream >> list; + stream >> revnumber; + stream >> revkind; + kdDebug(9036) << "tdeio_svnProtocol UPDATE " << endl; + update( list, revnumber, revkind ); + break; + } + case SVN_COMMIT: + { + KURL::List wclist; + while ( !stream.atEnd() ) { + KURL tmp; + stream >> tmp; + wclist << tmp; + } + kdDebug(9036) << "tdeio_svnProtocol COMMIT" << endl; + commit( wclist ); + break; + } + case SVN_COMMIT_2: + { + bool recurse, keeplocks; + KURL::List wclist; + stream >> recurse; + stream >> keeplocks; + while ( !stream.atEnd() ) { + KURL tmp; + stream >> tmp; + wclist << tmp; + } + kdDebug(9036) << "tdeio_svnProtocol COMMIT2" << endl; + commit2( recurse, keeplocks, wclist ); + break; + } + case SVN_LOG: + { + kdDebug(9036) << "tdeio_svnProtocol LOG" << endl; + int revstart, revend; + TQString revkindstart, revkindend; + bool discorverChangedPath, strictNodeHistory; + KURL::List targets; + + stream >> revstart; + stream >> revkindstart; + stream >> revend; + stream >> revkindend; + stream >> discorverChangedPath; + stream >> strictNodeHistory; + while ( !stream.atEnd() ) { + KURL tmp; + stream >> tmp; + targets << tmp; + } + svn_log( revstart, revkindstart, revend, revkindend, + discorverChangedPath, strictNodeHistory, targets ); + break; + } + case SVN_IMPORT: + { + KURL wc,repos; + stream >> repos; + stream >> wc; + kdDebug(9036) << "tdeio_svnProtocol IMPORT" << endl; + import(repos,wc); + break; + } + case SVN_ADD: + { + KURL::List wcList; + stream >> wcList; + kdDebug(9036) << "tdeio_svnProtocol ADD" << endl; + add(wcList); + break; + } + case SVN_DEL: + { + KURL::List wclist; + stream >> wclist; + kdDebug(9036) << "tdeio_svnProtocol DEL" << endl; + wc_delete(wclist); + break; + } + case SVN_REVERT: + { + KURL::List wclist; + stream >> wclist; + kdDebug(9036) << "tdeio_svnProtocol REVERT" << endl; + wc_revert(wclist); + break; + } + case SVN_STATUS: + { + KURL wc; + bool checkRepos=false; + bool fullRecurse=false; + stream >> wc; + stream >> checkRepos; + stream >> fullRecurse; + wc_status(wc,checkRepos,fullRecurse); + break; + } + case SVN_STATUS_2: + { + KURL wc; + TQString revkind; + int revnumber; + bool checkRepos, fullRecurse, getAll, noIgnore; + stream >> checkRepos; + stream >> fullRecurse; + stream >> getAll; + stream >> noIgnore; + stream >> revnumber; + stream >> revkind; + stream >> wc; + wc_status2(wc,checkRepos,fullRecurse, getAll, noIgnore, revnumber, revkind); + break; + } + case SVN_MKDIR: + { + KURL::List list; + stream >> list; + kdDebug(9036) << "tdeio_svnProtocol MKDIR" << endl; + mkdir(list,0); + break; + } + case SVN_RESOLVE: + { + KURL url; + bool recurse; + stream >> url; + stream >> recurse; + kdDebug(9036) << "tdeio_svnProtocol RESOLVE" << endl; + wc_resolve(url,recurse); + break; + } + case SVN_SWITCH: + { + KURL wc,url; + bool recurse; + int revnumber; + TQString revkind; + stream >> wc; + stream >> url; + stream >> recurse; + stream >> revnumber; + stream >> revkind; + kdDebug(9036) << "tdeio_svnProtocol SWITCH" << endl; + svn_switch(wc,url,revnumber,revkind,recurse); + break; + } + case SVN_SWITCH_RELOCATE: + { + KURL wc, origUrl, newUrl; + bool recurse; + stream >> wc; + stream >> origUrl; + stream >> newUrl; + stream >> recurse; + svn_switch_relocate( wc, origUrl, newUrl, recurse ); + break; + } + case SVN_DIFF: + { + KURL url1,url2; + int rev1, rev2; + bool recurse, pegdiff; + TQString revkind1, revkind2; + stream >> url1; + stream >> url2; + stream >> rev1; + stream >> revkind1; + stream >> rev2; + stream >> revkind2; + stream >> recurse >> pegdiff; + kdDebug(9036) << "tdeio_svnProtocol DIFF" << endl; + svn_diff(url1,url2,rev1,rev2,revkind1,revkind2,recurse,pegdiff); + break; + } + case SVN_BLAME: + { + KURL url; + int urlMode; + int pegRev, startRev, endRev; + TQString pegRevKind, startRevKind, endRevKind; + stream >> url; + stream >> urlMode; +// stream >> pegRev; +// stream >> pegRevKind; + stream >> startRev; + stream >> startRevKind; + stream >> endRev; + stream >> endRevKind; + + blame(url, (UrlMode)urlMode, startRev, startRevKind, endRev, endRevKind); + break; + } + case SVN_INFO: + { + KURL pathOrUrl; + int pegRev, rev; + TQString pegRevKind, revKind; + bool recurse = false; + stream >> pathOrUrl; + stream >> pegRev; + stream >> pegRevKind; + stream >> rev; + stream >> revKind; + stream >> recurse; + svn_info( pathOrUrl, pegRev, pegRevKind, rev, revKind, recurse ); + break; + } + case SVN_COPY: + { + KURL src, dest; + int srcRev; + TQString srcRevKind; + stream >> src; + stream >> srcRev; + stream >> srcRevKind; + stream >> dest; + svn_copy( src, srcRev, srcRevKind, dest ); + break; + } + case SVN_MERGE: + { + KURL src1, src2, wc_target; + int rev1, rev2; + TQString revKind1, revKind2; + bool recurse, ignore_ancestry, force, dry_run; + stream >> src1 >> rev1 >> revKind1; + stream >> src2 >> rev2 >> revKind2; + stream >> wc_target; + stream >> recurse >> ignore_ancestry >> force >> dry_run; + svn_merge( src1, rev1, revKind1, src2, rev2, revKind2, wc_target, + recurse, ignore_ancestry, force, dry_run ); + break; + } + default: + { + kdDebug(9036) << "tdeio_svnProtocol DEFAULT" << endl; + break; + } + } +} +/** + * not used anywhere, anymore +*/ +void tdeio_svnProtocol::popupMessage( const TQString& message ) { +// TQByteArray params; +// TQDataStream stream(params, IO_WriteOnly); +// stream << message; +// +// if ( !dcopClient()->send( "kded","ksvnd","popupMessage(TQString)", params ) ) +// kdWarning() << "Communication with KDED:KSvnd failed" << endl; +} + +void tdeio_svnProtocol::blame( KURL url, UrlMode /*mode*/,/* int pegRev, TQString pegRevKind,*/ int startRev, TQString startRevKind, int endRev, TQString endRevKind ) +{ + kdDebug(9036) << " __TIME__ " << __TIME__ << endl; +// kdDebug(9036) << " PegRev " << pegRev << pegRevKind << endl; + kdDebug(9036) << " StartRev" << startRev << startRevKind << endl; + kdDebug(9036) << " EndRev" << endRev << endRevKind << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + const char* path_or_url = apr_pstrdup( subpool, url.pathOrURL().utf8() );; + + svn_opt_revision_t rev1 = createRevision( startRev, startRevKind, subpool ); + svn_opt_revision_t rev2 = createRevision( endRev, endRevKind, subpool ); +// svn_opt_revision_t revPeg = createRevision( pegRev, pegRevKind, subpool ); + + //initNotifier(false, false, false, subpool); + svn_client_blame_receiver_t receiver = tdeio_svnProtocol::blameReceiver; + svn_error_t *err = svn_client_blame( path_or_url, &rev1, &rev2, receiver, (void*)this, ctx, subpool ); + if ( err ) + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + finished(); + svn_pool_destroy (subpool); + +} + +svn_error_t* tdeio_svnProtocol::blameReceiver( void *baton, apr_int64_t line_no, svn_revnum_t rev, const char *author, const char *date, const char *line, apr_pool_t *pool ) +{ + tdeio_svnProtocol *p = (tdeio_svnProtocol*)baton; + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "LINE", TQString::number(line_no) ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REV", TQString::number(rev) ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "AUTHOR", author ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "DATE", date ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "CONTENT", TQString::fromLocal8Bit(line) ); + + p->incCounter(); + return SVN_NO_ERROR; +} + +/** + KDevelop has no way to retrieve URL of working copy. + Thus retreiving URL from WC should be done here, using subversion native API. + Thus, svn_log should get another flag (bool repositHistory )specifying between file:/// or URL +*/ +void tdeio_svnProtocol::svn_log( int revstart, const TQString& revkindstart, int revend, const TQString& revkindend, + bool discorverChangedPaths, bool strictNodeHistory, + const KURL::List& urls ) +{ +// kdDebug(9036) << " from revision " << revstart << " or " << revkindstart << " to " << " revision " << revend << " or " << revkindend << endl; + kdDebug(9036) << " __TIME__ " << __TIME__ << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + + // TODO HEAD:1 was removed from SVN API 1.2, instead callers should specify HEAD:0 + svn_opt_revision_t rev1 = createRevision( revstart, revkindstart, subpool ); + svn_opt_revision_t rev2 = createRevision( revend, revkindend, subpool ); + + m_counter = 0; + apr_array_header_t *targets = apr_array_make(subpool, 1+urls.count(), sizeof(const char *)); + + for ( TQValueListConstIterator it = urls.begin(); it != urls.end() ; ++it ) { + KURL nurl = *it; + const char *path = + apr_pstrdup( subpool, svn_path_canonicalize( nurl.pathOrURL().utf8(), subpool ) ); + kdDebug(9036) << path << endl; + *(( const char ** )apr_array_push(( apr_array_header_t* )targets)) = path; + + setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "requrl", nurl.pathOrURL() ); + incCounter(); + } + + svn_log_message_receiver_t receiver = tdeio_svnProtocol::receiveLogMessage; + svn_error_t *err = svn_client_log2(targets, &rev1, &rev2, 0, discorverChangedPaths, strictNodeHistory, receiver, this, ctx, subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +// save for one revision +svn_error_t* tdeio_svnProtocol::receiveLogMessage(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, + const char *author, const char *date, const char *message, apr_pool_t *pool ) +{ + tdeio_svnProtocol *p = (tdeio_svnProtocol*)baton; + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number(revision) ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "author", author ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "date", date ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "logmsg", TQString::fromLocal8Bit(message) ); + if( changed_paths != NULL ){ + TQString pathlist; + void *onePath; + const char *pathkey; + apr_hash_index_t *hi; + for (hi = apr_hash_first(pool, changed_paths); hi; hi = apr_hash_next(hi)) { + apr_hash_this(hi, (const void**) &pathkey, NULL, &onePath); + svn_log_changed_path_t *cp = (svn_log_changed_path_t*)onePath; + kdDebug(9036) << "OnePath: " << cp->copyfrom_path << " and key: " << pathkey << endl; + pathlist += cp->action; + pathlist += " "; +// pathlist += cp->copyfrom_path; + pathlist += pathkey; + pathlist += "\n"; + } + kdDebug(9036) << "pathlist: " << pathlist <setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "pathlist", pathlist ); + } + p->incCounter(); + return SVN_NO_ERROR; +} + +svn_opt_revision_t tdeio_svnProtocol::createRevision( int revision, const TQString& revkind, apr_pool_t *pool ) { + svn_opt_revision_t result;//,endrev; + // TODO support svn_opt_revision_date + if ( revision != -1 ) { + result.value.number = revision; + result.kind = svn_opt_revision_number; + } else if ( revkind == "WORKING" ) { + result.kind = svn_opt_revision_working; + } else if ( revkind == "BASE" ) { + result.kind = svn_opt_revision_base; + } else if ( revkind == "HEAD" ) { + result.kind = svn_opt_revision_head; + } else if ( revkind == "COMMITTED" ) { + result.kind = svn_opt_revision_committed; + } else if ( revkind == "PREV" ) { + result.kind = svn_opt_revision_previous; + } +// } else if ( !revkind.isNull() ) { +// svn_opt_parse_revision(&result,&endrev,revkind.utf8(),pool); + else if ( revkind == "UNSPECIFIED" ){ + result.kind = svn_opt_revision_unspecified; + } + else { + result.kind = svn_opt_revision_unspecified; + } + return result; +} + +void tdeio_svnProtocol::svn_diff(const KURL & url1, const KURL& url2,int rev1, int rev2,const TQString& revkind1,const TQString& revkind2,bool recurse, bool pegdiff ) +{ + kdDebug(9036) << "tdeio_svn::diff : " << url1.path() << " at revision " << rev1 << " or " << revkind1 << " with " + << url2.path() << " at revision " << rev2 << " or " << revkind2 + << endl ; + + apr_pool_t *subpool = svn_pool_create (pool); + apr_array_header_t *options = svn_cstring_split( "", "\t\r\n", TRUE, subpool ); + +// KURL nurl1 = url1; +// KURL nurl2 = url2; +// nurl1.setProtocol( chooseProtocol( url1.protocol() ) ); //svn+https -> https for eg +// nurl2.setProtocol( chooseProtocol( url2.protocol() ) ); +// recordCurrentURL( nurl1 ); +// TQString source = makeSvnURL( nurl1 ); +// TQString target = makeSvnURL( nurl2 ); + +// const char *path1 = svn_path_canonicalize( apr_pstrdup( subpool, source.utf8() ), subpool ); +// const char *path2 = svn_path_canonicalize( apr_pstrdup( subpool, target.utf8() ), subpool ); + + //remove file:/// so we can diff for working copies, needs a better check (so we support URL for file:/// _repositories_ ) +// if ( nurl1.protocol() == "file" ) { +// path1 = svn_path_canonicalize( apr_pstrdup( subpool, nurl1.path().utf8() ), subpool ); +// } +// if ( nurl2.protocol() == "file" ) { +// path2 = svn_path_canonicalize( apr_pstrdup( subpool, nurl2.path().utf8() ), subpool ); +// } + + // all the commentted codes above are redundancy. url1/url2 is only file:// , svn:// or https:// + // svn+https etc. are not handed out here. + const char *path1 = apr_pstrdup( subpool, url1.pathOrURL().utf8() ); + const char *path2 = apr_pstrdup( subpool, url2.pathOrURL().utf8() );; + + kdDebug( 9036 ) << "1 : " << path1 << " 2: " << path2 << endl; + + svn_opt_revision_t revision1,revision2; + revision1 = createRevision(rev1, revkind1, subpool); + revision2 = createRevision(rev2, revkind2, subpool); + + char *templ; + templ = apr_pstrdup ( subpool, "/tmp/tmpfile_XXXXXX" ); + apr_file_t *outfile = NULL; + apr_file_mktemp( &outfile, templ , APR_READ|APR_WRITE|APR_CREATE|APR_TRUNCATE, subpool ); + + initNotifier(false, false, false, subpool); + svn_error_t *err = 0; + if( pegdiff ){ + svn_opt_revision_t peg_rev = createRevision(-1, "BASE", subpool ); + err = svn_client_diff_peg( options, path1, &peg_rev, &revision1, &revision2, + recurse, false, false, outfile, NULL, ctx, subpool ); + } else{ + err = svn_client_diff( options, path1, &revision1, path2, &revision2, recurse, + false, false, outfile, NULL, ctx, subpool ); + } + + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + //read the content of the outfile now + TQStringList tmp; + apr_file_close(outfile); + TQFile file(templ); + if ( file.open( IO_ReadOnly ) ) { + TQTextStream stream( &file ); + TQString line; + while ( !stream.atEnd() ) { + line = stream.readLine(); + tmp << line; + } + file.close(); + } + for ( TQStringList::Iterator itt = tmp.begin(); itt != tmp.end(); itt++ ) { + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "diffresult", ( *itt ) ); + m_counter++; + } + //delete temp file + file.remove(); + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::svn_switch( const KURL& wc, const KURL& repos, int revnumber, const TQString& revkind, bool recurse) { + kdDebug(9036) << "tdeio_svn::switch : " << wc.path() << " at revision " << revnumber << " or " << revkind << endl ; + + apr_pool_t *subpool = svn_pool_create (pool); + + KURL nurl = repos; + KURL dest = wc; + nurl.setProtocol( chooseProtocol( repos.protocol() ) ); + dest.setProtocol( "file" ); +// recordCurrentURL( nurl ); +// TQString source = dest.path(); +// TQString target = makeSvnURL( repos ); + + const char *path = svn_path_canonicalize( apr_pstrdup( subpool, dest.path().utf8() ), subpool ); + const char *url = svn_path_canonicalize( apr_pstrdup( subpool, nurl.url().utf8() ), subpool ); + kdDebug(9036) << " WC path: " << path << " Repository URL: " << url << endl; + + svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_switch (NULL/*result revision*/, path, url, &rev, recurse, ctx, subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::svn_switch_relocate( const KURL &wc, const KURL &origUrl, const KURL &newUrl, + bool recurse ) +{ + apr_pool_t *subpool = svn_pool_create( pool ); + + const char *wcPath = svn_path_canonicalize( apr_pstrdup( subpool, wc.path().utf8() ), subpool ); + const char *fromUrl = apr_pstrdup( subpool, origUrl.url().utf8() ); + const char *toUrl = apr_pstrdup( subpool, newUrl.url().utf8() ); + kdDebug(9036) << " WC path: " << wcPath << " from: " << fromUrl << " to: " << toUrl << endl; + + svn_error_t *err = svn_client_relocate( wcPath, fromUrl, toUrl, recurse, ctx, pool ); + + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); + svn_pool_destroy (subpool); + return; + } + m_counter = 0L; + setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", + TQString("switched to %1").arg( toUrl ) ); + finished(); + svn_pool_destroy( subpool ); +} + +void tdeio_svnProtocol::update( const KURL::List &list, int revnumber, const TQString& revkind ) { + kdDebug(9036) << "tdeio_svn::update : __TIME__" << __TIME__ << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + + apr_array_header_t *targets = apr_array_make(subpool, 1+list.count(), sizeof(const char *)); + svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); + + for( TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it ){ + KURL nurl = *it; + *( const char ** )apr_array_push(targets) = svn_path_canonicalize( nurl.path().utf8(), subpool ); + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_update2( NULL, targets, &rev, + true/*recurse*/, false/*ignore_external*/, + ctx, subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::import( const KURL& repos, const KURL& wc ) { + kdDebug(9036) << "tdeio_svnProtocol::import() : " << wc.url() << " into " << repos.url() << endl; + + apr_pool_t *subpool = svn_pool_create (pool); +// svn_client_commit_info_t *commit_info = +// (svn_client_commit_info_t*) apr_palloc( subpool, sizeof(svn_client_commit_info_t) ); + svn_commit_info_t *commit_info = svn_create_commit_info( subpool ); + bool nonrecursive = false; + + const char *path = apr_pstrdup( subpool, svn_path_canonicalize( wc.path().utf8(), subpool ) ); + const char *url = apr_pstrdup( subpool, svn_path_canonicalize( repos.url().utf8(), subpool ) ); + + initNotifier(false, false, false, subpool); + kdDebug(9036) << " Executing import: " << path << " to " << url << endl; + + svn_error_t *err = svn_client_import2(&commit_info, path, url, nonrecursive, false, ctx, subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + svn_pool_destroy (subpool); + finished(); +} + +void tdeio_svnProtocol::checkout( const KURL& repos, const KURL& wc, int revnumber, const TQString& revkind ) { + kdDebug(9036) << "tdeio_svn::checkout : " << repos.url() << " into " << wc.path() << " at revision " << revnumber << " or " << revkind << endl ; + + apr_pool_t *subpool = svn_pool_create (pool); + KURL nurl = repos; + KURL dest = wc; + nurl.setProtocol( chooseProtocol( repos.protocol() ) ); + dest.setProtocol( "file" ); + TQString target = makeSvnURL( repos ); + recordCurrentURL( nurl ); + TQString dpath = dest.path(); + + //find the requested revision + svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); + + initNotifier(true, false, false, subpool); + svn_error_t *err = svn_client_checkout (NULL/* rev actually checkedout */, svn_path_canonicalize( target.utf8(), subpool ), svn_path_canonicalize ( dpath.utf8(), subpool ), &rev, true, ctx, subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::commit(const KURL::List& wc) +{ + commit2(true, true, wc); +} + +void tdeio_svnProtocol::commit2(bool recurse, bool keeplocks, const KURL::List& wc) { + kdDebug(9036) << "tdeio_svnProtocol::commit2() : " << wc << endl; + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + + apr_array_header_t *targets = apr_array_make(subpool, 1+wc.count(), sizeof(const char *)); + + for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { + KURL nurl = *it; + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); + } + + initNotifier(false, false, false, subpool); + kdDebug(9036) << "recurse: " << recurse << " keeplocks: " << keeplocks <apr_err, errbuf, 512); + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) + "\n: " + TQString::fromLocal8Bit(errbuf) ); + svn_pool_destroy (subpool); + return; + } + + if ( commit_info ) { + for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { + KURL nurl = *it; + nurl.setProtocol( "file" ); + + TQString userstring = i18n ( "Nothing to commit." ); + if ( SVN_IS_VALID_REVNUM( commit_info->revision ) ) + userstring = i18n( "Committed revision %1." ).arg(commit_info->revision); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "path", nurl.path() ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "action", "0" ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "kind", "0" ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "mime_t", "" ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "content", "0" ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "prop", "0" ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "rev" , TQString::number( commit_info->revision ) ); + setMetaData(TQString::number( m_counter ).rightJustify( 10,'0' )+ "string", userstring ); + m_counter++; + } + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::add(const KURL::List& list) { + kdDebug(9036) << "tdeio_svnProtocol::add() __TIME__" << __TIME__ << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + bool nonrecursive = false; + initNotifier(false, false, false, subpool); + + svn_error_t *err = NULL; + for( TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it ){ + + KURL nurl = (*it); + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + kdDebug(9036) << " Schedule to Add: " << nurl.path().utf8() << endl; + err = svn_client_add( svn_path_canonicalize( nurl.path().utf8(), subpool ), + nonrecursive, ctx, subpool); + if( err ) break; + } + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::wc_delete(const KURL::List& wc) { + kdDebug(9036) << "tdeio_svnProtocol::wc_delete() : " << wc << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_client_commit_info_t *commit_info = NULL; + bool force = false; + + apr_array_header_t *targets = apr_array_make(subpool, 1+wc.count(), sizeof(const char *)); + + for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { + KURL nurl = *it; + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_delete(&commit_info,targets,force,ctx,subpool); + + if ( err ) + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::wc_revert(const KURL::List& wc) { + kdDebug(9036) << "tdeio_svnProtocol::revert() : " << wc << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + bool nonrecursive = false; + + apr_array_header_t *targets = apr_array_make(subpool, 1 + wc.count(), sizeof(const char *)); + + for ( TQValueListConstIterator it = wc.begin(); it != wc.end() ; ++it ) { + KURL nurl = *it; + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + (*(( const char ** )apr_array_push(( apr_array_header_t* )targets)) ) = svn_path_canonicalize( nurl.path().utf8(), subpool ); + } + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_revert(targets,nonrecursive,ctx,subpool); + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit( err->message ) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::wc_status(const KURL& wc, bool checkRepos, bool fullRecurse, bool getAll, int revnumber, const TQString& revkind) { + kdDebug(9036) << "tdeio_svnProtocol::wc_status() : " << wc.url() << " checkRepos " << checkRepos << " fullRecurse " << fullRecurse << " getAll " << getAll << endl; + + wc_status2( wc, checkRepos, fullRecurse, getAll, false, revnumber, revkind ); +} + +void tdeio_svnProtocol::wc_status2(const KURL& wc, bool checkRepos, bool fullRecurse, bool getAll, bool noIgnore, int revnumber, const TQString& revkind) { + kdDebug(9036) << "tdeio_svnProtocol::wc_status2() : " << wc.url() << " checkRepos " << checkRepos << " fullRecurse " << fullRecurse << " getAll " << getAll << " noIgnore " << noIgnore << " revnumber " << revnumber << " revkind " << revkind << endl; + kdDebug(9036) << " __TIME__ " << __TIME__ << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_revnum_t result_rev; + + KURL nurl = wc; + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + + svn_opt_revision_t rev = createRevision( revnumber, revkind, subpool ); + + initNotifier(false, false, false, subpool); + + svn_error_t *err = svn_client_status(&result_rev, svn_path_canonicalize( nurl.path().utf8(), subpool ), &rev, tdeio_svnProtocol::status, this, fullRecurse, getAll, checkRepos, noIgnore, ctx, subpool); + + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::svn_info( KURL pathOrUrl, int pegRev, TQString pegRevKind, int rev, TQString revKind, bool recurse ) +{ + kdDebug(9036) << " tdeio_svnProtocol::svn_info(): pegRev " << pegRev << " pegKind " << pegRevKind << " rev " << rev << " revKind " << revKind << " recurse " << recurse << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + svn_opt_revision_t peg_rev = createRevision( pegRev, pegRevKind, subpool ); + svn_opt_revision_t revision = createRevision( rev, revKind, subpool ); + + svn_error_t *err = svn_client_info( pathOrUrl.pathOrURL().utf8(), + &peg_rev, &revision, + tdeio_svnProtocol::infoReceiver, + this, + recurse, + ctx, pool ); + + if ( err ){ + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(err->message) ); + svn_pool_destroy (subpool); + return; + } + svn_pool_destroy( subpool ); + finished(); +} + +svn_error_t* tdeio_svnProtocol::infoReceiver( void *baton, const char *path, + const svn_info_t *info, apr_pool_t *pool) +{ + tdeio_svnProtocol *p= (tdeio_svnProtocol*)baton ; + if( !p ) + return SVN_NO_ERROR; + + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "PATH", TQString::fromUtf8( path )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "URL", TQString( info->URL ) ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REV", TQString::number( info->rev )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "KIND", TQString::number( info->kind )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REPOS_ROOT_URL", TQString( info->repos_root_URL ) ); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "REPOS_UUID", TQString(info->repos_UUID) ); + p->incCounter(); + + return SVN_NO_ERROR; +} + +void tdeio_svnProtocol::svn_copy( const KURL &srcUrl, int srcRev, const TQString &srcRevKind, + const KURL &destUrl ) +{ + kdDebug(9036) << " tdeio: svn_copy src: " << srcUrl << " Dest Url: " << destUrl << " revnum: " << srcRev << " revKind: " << srcRevKind << endl; + apr_pool_t *subpool = svn_pool_create (pool); + svn_commit_info_t *commit_info = svn_create_commit_info( subpool ); + + svn_opt_revision_t rev = createRevision( srcRev, srcRevKind, subpool ); + + // TODO more elegant notification mechanism + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_copy2( &commit_info, + srcUrl.pathOrURL().utf8(), &rev, + destUrl.pathOrURL().utf8(), + ctx, subpool); + + if ( err ) { + apr_status_t errcode = err->apr_err; + char buf[512]; + svn_strerror(errcode, buf, 512); + error( TDEIO::ERR_SLAVE_DEFINED, TQString::fromLocal8Bit(buf) ); + svn_pool_destroy (subpool); + return; + } + + if( commit_info ){ + setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", + i18n("Copied Revision %1").arg( commit_info->revision) ); + } else { + setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", + i18n("Copied") ); + } + + finished(); + svn_pool_destroy (subpool); +} + +void tdeio_svnProtocol::svn_merge(const KURL &src1, int revNum1, TQString revKind1, + const KURL &src2, int revNum2, TQString revKind2, + const KURL &target_wc, + bool recurse, bool ignore_ancestry, bool force, bool dry_run ) +{ + kdDebug(9036) << " TDEIO::svn_merge src1 " << src1.pathOrURL().utf8() << " src2 " << src2.pathOrURL().utf8() << " target " << target_wc.pathOrURL().utf8() << endl; + apr_pool_t *subpool = svn_pool_create( pool ); + + svn_opt_revision_t rev1 = createRevision( revNum1, revKind1, subpool ); + svn_opt_revision_t rev2 = createRevision( revNum2, revKind2, subpool ); + + initNotifier( false, false, false, subpool ); + svn_error_t *err = svn_client_merge( src1.pathOrURL().utf8(), &rev1, + src2.pathOrURL().utf8(), &rev2, + target_wc.pathOrURL().utf8(), + recurse, ignore_ancestry, force, dry_run, + ctx, pool ); + if ( err ) { + apr_status_t errcode = err->apr_err; + char buf[512]; + svn_strerror(errcode, buf, 512); + error( TDEIO::ERR_SLAVE_DEFINED, + TQString::fromLocal8Bit(err->message) + "\n "+ TQString::fromLocal8Bit(buf) ); + svn_pool_destroy (subpool); + return; + } + + finished(); + svn_pool_destroy( subpool ); +} + +//change the proto and remove trailing / +//remove double / also +TQString tdeio_svnProtocol::makeSvnURL ( const KURL& url ) const { + TQString kproto = url.protocol(); + KURL tpURL = url; + tpURL.cleanPath( true ); + TQString svnUrl; + if ( kproto == "kdevsvn+http" ) { + kdDebug(9036) << "http:/ " << url.url() << endl; + tpURL.setProtocol("http"); + svnUrl = tpURL.url(-1); + return svnUrl; + } + else if ( kproto == "kdevsvn+https" ) { + kdDebug(9036) << "https:/ " << url.url() << endl; + tpURL.setProtocol("https"); + svnUrl = tpURL.url(-1); + return svnUrl; + } + else if ( kproto == "kdevsvn+ssh" ) { + kdDebug(9036) << "svn+ssh:/ " << url.url() << endl; + tpURL.setProtocol("svn+ssh"); + svnUrl = tpURL.url(-1); + return svnUrl; + } + else if ( kproto == "kdevsvn+svn" ) { + kdDebug(9036) << "svn:/ " << url.url() << endl; + tpURL.setProtocol("svn"); + svnUrl = tpURL.url(-1); + return svnUrl; + } + else if ( kproto == "kdevsvn+file" ) { + kdDebug(9036) << "file:/ " << url.url() << endl; + tpURL.setProtocol("file"); + svnUrl = tpURL.url(-1); + //hack : add one more / after file:/ + int idx = svnUrl.find("/"); + svnUrl.insert( idx, "//" ); + return svnUrl; + } + return tpURL.url(-1); +} + +TQString tdeio_svnProtocol::chooseProtocol ( const TQString& kproto ) const { + if ( kproto == "svn+http" ) return TQString( "http" ); + else if ( kproto == "svn+https" ) return TQString( "https" ); + else if ( kproto == "svn+ssh" ) return TQString( "svn+ssh" ); + else if ( kproto == "svn" ) return TQString( "svn" ); + else if ( kproto == "svn+file" ) return TQString( "file" ); + return kproto; +} +/** Certificate is not yet valid. */ +#define SVN_AUTH_SSL_NOTYETVALID 0x00000001 +/** Certificate has expired. */ +#define SVN_AUTH_SSL_EXPIRED 0x00000002 +/** Certificate's CN (hostname) does not match the remote hostname. */ +#define SVN_AUTH_SSL_CNMISMATCH 0x00000004 +/** @brief Certificate authority is unknown (i.e. not trusted) */ +#define SVN_AUTH_SSL_UNKNOWNCA 0x00000008 +/** @brief Other failure. This can happen if neon has introduced a new + * failure bit that we do not handle yet. */ +#define SVN_AUTH_SSL_OTHER 0x40000000 +svn_error_t *tdeio_svnProtocol::trustSSLPrompt(svn_auth_cred_ssl_server_trust_t **cred_p, void *baton, const char *realm, apr_uint32_t failures, const svn_auth_ssl_server_cert_info_t *ci, svn_boolean_t may_save, apr_pool_t *pool) +{ + tdeio_svnProtocol *p = (tdeio_svnProtocol*)baton; + // prepare params. + TQByteArray params, replyData; + TQCString replyType; + TQDataStream arg(params, IO_WriteOnly); + + arg << i18n( "The certificate from the server could not be trusted automatically. Do you want to trust this certificate? " ); + arg << TQString::fromLocal8Bit(ci->hostname); + arg << TQString::fromLocal8Bit(ci->fingerprint); + arg << TQString::fromLocal8Bit(ci->valid_from) << TQString::fromLocal8Bit(ci->valid_until); + arg << TQString::fromLocal8Bit(ci->issuer_dname) << TQString::fromLocal8Bit(ci->ascii_cert) ; + // call dcop + int ret = p->dcopClient()->call( "kded", "kdevsvnd", + "sslServerTrustPrompt(TQString, TQString, TQString, TQString, TQString, TQString, TQString)", + params, replyType, replyData ); + if (!ret){ + kdWarning() << " failed to prompt SSL_Server_Trust_Prompt " << endl; + return SVN_NO_ERROR; + } + if (replyType != "int"){ + kdWarning() << " abnormal reply type " << endl; + return SVN_NO_ERROR; + } + int resultCode; + TQDataStream replyStream( replyData, IO_ReadOnly ); + replyStream >> resultCode; + + if( resultCode == -1 ){ + kdWarning() << " SSL server trust rejected " << endl; + *cred_p = 0L; //FIXME when rejected, maybe more elegant methods.. + } else if( resultCode == 0 ){ //accept once + *cred_p = (svn_auth_cred_ssl_server_trust_t*)apr_pcalloc (pool, sizeof (svn_auth_cred_ssl_server_trust_t)); + kdDebug(9036) << " accept once " << endl; + (*cred_p)->may_save = false; + (*cred_p)->accepted_failures = 0; + } else if( resultCode == 1 ){ //accept permanently + *cred_p = (svn_auth_cred_ssl_server_trust_t*)apr_pcalloc (pool, sizeof (svn_auth_cred_ssl_server_trust_t)); + kdDebug(9036) << " accept permanently " << endl; + (*cred_p)->may_save = true; + (*cred_p)->accepted_failures = failures; + } else{ + kdWarning() << " SSL server trust failed for some reason" << endl; + *cred_p = 0L; + } + + return SVN_NO_ERROR; +} +/** TODO fully implemented, but there is no way to test this yet.*/ +svn_error_t *tdeio_svnProtocol::clientCertSSLPrompt( + svn_auth_cred_ssl_client_cert_t **cred_p, void *baton, const char *realm, svn_boolean_t may_save, apr_pool_t *pool) +{ + kdDebug(9036) << " clientCertSSLPrompt " << endl; +// tdeio_svnProtocol *p = (tdeio_svnProtocol*)baton; +// TQByteArray reply; +// TQByteArray params; +// TQCString replyType; +// call dcop +// if (!p->dcopClient()->call("kded","kdevsvnd", "sslCertFile()",params,replyType,reply)) { +// kdWarning()<<" Communication with dcop failed - fail to get certfile "<> fileName; +// allocate memory +// *cred_p = (svn_auth_cred_ssl_client_cert_t*) apr_palloc (pool, sizeof(svn_auth_cred_ssl_client_cert_t)); +// (*cred_p)->cert_file = apr_pstrdup( pool, fileName.utf8() ); +// (*cred_p)->may_save = may_save; + return SVN_NO_ERROR; +} + +/** TODO fully implemented, but there is no way to test this yet.*/ +svn_error_t *tdeio_svnProtocol::clientCertPasswdPrompt( + svn_auth_cred_ssl_client_cert_pw_t **cred_p, void *baton, const char *realm, svn_boolean_t may_save, apr_pool_t *pool) +{ + kdDebug(9036) << " Password Prompt Callback " << endl; + kdDebug(9036) << " realm " << realm << " <--realm " << endl; +// tdeio_svnProtocol *p = ( tdeio_svnProtocol* )baton; +// // prepare dcop +// TQByteArray reply; +// TQByteArray params; +// TQCString replyType; +// TQDataStream arg( params, IO_WriteOnly ); +// arg << i18n( "Enter password for subversion repository access" ) + "\n" + TQString(realm); +// // call dcop +// if (!p->dcopClient()->call("kded","kdevsvnd", "sslPasswdDlg(TQString)",params,replyType,reply)) { +// kdWarning()<<" Communication with dcop failed - fail to show passwd dlg"<> retstr; +// +// if( retstr.left(1) == "-1" ){ +// kdDebug(9036) << " Null string received for passwd " << endl; +// } else{ +// passwd = retstr.right( retstr.length() - 1 ); +// kdDebug(9036) << " PassWD : " << passwd << endl; +// } +// +// svn_auth_cred_ssl_client_cert_pw_t *newcred = (svn_auth_cred_ssl_client_cert_pw_t*) apr_palloc (pool, sizeof (svn_auth_cred_ssl_client_cert_pw_t ) ); +// +// newcred->password = apr_pstrdup(pool, (const char*) passwd ); +// newcred->may_save = false; +// *cred_p = newcred; + + return SVN_NO_ERROR; +} + + +svn_error_t *tdeio_svnProtocol::commitLogPrompt( const char **log_msg, const char **file, + apr_array_header_t *commit_items, void *baton, apr_pool_t *pool ) +{ + *file = NULL; // if omitting this, it will segfault at import operation. + TQCString replyType; + TQByteArray params; + TQByteArray reply; + TQString result;// slist; + TQStringList slist; + tdeio_svnProtocol *p = ( tdeio_svnProtocol* )baton; + svn_stringbuf_t *message = NULL; + + for (int i = 0; i < commit_items->nelts; i++) { + TQString list; + svn_client_commit_item_t *item = ((svn_client_commit_item_t **) commit_items->elts)[i]; + const char *path = item->path; + char text_mod = '_', prop_mod = ' '; + + if (! path) + path = item->url; + else if (! *path) + path = "."; + + if (! path) + path = "."; + + if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) && (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)) + text_mod = 'R'; + else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD) + text_mod = 'A'; + else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) + text_mod = 'D'; + else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_TEXT_MODS) + text_mod = 'M'; + if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_PROP_MODS) + prop_mod = 'M'; + + list += text_mod; + list += " "; + list += prop_mod; + list += " "; + list += path; + kdDebug(9036) << " Commiting items : " << list << endl; + slist << list; +// slist += list; + } + + TQDataStream stream(params, IO_WriteOnly); + stream << slist.join("\n"); + + kdDebug(9036) << " __TIME__ " << __TIME__ << endl; + if ( !p->dcopClient()->call( "kded","kdevsvnd","commitDialog(TQString)", params, replyType, reply ) ) { + kdWarning() << "Communication with KDED:KDevSvnd failed" << endl; + svn_error_t *err = svn_error_create( SVN_ERR_EXTERNAL_PROGRAM, NULL, + apr_pstrdup( pool, "Fail to call kded_kdevsvnd via DCOP. If this is your first problem, try to restart KDE" ) ); + return err; + } + + if ( replyType != TQSTRING_OBJECT_NAME_STRING ) { + kdWarning() << "Unexpected reply type" << endl; + svn_error_t *err = svn_error_create( SVN_ERR_EXTERNAL_PROGRAM, NULL, + apr_pstrdup( pool, "Fail to call kded_kdevsvnd via DCOP." ) ); + return err; + } + + TQDataStream stream2 ( reply, IO_ReadOnly ); + stream2 >> result; + + if ( result.isNull() ) { //cancelled + *log_msg = NULL; + svn_error_t *err = svn_error_create( SVN_ERR_CANCELLED, NULL, + apr_pstrdup( pool, "Commit interruppted" ) ); + return err; + } + + message = svn_stringbuf_create( result.utf8(), pool ); + *log_msg = message->data; + + return SVN_NO_ERROR; +} + +void tdeio_svnProtocol::notify(void *baton, const char *path, svn_wc_notify_action_t action, svn_node_kind_t kind, const char *mime_type, svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state, svn_revnum_t revision) { + kdDebug(9036) << "NOTIFY : " << path << " updated at revision " << revision << " action : " << action << ", kind : " << kind << " , content_state : " << content_state << ", prop_state : " << prop_state << endl; + + TQString userstring; + struct notify_baton *nb = ( struct notify_baton* ) baton; + + //// Convert notification to a user readable string + switch ( action ) { + case svn_wc_notify_add : //add + if (mime_type && (svn_mime_type_is_binary (mime_type))) + userstring = i18n( "A (bin) %1" ).arg( path ); + else + userstring = i18n( "A %1" ).arg( path ); + break; + case svn_wc_notify_copy: //copy + userstring = i18n( "Copied %1 " ).arg( path ); + break; + case svn_wc_notify_delete: //delete + nb->received_some_change = TRUE; + userstring = i18n( "D %1" ).arg( path ); + break; + case svn_wc_notify_restore : //restore + userstring=i18n( "Restored %1." ).arg( path ); + break; + case svn_wc_notify_revert : //revert + userstring=i18n( "Reverted %1." ).arg( path ); + break; + case svn_wc_notify_failed_revert: //failed revert + userstring=i18n( "Failed to revert %1.\nTry updating instead." ).arg( path ); + break; + case svn_wc_notify_resolved: //resolved + userstring=i18n( "Resolved conflicted state of %1." ).arg( path ); + break; + case svn_wc_notify_skip: //skip + if ( content_state == svn_wc_notify_state_missing ) + userstring=i18n("Skipped missing target %1.").arg( path ); + else + userstring=i18n("Skipped %1.").arg( path ); + break; + case svn_wc_notify_update_delete: //update_delete + nb->received_some_change = TRUE; + userstring=i18n( "D %1" ).arg( path ); + break; + case svn_wc_notify_update_add: //update_add + nb->received_some_change = TRUE; + userstring=i18n( "A %1" ).arg( path ); + break; + case svn_wc_notify_update_update: //update_update + { + /* If this is an inoperative dir change, do no notification. + An inoperative dir change is when a directory gets closed + without any props having been changed. */ + if (! ((kind == svn_node_dir) + && ((prop_state == svn_wc_notify_state_inapplicable) + || (prop_state == svn_wc_notify_state_unknown) + || (prop_state == svn_wc_notify_state_unchanged)))) { + nb->received_some_change = TRUE; + + if (kind == svn_node_file) { + if (content_state == svn_wc_notify_state_conflicted) + userstring = "C"; + else if (content_state == svn_wc_notify_state_merged) + userstring = "G"; + else if (content_state == svn_wc_notify_state_changed) + userstring = "U"; + } + + if (prop_state == svn_wc_notify_state_conflicted) + userstring += "C"; + else if (prop_state == svn_wc_notify_state_merged) + userstring += "G"; + else if (prop_state == svn_wc_notify_state_changed) + userstring += "U"; + else + userstring += " "; + + if (! ((content_state == svn_wc_notify_state_unchanged + || content_state == svn_wc_notify_state_unknown) + && (prop_state == svn_wc_notify_state_unchanged + || prop_state == svn_wc_notify_state_unknown))) + userstring += TQString( " " ) + path; + } + break; + } + case svn_wc_notify_update_completed: //update_completed + { + if (! nb->suppress_final_line) { + if (SVN_IS_VALID_REVNUM (revision)) { + if (nb->is_export) { + if ( nb->in_external ) + userstring = i18n("Exported external at revision %1.").arg( revision ); + else + userstring = i18n("Exported revision %1.").arg( revision ); + } else if (nb->is_checkout) { + if ( nb->in_external ) + userstring = i18n("Checked out external at revision %1.").arg( revision ); + else + userstring = i18n("Checked out revision %1.").arg( revision); + } else { + if (nb->received_some_change) { + if ( nb->in_external ) + userstring=i18n("Updated external to revision %1.").arg( revision ); + else + userstring = i18n("Updated to revision %1.").arg( revision); + } else { + if ( nb->in_external ) + userstring = i18n("External at revision %1.").arg( revision ); + else + userstring = i18n("At revision %1.").arg( revision); + } + } + } else /* no revision */ { + if (nb->is_export) { + if ( nb->in_external ) + userstring = i18n("External export complete."); + else + userstring = i18n("Export complete."); + } else if (nb->is_checkout) { + if ( nb->in_external ) + userstring = i18n("External checkout complete."); + else + userstring = i18n("Checkout complete."); + } else { + if ( nb->in_external ) + userstring = i18n("External update complete."); + else + userstring = i18n("Update complete."); + } + } + } + } + if (nb->in_external) + nb->in_external = FALSE; + break; + case svn_wc_notify_update_external: //update_external + nb->in_external = TRUE; + userstring = i18n("Fetching external item into %1." ).arg( path ); + break; + case svn_wc_notify_status_completed: //status_completed + if (SVN_IS_VALID_REVNUM (revision)) + userstring = i18n( "Status against revision: %1.").arg( revision ); + break; + case svn_wc_notify_status_external: //status_external + userstring = i18n("Performing status on external item at %1.").arg( path ); + break; + case svn_wc_notify_commit_modified: //commit_modified + userstring = i18n( "Sending %1").arg( path ); + break; + case svn_wc_notify_commit_added: //commit_added + if (mime_type && svn_mime_type_is_binary (mime_type)) { + userstring = i18n( "Adding (bin) %1.").arg( path ); + } else { + userstring = i18n( "Adding %1.").arg( path ); + } + break; + case svn_wc_notify_commit_deleted: //commit_deleted + userstring = i18n( "Deleting %1.").arg( path ); + break; + case svn_wc_notify_commit_replaced: //commit_replaced + userstring = i18n( "Replacing %1.").arg( path ); + break; + case svn_wc_notify_commit_postfix_txdelta: //commit_postfix_txdelta + if (! nb->sent_first_txdelta) { + nb->sent_first_txdelta = TRUE; + userstring=i18n("Transmitting file data "); + } else { + userstring="."; + } + break; + + break; + case svn_wc_notify_blame_revision: //blame_revision + userstring = i18n("Blame %1.").arg(path); + break; + default: + break; + } + //// End convert + tdeio_svnProtocol *p = ( tdeio_svnProtocol* )nb->master; + if (!p) kdDebug(9036) << " Null Pointer at Line " << __LINE__ << endl; + + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , TQString::fromUtf8( path )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "action", TQString::number( action )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "kind", TQString::number( kind )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "mime_t", TQString::fromUtf8( mime_type )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "content", TQString::number( content_state )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( prop_state )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( revision )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "string", userstring ); + kdDebug(9036) << " tdeio_svnProtocol::notify() userstring " << userstring << endl; + p->incCounter(); +} + +void tdeio_svnProtocol::status(void *baton, const char *path, svn_wc_status_t *status) { + kdDebug(9036) << "STATUS : " << path << ", wc text status : " << status->text_status + << ", wc prop status : " << status->prop_status + << ", repos text status : " << status->repos_text_status + << ", repos prop status : " << status->repos_prop_status + << endl; + + TQByteArray params; + tdeio_svnProtocol *p = ( tdeio_svnProtocol* )baton; + + TQDataStream stream(params, IO_WriteOnly); + long int rev = status->entry ? status->entry->revision : 0; + stream << TQString::fromUtf8( path ) << status->text_status << status->prop_status << status->repos_text_status << status->repos_prop_status << rev; + + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path", TQString::fromUtf8( path )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "text", TQString::number( status->text_status )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( status->prop_status )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "reptxt", TQString::number( status->repos_text_status )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "repprop", TQString::number( status->repos_prop_status )); + p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( rev )); + p->incCounter(); +} + +void tdeio_svnProtocol::progressCallback( apr_off_t processed, apr_off_t total, void *baton, apr_pool_t *pool) +{ + tdeio_svnProtocol *p = (tdeio_svnProtocol*)baton; + if( total > -1 ) + p->totalSize( total ); + if( processed > -1 ) + p->processedSize( processed ); +} + +void tdeio_svnProtocol::wc_resolve( const KURL& wc, bool recurse ) { + kdDebug(9036) << "tdeio_svnProtocol::wc_resolve() : " << wc.url() << endl; + + apr_pool_t *subpool = svn_pool_create (pool); + + KURL nurl = wc; + nurl.setProtocol( "file" ); + recordCurrentURL( nurl ); + + initNotifier(false, false, false, subpool); + svn_error_t *err = svn_client_resolved(svn_path_canonicalize( nurl.path().utf8(), subpool ), recurse,ctx,subpool); + if ( err ) + error( TDEIO::ERR_SLAVE_DEFINED, err->message ); + + finished(); + svn_pool_destroy (subpool); +} + +extern "C" +{ + KDE_EXPORT int kdemain(int argc, char **argv) { + TDEInstance instance( "tdeio_kdevsvn" ); + + kdDebug(9036) << "*** Starting tdeio_kdevsvn " << endl; + + if (argc != 4) { + kdDebug(9036) << "Usage: tdeio_kdevsvn protocol domain-socket1 domain-socket2" << endl; + exit(-1); + } + + tdeio_svnProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + kdDebug(9036) << "*** tdeio_kdevsvn Done" << endl; + return 0; + } +} + diff --git a/vcs/subversion/svn_tdeio.h b/vcs/subversion/svn_tdeio.h new file mode 100644 index 00000000..a5415931 --- /dev/null +++ b/vcs/subversion/svn_tdeio.h @@ -0,0 +1,163 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Mickael Marchand + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _svn_H_ +#define _svn_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "subversion_global.h" + +class TQCString; +class tdeio_svnProtocol; + +typedef struct kbaton { + svn_stream_t *target_stream; + svn_stringbuf_t *target_string; + svn_stream_t *string_stream; +} kbaton; + +typedef struct tdeio_svn_callback_baton_t { + const char* base_dir; + apr_hash_t *config; + apr_pool_t *pool; +} tdeio_svn_callback_baton_t; + +typedef struct notify_baton { + svn_boolean_t received_some_change; + svn_boolean_t is_checkout; + svn_boolean_t is_export; + svn_boolean_t suppress_final_line; + svn_boolean_t sent_first_txdelta; + svn_boolean_t in_external; + svn_boolean_t had_print_error; /* Used to not keep printing error messages + when we've already had one print error. */ + apr_pool_t *pool; /* this pool is cleared after every notification, + so don't keep anything here! */ + tdeio_svnProtocol *master; +} notify_baton; + + +class tdeio_svnProtocol : public TDEIO::SlaveBase +{ + public: + tdeio_svnProtocol(const TQCString &pool_socket, const TQCString &app_socket); + virtual ~tdeio_svnProtocol(); + virtual void special( const TQByteArray& data ); + virtual void get(const KURL& url); + virtual void listDir(const KURL& url); + virtual void stat(const KURL& url); + virtual void mkdir(const KURL& url, int permissions); + virtual void mkdir(const KURL::List& list, int permissions); + virtual void del( const KURL& url, bool isfile ); +// virtual void copy(const KURL & src, const KURL& dest, int permissions, bool overwrite); + virtual void rename(const KURL& src, const KURL& dest, bool overwrite); + void checkout( const KURL& repos, const KURL& wc, int revnumber, const TQString& revkind ); + void import( const KURL& repos, const KURL& wc ); + void svn_switch( const KURL& wc, const KURL& url, int revnumber, const TQString& revkind, bool recurse); + void svn_switch_relocate( const KURL &wc, const KURL &origUrl, const KURL &newUrl, + bool recurse ); + void svn_diff( const KURL& url1, const KURL& url2, int rev1, int rev2, const TQString& revkind1, const TQString& revkind2, bool recurse, bool pegdiff); + //TODO fix with svn 1.2 : support a KURL::List -> svn_client_update2() + void update( const KURL::List &list, int revnumber, const TQString& revkind ); + void commit( const KURL::List& wc ); + void commit2( bool recurse, bool keeplocks, const KURL::List& wc ); + void blame( KURL url, SvnGlobal::UrlMode mode, /*int pegRev, TQString pegRevKind,*/ int startRev, TQString startRevKind, int endRev, TQString endRevKind ); + static svn_error_t* blameReceiver( void *baton, apr_int64_t line_no, svn_revnum_t rev, const char *author, const char *date, const char *line, apr_pool_t *pool ); + void svn_log( int revstart, const TQString &revkindstart, int revend, const TQString &revkindend, bool discorverChangedPath, bool strictNodeHistory, const KURL::List& targets ); + static svn_error_t* receiveLogMessage(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool ); + void add( const KURL::List& wcList ); + //these work using the working copy + void wc_resolve( const KURL& wc, bool recurse = true ); + void wc_delete( const KURL::List& wc ); + void wc_revert( const KURL::List& wc ); + void wc_status(const KURL& wc, bool checkRepos=false, bool fullRecurse=true, bool getAll=true, int revnumber=-1, const TQString& revkind="HEAD"); + void wc_status2(const KURL& wc, bool checkRepos=false, bool fullRecurse=true, bool getAll=true, bool noIgnore=false, int revnumber=-1, const TQString& revkind="WORKING"); + void svn_info( KURL pathOrUrl, int pegRev, TQString pegRevKind, int rev, TQString revKind, bool recurse ); + static svn_error_t* infoReceiver( void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool); + void svn_copy( const KURL &srcUrl, int srcRev, const TQString &srcRevKind, const KURL &destUrl ); + void svn_merge( const KURL &src1, int rev1, TQString revKind1, const KURL &src2, int rev2, TQString revKind2, + const KURL &target_wc, + bool recurse, bool ignore_ancestry, bool force, bool dry_run ); + + static svn_error_t* checkAuth(svn_auth_cred_simple_t **cred, void *baton, const char *realm, const char *username, svn_boolean_t may_save, apr_pool_t *pool); + static svn_error_t *trustSSLPrompt(svn_auth_cred_ssl_server_trust_t **cred_p, void *, const char *realm, apr_uint32_t failures, const svn_auth_ssl_server_cert_info_t *cert_info, svn_boolean_t may_save, apr_pool_t *pool); + static svn_error_t *clientCertSSLPrompt(svn_auth_cred_ssl_client_cert_t **cred_p, void *, const char *realm, svn_boolean_t may_save, apr_pool_t *pool); + static svn_error_t *clientCertPasswdPrompt(svn_auth_cred_ssl_client_cert_pw_t **cred_p, void *, const char *realm, svn_boolean_t may_save, apr_pool_t *pool); + static svn_error_t *commitLogPrompt( const char **log_msg, const char **tmp_file, apr_array_header_t *commit_items, void *baton, apr_pool_t *pool ); + static void notify(void *baton, const char *path, svn_wc_notify_action_t action, svn_node_kind_t kind, const char *mime_type, svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state, svn_revnum_t revision); + static void status(void *baton, const char *path, svn_wc_status_t *status); + static void progressCallback( apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool); + + TQString chooseProtocol ( const TQString& kproto ) const; + TQString makeSvnURL ( const KURL& url ) const; + void initNotifier(bool is_checkout, bool is_export, bool suppress_final_line, apr_pool_t *spool); + + void recordCurrentURL(const KURL& url); + void popupMessage( const TQString& message ); + int counter() { return m_counter; } + void incCounter() { m_counter++; } + svn_opt_revision_t createRevision( int revision, const TQString& revkind, apr_pool_t *pool ); + + KURL myURL; + svn_client_ctx_t *ctx; + TDEIO::AuthInfo info; + + enum SVN_METHOD { + SVN_CHECKOUT=1, //KURL repository, KURL workingcopy, int revnumber=-1, TQString revkind(HEAD, ...) //revnumber==-1 => use of revkind + SVN_UPDATE=2, // KURL wc (svn:///tmp/test, int revnumber=-1, TQString revkind(HEAD, ...) // revnumber==-1 => use of revkind + SVN_COMMIT=3, + SVN_LOG=4, + SVN_IMPORT=5, + SVN_ADD=6, + SVN_DEL=7, + SVN_REVERT=8, + SVN_STATUS=9, + SVN_MKDIR=10, + SVN_RESOLVE=11, + SVN_SWITCH=12, + SVN_DIFF=13, + SVN_BLAME=14, + SVN_INFO = 15, + SVN_SWITCH_RELOCATE = 16, + SVN_COPY = 17, + SVN_MERGE = 18, + SVN_COMMIT_2=103, + SVN_STATUS_2=109 + + }; + + private: + bool createUDSEntry( const TQString& filename, const TQString& user, long long int size, bool isdir, time_t mtime, TDEIO::UDSEntry& entry); + apr_pool_t *pool; + unsigned long int m_counter; +}; + +#endif -- cgit v1.2.1