0

Suppose we manage a site http://example.com and its newer testing version http://new.example.com with Subversion (SVN).

Would the following be a good idea:

If yes, then which software use to update the sites? rsync? What exactly to write in the SVN configuration?

porton
  • 312
  • 1
  • 14

1 Answers1

1

"Manage site with Subversion" is too common and unclean definition. How do you manage?

  • Working Copies are on local Dev-boxes, repository on some special host and sites are unversioned files, result of export repo
  • Sites are additional "update-only" Working Copies of repository

In any case:

  • Two-tier (DEV and PROD spaces) development is widely-used method
  • DEV may reflect state of trunk (no needs for additional branch and merge-to-branch actions), depending from your workflow
  • Shared DEV space for a team of development with unmanaged automatic updates have serious drawback - it case of dumb post-update hook changes in testing of developer one after commit can be overwritten by next commit from another developer two

Answer on question "which software use to update the sites?" depends from answer on question "How sites managed" and "Which access-methods can be used in order to update sites". Because they (software and method) can be

  • svn up
  • scp
  • ftp
  • rsync

and more or less complex post-commit hook

EDIT

In case of unversioned tree as on the same host as repo you can use in post-commit hook

  • Full export of repo-tree: svn export file:///<PATH-TO-REPO> <TEMP-DIR> & mv -r <TEMP-DIR> <SITE-ROOT>

or

  • Export of only changed files in revision: svnlook changed give you list of changed files with relative paths, which you have to collect and copy to correct destination. Sample

>svnlook.exe -r 24 changed .

U trunk/Hello.de.txt

U trunk/Hello.en.txt

U trunk/Hello.fr.txt

You have to process statuses (first column) A|U (added/updated), maybe D also (deleted)

Targets of each commit (pre-check before processing files) can be verified with svnlook dirs-changed. For the same revision as in example above

>svnlook.exe -r 24 dirs-changed .
trunk/
Lazy Badger
  • 3,137
  • 15
  • 13
  • Working Copies are on local Dev-boxes, repository on some special host and sites are unversioned files, result of export repo. The site is running on the same server as SVN server. Overwrites of DEV by an other developer is possible but unlikely, as I am the only Perl developer – porton Jan 23 '13 at 09:41
  • It seems that I need to write a script which will create/update/delete files based on info provided by svnlook. I wonder: Is there already a script for this? – porton Jan 23 '13 at 10:38
  • @porton - http://stackoverflow.com/a/13063724/960558 (first URL to thomasfischer.biz is unreachable for me now) – Lazy Badger Jan 23 '13 at 10:54
  • It seems the script you pointed only updates/creates files but I need also to remove deleted files – porton Jan 23 '13 at 11:02