Export SVN repository over FTP to a remote server

2019-09-06 16:51发布

问题:

I'm using following command to export my repository to a local path:

svn export --force svn://localhost/repo_name /share/Web/projects/project_name

Is there any, quite easy (Linux newbie here) way to do the same over FTP protocol, to export repository to a remote server?

Last parameter of svn export AFAIK have to be a local path and AFAIK this command does not support giving paths in form of URLs, like for example:

ftp://user:pass@server:path/

So, I thing there should be some script hired here to do the job.

I have asked some people about that, and was advised that the easiest way is to export repository to a local path, transfer it to an FTP server and then purge local path. Unfortunately I failed after first step (extract to local path! :) So, the support question is, if it can be done on-the-fly, or really have to be split into two steps: export + ftp transfer?

Someone also advised me to setup local SVN client on remote server and do simple checkout / update from my repository. But this is solution possible only if everything else fails. As I want to extract pure repository structure, without SVN files, which I would get, when go this way.

BTW: I'm using QNAP TS-210, a simple NAS device, with very limited Linux on board. So, many command-line commands as good as GUI are not available to me.

EDIT: This is second question in my "chain". Even, if you help me to succeed here, I won't be able to automate this job (as I'm willing to) without your help in question "SVN: Force svn daemon to run under different user". Can someone also take a look there, please? Thank you!

回答1:

Well, if you're using Linux, you should be able to mount an ftpfs. I believe there was a module in the Linux kernel for this. Then I think you would also need FUSE.

Basically, if you can mount an ftpfs, you can write your svn export directly to the mounted folder.



回答2:

not sure about FTP, but SSH would be a lot easier, and should have better compression. An example of sending your repo over SSH may look like:

svnadmin dump /path/to/repository |ssh -C username@servername 'svnadmin -q load /path/to/repository/on/server'

URL i found that info was on Martin Ankerl's site

[update]

based on the comment from @trejder on the question, to do an export over ssh, my recomendation would be as follows:

svn export to a folder locally, then use the following command:

cd && tar czv src | ssh example.com 'tar xz'

where src is the folder you exported to, and example.com is the server.

this will take the files in the source folder, tar and gzip them and send them over ssh, then on ssh, extract the files directly to the machine....



回答3:

I wrote this a while back - maybe it would be of some use here: exup