0

I did some homework and while I can answer all below questions about exporting SVN repo on Windows (using VisualSVN server), I'm completely lost on Linux as I'm total newbie there.

I want to use SVN's export feature on Linux, to have website updated each time I commit a repository. But there are some problems with that.

I've read out these three: How to use "svn export" command to get a single file from the repository? http://www.duchnik.com/tutorials/2011/07/02/svn-command-reference http://www.picksourcecode.com/ps/ct/161055.php

and figured out following command to be used inside post-commit hook:

svn export --force svn://localhost/repository_name /share/Web/projects/website

Questions:

  1. Anyone has any idea, why it does not work? Changes are commited to repository, but operations ends up with "post-commit hook failed (exit code 255) with no output". And post-commit hook seems to be not fired, as destination website is not updated. I've checked (or even doublechecked) that command itself works like a charm (when called from command-line). It only fails inside post-commit hook. I've tried to add "exit 0" at the end of this file. And of course it is executable. No luck. Still, after many attempts, the same error code.

  2. Why this operation works, even though I haven't provided username and password as params? The "passwd" file inside repository is properly set and any operation from external client requires providing username and password or else fails. Some bug in SVN?

  3. Is there any way to limit files exported to destination to only changed / added / deleted, not to export whole repository after each commit?

  4. Is there anyway to do exactly the same (export), but to an external server, over FTP, instead of my QNAP's local path?

For points three and four I tried to use svn2web tool form SourceForge, but this is rather bad idea and it is not working. It uses pre-commit hook instead of post-commit, which means that any error in it will block developers from commiting their work (in my case -- post-commit -- changes are commited, only not propagated to destination). Their pre-commit hook fails on my server (the same error message as in point one above) and their approach (solution) of adding "svn2web" property to folder properties maybe works for pure Linux Subversion clients but seems to be failling completely when using TortoiseSVN on Windows as SVN client.

I'm wondering, if solution for problem no 1 (and 2-3 and maybe 4) wouldn't be to setup a Local Working Copy inside /share/Web/projects/website and use CRON for perodic updates of this repository? This would always "export" only actual changes and would probably fail without poper login and password. But this seems to be reinventing wheel or forcing to open already open doors.

Thank you in advance for any help.

Community
  • 1
  • 1
trejder
  • 17,148
  • 27
  • 124
  • 216
  • 1. Can be connected to (2) - the user the hook runs under is not authorized and is not the same user as in (2) 2. Are you sure that you are blocking read-only permissions? If 'yes', it may be the case that you've been asked for user/passwd the first time and now it is cached (delete everything in ~/.subversion/auth directory and see what happens). – malenkiy_scot Jun 20 '12 at 13:50
  • About not using the same user - I'm not sure. Maybe you're right. About cashing password - I'm pretty sure. I run export command only three times and each time it worked correctly, without asking me for the password or login. But question about not asking for password was an addition, my curiosity. This is not a huge problem for me, after all. – trejder Jun 20 '12 at 14:41

1 Answers1

1

Some answers in brief:

  1. I would shot that you're running this command as different user than SVN daemon (svnserve) uses to run hooks. That other user (used by SVN) problably hasn't got all the rights required to run export.

  2. Unfortunately, I have no idea. Must be something with your installation of SVN. Of course, this shouldn't happen at all. If repository is properly secured and requires login + password, everyone has to provide it corectly, even for export operation.

  3. You need and extended script, preferebly run as post-commit hook, that will compare current (last one - HEAD) revision with provious one and will export only changed files. This isn't an easy task. Look around in the Internet for ready solutions, before you try to discover wheel again! :]

  4. No directly with extract command of SVN? The easiest way, that comes my mind is to extract to a local path, pack it, send it via FTP and unpack it at destination. Or send directly, file-by-file, if you don't have access to shell at destination, to unpack an archive.

Hope, these will help? :]