<p>I've gotten comfy with SVN, and now I need a way to deploy my code to staging or live servers more easily. I'd also like some method for putting build info in the footer of this site to aid in testing. Site is PHP/MySQL.</p>

[{'answer_id': 66699, 'author': 'Yann Ramin', 'author_id': 9167, 'author_profile': 'https://Stackoverflow.com/users/9167', 'pm_score': 2, 'selected': False, 'text': '<p>A script to svn update on an as needed basis. </p>\n\n<p>SVN supports keywords. You can add which keywords you want to expand to the keywords property, and SVN will expand then. See $Id$ or $Rev$, or keywords described in the SVN book.</p>\n'}, {'answer_id': 66717, 'author': 'Staale', 'author_id': 3355, 'author_profile': 'https://Stackoverflow.com/users/3355', 'pm_score': 2, 'selected': False, 'text': '<p>First enable keyword substitution for a file where you wish to have the revision info:</p>\n\n<pre><code>svn propset svn:keywords "Rev" file.txt\n</code></pre>\n\n<p>The add to the file where you want the Revision info stored:</p>\n\n<pre><code>$Rev$\n</code></pre>\n\n<p>Further readings: <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html" rel="nofollow noreferrer">http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html</a></p>\n'}, {'answer_id': 66733, 'author': 'Eric Schoonover', 'author_id': 3957, 'author_profile': 'https://Stackoverflow.com/users/3957', 'pm_score': 2, 'selected': False, 'text': '<p>If you want to update the version number in a projects AssemblyInfo.cs you may be interested in this article:</p>\n\n<p><a href="http://www.codeproject.com/KB/architecture/svn_visual_studio.aspx" rel="nofollow noreferrer">CodeProject: Use Subversion Revision numbers in your Visual Studio Projects</a></p>\n\n<blockquote>\n  <p>If you enable SVN Keywords then every time you check in the project Subversion scans your files for certain "keywords" and replaces the keywords with some information.</p>\n  \n  <p>For example, At the top of my source files I would create a header contain the following keywords:</p>\n  \n  <p>\'$Author:$<br>\n  \'$Id:$<br>\n  \'$Rev:$</p>\n  \n  <p>When I check this file into Subversion these keywords are replaced with the following:</p>\n  \n  <p>\'$Author: paulbetteridge $<br>\n  \'$Id: myfile.vb 145 2008-07-16 15:24:29Z paulbetteridge $<br>\n  \'$Rev: 145 $  </p>\n</blockquote>\n'}, {'answer_id': 66738, 'author': 'mk.', 'author_id': 1797, 'author_profile': 'https://Stackoverflow.com/users/1797', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m a fan of using capistrano for pushes. Refer to <a href="https://stackoverflow.com/questions/18224/whats-the-best-way-to-securely-publish-a-site-post-build#18231">here</a>. </p>\n\n<p>You could use the <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html" rel="nofollow noreferrer">SVN $Rev$ property</a> to get the revision number into your footer. </p>\n'}, {'answer_id': 66741, 'author': 'Loren Segal', 'author_id': 6436, 'author_profile': 'https://Stackoverflow.com/users/6436', 'pm_score': 0, 'selected': False, 'text': '<p>A really simple way to manage this is to setup your app in the following way:</p>\n\n<p>Simply make your deployment app a working copy of your trunk (<code>svn co</code> the project to your /www root) and you run an <code>svn up</code> through an ssh console (<code>ssh user@host.com svn up /path/to/project</code>) when you need to update. You can also rollback with the appropriate checkout mechanisms. This is important: <strong>if you do this, add RewriteRules (or equivalent) to your .htaccess (or equivalent) to disallow access to .svn directories</strong>. If you can\'t do the above, run an <code>svn export</code> through ssh instead (so it won\'t be a \'working copy\'), but this will naturally be slower than doing an <code>up</code>.</p>\n\n<p>Also, you can look at what Ruby on Rails does with Capistrano.. it\'s the same basic concept but supports transactional backups if the update goes wrong in the middle by storing each checkout in a separate folder and symlinking the "latest" to your /www directory.</p>\n'}, {'answer_id': 67177, 'author': 'reefnet_alex', 'author_id': 2745, 'author_profile': 'https://Stackoverflow.com/users/2745', 'pm_score': 2, 'selected': False, 'text': '<p>The properties methods will only give you the last revision number of the file you have the property in, not the head revision of the whole repository (a la the Stack Overflow footer). If you are wanting that, you\'ll need to use <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.ref.svnversion" rel="nofollow noreferrer">svnversion</a>.</p>\n\n<p>I recently started using Capistrano on a project and it superb and very flexible and powerful. I ended up deviating quite far from its normal usage, but it makes one "click" deployment much easier. </p>\n'}, {'answer_id': 69135, 'author': 'Colin Jensen', 'author_id': 9884, 'author_profile': 'https://Stackoverflow.com/users/9884', 'pm_score': 0, 'selected': False, 'text': '<p>The keywords stuff will fail in plenty of cases -- like if you\'ve modified the source before deploying, or if you check in from one directory in your project then a different directory in the same project will have different revision numbers.  Check the docs carefully to make sure the keywords do what you think they do.</p>\n\n<p>The better way is to use the <a href="http://svnbook.red-bean.com/en/1.1/re57.html" rel="nofollow noreferrer">svnversion</a> program to generate information about your checked out directories at compile or deployment time.  Svnversion will show information about the version of ALL of your directories as well as flagging whether or not the source was locally modified.</p>\n'}, {'answer_id': 137805, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>The method I\'ve come up for my php projects, may not be the best method but after some time searching certainly seems to be, is to do a checkout, run a version check, wipe out the .svn folders, and move on. Here is a portion of shell script I\'ve written:</p>\n\n<p>(first, you need the script the checkout your repo)</p>\n\n<pre><code># get the svn revision number and create a RELEASE file\nsvnvers=`svnversion .`\necho "version: $svnvers"\necho "&lt;release&gt;&lt;development&gt;0&lt;/development&gt;&lt;revision&gt;$svnvers&lt;/revision&gt;&lt;/release&gt;" &gt; RELEASE\n\n# remove all .svn directories\nfind . -name .svn -exec rm -rf {} \\;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/66671', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7853/']