{"id":273,"date":"2011-10-17T12:40:18","date_gmt":"2011-10-17T12:40:18","guid":{"rendered":"http:\/\/greg.lyonkingdom.com\/?p=273"},"modified":"2011-10-17T18:29:46","modified_gmt":"2011-10-17T18:29:46","slug":"svn-best-practice-1","status":"publish","type":"post","link":"https:\/\/greg.lyonkingdom.com\/?p=273","title":{"rendered":"SVN best practice #1: Check status before updating!"},"content":{"rendered":"<p>I maintain several websites as Subversion Checkouts.\u00a0 I&#8217;ve had great luck with this as long as everyone on my team follows a few rules, and I thought I&#8217;d start saving &amp; sharing some of them here.\u00a0 This brief article explains the use of a couple of key SVN commands.<\/p>\n<p>One of the things I&#8217;ve gotten in the habit of lately is to check the version of each and every file that I&#8217;m about to update whenever I do a big server update like we did last night for a busy website.\u00a0 In this case it was VERY helpful to have done-so because I accidentally released a new\u00a0<em>beta\u00a0<\/em>version of\u00a0 a few files that our client hadn&#8217;t approved yet. \u00a0Since I have the &#8216;list&#8217; of all files that I&#8217;ve changed it&#8217;s quite easy to revert a few if necessary.\u00a0 It works very well.<\/p>\n<div>In brief, here&#8217;s what you do:<\/div>\n<div>Before any update, check the status of all files with this svn command:<\/div>\n<pre><strong><span style=\"font-family: 'courier new',monospace;\">svn status -u<\/span><\/strong><\/pre>\n<div>The status command with the -u option tells SVN to go compare everything locally to what&#8217;s in the repository. \u00a0You get output like this:<\/div>\n<div>\n<pre>\u00a0\u00a0 \u00a0* \u00a0 3362 \u00a0 new_feature\/feature.msi<\/pre>\n<pre>\u00a0\u00a0 \u00a0* \u00a0 3362 \u00a0 new_feature\/feature.exe<\/pre>\n<p>Any file with a * will be updated if you perform an SVN update, but it also tells you what version you&#8217;re currently on. \u00a0Then I updated my website to v3450 (including the not-ready-for-prime-time files). \u00a0Once I realized my error it was a simple matter to do an svn update to a revision as follows:<\/p>\n<pre><strong>svn up -r3362<\/strong><\/pre>\n<\/div>\n<p>I performed this update right inside the &#8216;not-ready-for-prime-time&#8217; folder and it caused these files to update back to the revision closest to 3362. \u00a0BAM! \u00a0Done and Done.\u00a0 Note that this update-to-revision is not sticky, so I&#8217;ll have to be careful if I update the server again before these particular files are approved.\u00a0 Also, note that I&#8217;ve ignored another best-practice here which is that I should have had my developer put this beta area on a <em>branch<\/em>, which would have avoided this issue all-together; but that is a topic for another post.<\/p>\n<div><span style=\"font-family: arial,sans-serif;\">SVN Status can also tell you other important information, here are a couple cases:<br \/>\n<\/span><span style=\"font-family: 'courier new',monospace;\"><strong>? \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 feature.back<br \/>\n<\/strong>The ? lets you know that this file hasn&#8217;t ever been checked in to SVN.<\/span><span style=\"font-family: 'courier new',monospace;\"><strong>M \u00a0 *\u00a0 3362 \u00a0 help.php<br \/>\nthis file has been <span style=\"text-decoration: underline;\">M<\/span>odified <strong>(M) <\/strong>locally without being checked in AND is modified <strong>(*) <\/strong>in SVN. \u00a0Watch out for potential conflicts!<\/strong><\/span><\/p>\n<p>I really, really don&#8217;t like to have me or my programmers editing files right on the production server except in dire circumstances, so I usually go have a talk with someone about it whenever I find these types of entries.\u00a0 I also make sure to clean them up right away once I notice them.<\/p>\n<p>Anyway, I hope you found this helpful.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I maintain several websites as Subversion Checkouts.\u00a0 I&#8217;ve had great luck with this as long as everyone on my team follows a few rules, and I thought I&#8217;d start saving &amp; sharing some of them here.\u00a0 This brief article explains the use of a couple of key SVN commands. One of the things I&#8217;ve gotten [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,8],"tags":[],"_links":{"self":[{"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/posts\/273"}],"collection":[{"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=273"}],"version-history":[{"count":10,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=\/wp\/v2\/posts\/273\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greg.lyonkingdom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}