KIO and KFM and copy/move/delete operations

David Faure faure at kde.org
Mon Oct 17 11:43:35 BST 2005


On Monday 17 October 2005 12:01, Rajko Albrecht wrote:
> Hi,
> i'm the author of kdesvn a native subversion client for kde. Inside this 
> project I spoke with the authors of KIO::svn that I integrate both 'cause 
> them do similiar things.
> 
> So I found following problem:
> When doing a copy or move (not simple rename via F2) on directory kfm does 
> following:
> 
> 1. create new dir(s) inside target directory, the whole tree
> 2. copy each single file via a copy/move call to KIO

Is this about file:/ to svn:/, or svn:/ to svn:/ ?

> My question now: 
> Is there any trick to let kfm do the job the KIO[slave] itself? 

Yes, for moving from file:/, but not for copying or moving inside svn:/ at this point.
This could easily be added (to KDE4...) if we agree on the solution.

For moving from file:/, you can add renameFromFile=true in the .protocol file.
For deleting an entire directory in one go (without libkio recursing into each subdir),
you can add deleteRecursive=true in the .protocol file, and then only the toplevel
will be url will be passed to the delete operation.

There isn't a copyRecursive=true though, because there wasn't a case where
it made sense up to now.
By letting kfm (in fact libkio) recurse into directories and copy files one by one, we can handle
in libkio the cases like "the destination already exists, want to rename/overwrite/cancel?" etc.
If the kioslave does the recursion (oh boy this reminds me of KDE 1 :), we can't do
that since kioslaves cannot ask such questions. We can also handle progress info
in a central place, etc.

But if you say it makes sense for kio_svn, which wants to copy entire directories
and simply error out, or give a warning, in case of an already existing file or subdir,
then we could add copyRecursive=true + moveRecursive=true, and call
copy(kurl,kurl)... Hmm, but what if the source is from FTP? Letting the slave
handle the copying itself only works if it can access the source files directly,
i.e. only for file-to-svn or svn-to-svn. OK so copyRecursive would only be
for svn-to-svn [would that also work with different repositories?].

It seems to me that a simpler solution would be to let the slave know
about the beginning and end of a copy, so that it can do the commit at that
point.
beginCopy() -> creates a temp dir
mkdir()-> does a mkdir inside the temp dir
copy() -> for each file, copy into the tempdir
  (or get/put is used if copyFromFile=false or for remote files)
endCopy() -> commit the stuff.
That way it also works with FTP, SMB, etc. as source. I understand that this
might be a rare case for kio_svn, but I don't want to design something in
libkio that breaks network transparency, it would kind of defeat the point :)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kfm-devel mailing list