[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesdk/kioslave/svn
From:       Mickael Marchand <marchand () kde ! org>
Date:       2005-03-31 22:20:26
Message-ID: 20050331222026.0CF42647 () office ! kde ! org
[Download RAW message or body]

CVS commit by marchand: 

that's the first time I see a lib that does not support URLs with doubled '/' in it.
so, remove them as much as possible before sending them to subversion library

and while we are at it _also_ remove trailing '/' since the lib does not like them \
too

will be backported after testing


  M +21 -13    svn.cpp   1.56


--- kdesdk/kioslave/svn/svn.cpp  #1.55:1.56
@@ -580,5 +580,6 @@ void kio_svnProtocol::mkdir( const KURL:
         for ( ; it != end; ++it ) {
                 QString cur = makeSvnURL( *it );
-                const char *_target = apr_pstrdup( subpool, cur.utf8() );
+                kdDebug( 7128 ) << "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;  }
@@ -907,10 +908,14 @@ void kio_svnProtocol::import( const KURL
         dest.setProtocol( "file" );
         recordCurrentURL( nurl );
+        dest.cleanPath( true ); // remove doubled '/'
         QString source = dest.path();
-        QString target;
-        target = makeSvnURL( repos );
+        if ( source.endsWith( "/" ) ) 
+                source = source.left( source.length()-1 );
+        QString target = makeSvnURL( repos );
 
         const char *path = svn_path_canonicalize( apr_pstrdup( subpool, \
source.utf8() ), subpool ); +        kdDebug( 7128 ) << "IMPORT SOURCE " << path << \
                endl;
         const char *url = svn_path_canonicalize( apr_pstrdup( subpool, target.utf8() \
), subpool ); +        kdDebug( 7128 ) << "IMPORT TARGET " << url << endl;
 
         initNotifier(false, false, false, subpool);
@@ -1101,36 +1106,39 @@ void kio_svnProtocol::wc_status(const KU
 }
 
+//change the proto and remove trailing /
+//remove double / also 
 QString kio_svnProtocol::makeSvnURL ( const KURL& url ) const {
         QString kproto = url.protocol();
         KURL tpURL = url;
+        tpURL.cleanPath( true );
         QString svnUrl;
         if ( kproto == "svn+http" ) {
-                kdDebug(7128) << "http:/" << url.url() << endl;
+                kdDebug(7128) << "http:/ " << url.url() << endl;
                 tpURL.setProtocol("http");
-                svnUrl = tpURL.url();
+                svnUrl = tpURL.url(-1);
                 return svnUrl;
         }
         else if ( kproto == "svn+https" ) {
-                kdDebug(7128) << "https:/" << url.url() << endl;
+                kdDebug(7128) << "https:/ " << url.url() << endl;
                 tpURL.setProtocol("https");
-                svnUrl = tpURL.url();
+                svnUrl = tpURL.url(-1);
                 return svnUrl;
         }
         else if ( kproto == "svn+ssh" ) {
-                kdDebug(7128) << "svn+ssh:/" << url.url() << endl;
+                kdDebug(7128) << "svn+ssh:/ " << url.url() << endl;
                 tpURL.setProtocol("svn+ssh");
-                svnUrl = tpURL.url();
+                svnUrl = tpURL.url(-1);
                 return svnUrl;
         }
         else if ( kproto == "svn" ) {
-                kdDebug(7128) << "svn:/" << url.url() << endl;
+                kdDebug(7128) << "svn:/ " << url.url() << endl;
                 tpURL.setProtocol("svn");
-                svnUrl = tpURL.url();
+                svnUrl = tpURL.url(-1);
                 return svnUrl;
         }
         else if ( kproto == "svn+file" ) {
-                kdDebug(7128) << "file:/" << url.url() << endl;
+                kdDebug(7128) << "file:/ " << url.url() << endl;
                 tpURL.setProtocol("file");
-                svnUrl = tpURL.url();
+                svnUrl = tpURL.url(-1);
                 //hack : add one more / after file:/
                 int idx = svnUrl.find("/");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic