Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Background: there's a site which I need to edit. The only way to access files is FTP. But since I'm not the only person who will edit it (also I'd like to have ability to roll-back and bunch of other reasons), we need version control system.

Previously (on our own server, where we have root) we used to use SVN with post-commit hook, which updated files it site's directory (site used to be on the same Linux server).

Is it possible to make post-commit hook, that uploads updated files via FTP to the remoted server? Any way to detect 'just updated' files? Maybe ready solution?

share|improve this question
1  
Why you discarded old workflow (from SVN to SITE over FTP)? – Lazy Badger Dec 17 '12 at 4:06
    
I don't have access to target server but FTP. Old workflow was 'SVN directly to SITE', but that was on our own server (added this to OP-post). – Dmitry Dec 17 '12 at 15:34
    
and what?? You can and have to work the same way even in REPO and SITE are different hosts - you just have to ftp instead of cp. I can't see any research job done – Lazy Badger Dec 18 '12 at 5:02

Is it possible to make post-commit hook, that uploads updated files via FTP to the remoted server?

Yes, it's possible

Any way to detect 'just updated' files?

At least two (AFAICR):

  • svn log -v -q -r HEAD REPO-URL (from any location)
  • svnlook changed REPO_PATH (for REPO host, where REPO_PATH is local path on FS)

Well, as I can see, you must to solve two consecutive subtasks in post-commit hook (if you solve correct task: update site from repo, and not inverse perversion^ update repo by changed files from some independent location)

  • build tree of files, affected in revision
  • upload this tree, using pure FTP, on remote host

Solutions for task 1

Any of first three scripts, mentioned by me here (other implementations may exist in wild Net also)

Solution for task 2

Using part of NcFTP Client (NcFTPPut) for uploading tree in easy one-line command

share|improve this answer
    
You a re correct! Thanks for response, I'll try to do this and then post about result. – Dmitry Dec 19 '12 at 17:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .