{"id":92,"date":"2008-05-10T20:29:43","date_gmt":"2008-05-11T01:29:43","guid":{"rendered":"http:\/\/blog.red-bean.com\/sussman\/?p=92"},"modified":"2008-05-10T20:29:57","modified_gmt":"2008-05-11T01:29:57","slug":"subversion-15-merge-tracking-in-a-nutshell","status":"publish","type":"post","link":"http:\/\/blog.red-bean.com\/sussman\/?p=92","title":{"rendered":"Subversion 1.5 merge-tracking in a nutshell"},"content":{"rendered":"<p>As I&#8217;ve mentioned in other posts, the <a href=\"http:\/\/subversion.tigris.org\">Subversion project<\/a> is on the verge of releasing <a href=\"http:\/\/subversion.tigris.org\/svn_1.5_releasenotes.html\">version 1.5<\/a>, a culmination of nearly two years of work.  The release is jam-packed with some huge new features, but the one everyone&#8217;s excited about is &#8220;merge tracking&#8221;.<\/p>\n<p>Merge-tracking is when your version control system keeps track of how lines of development (branches) diverge and re-form together.  Historically, open source tools such as CVS and Subversion haven&#8217;t done this at all;  they&#8217;ve relied on &#8220;advanced&#8221; users carefully examining history and typing arcane commands with just the right arguments.  Branching and merging is possible, but it sure ain&#8217;t easy.  Of course, distributed version control systems have now started to remove the fear and paranoia around branching and merging&mdash;they&#8217;re actually designed around merging as a core competency.  While Subversion 1.5 doesn&#8217;t make it merging as easy as a system like Git or Mercurial, it certainly solves common points of pain.  As a famous quote goes, &#8220;it makes easy things easy, and hard things possible.&#8221;  Subversion is now beginning to match features in larger, commercial tools such as Clearcase and Perforce.<\/p>\n<p>My collaborators and I are gearing up to release a <a href=\"http:\/\/svnbook.red-bean.com\">2nd Edition<\/a> of the free online Subversion book soon (and you should be able to buy it from <a href=\"http:\/\/www.oreilly.com\/\">O&#8217;Reilly<\/a> in hardcopy this summer.)  If you want gritty details about how merging works, you can glance over <a href=\"\">Chapter 4<\/a> right now, but I thought a &#8220;nutshell&#8221; summary would make a great short blog post, just to show people how easy the common case now is.<\/p>\n<ol>\n<li><b>Make a branch for your experimental work:<\/b><br \/>\n<code><br \/>\n$ svn cp trunkURL branchURL<br \/>\n$ svn switch branchURL<\/p>\n<p><\/code>\n<\/li>\n<li><b>Work on the branch for a while:<\/b><br \/>\n<code><br \/>\n# ...edit files<br \/>\n$ svn commit<br \/>\n# ...edit files<br \/>\n$ svn commit<\/p>\n<p><\/code>\n<\/li>\n<li><b>Sync your branch with the trunk, so it doesn&#8217;t fall behind:<\/b><br \/>\n<code><br \/>\n$ svn merge trunkURL<br \/>\n--- Merging r3452 through r3580 into '.':<br \/>\nU    button.c<br \/>\nU    integer.c<br \/>\n...<\/p>\n<p>$ svn commit<\/p>\n<p><\/code>\n<\/li>\n<li><b>Repeat the prior two steps until you&#8217;re done coding.<\/b>\n<\/li>\n<li><b>Merge your branch back into the trunk:<\/b><br \/>\n<code><br \/>\n$ svn switch trunkURL<br \/>\n$ svn merge --reintegrate branchURL<br \/>\n--- Merging differences between repository URLs into '.':<br \/>\nU    button.c<br \/>\nU    integer.c<br \/>\n...<\/p>\n<p>$ svn commit<br \/>\n<\/code>\n<\/li>\n<li><b>Go have a beer, and live in fear of feature branches no more.<\/b><\/li>\n<\/ol>\n<p>Notice how I <em>never<\/em> had to type a single revision number in my example:  Subversion 1.5 knows when the branch was created, which changes need to be synced from branch to trunk, and which changes need to be merged back into the trunk when I&#8217;m done.  It&#8217;s all magic now.  This is how it should have been in the first place.  \ud83d\ude42<\/p>\n<p>Subversion 1.5 isn&#8217;t officially released yet, but we&#8217;re looking for people to test one of our <a href=\"http:\/\/svn.haxx.se\/users\/archive-2008-05\/0109.shtml\">final release candidate source tarballs<\/a>.  <a href=\"http:\/\/www.collab.net\/\">CollabNet<\/a> has also created some nice binary packages for testing, as part of their <a href=\"http:\/\/merge-tracking.open.collab.net\/\">early adopter program<\/a>.  Try it out and report any bugs!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I&#8217;ve mentioned in other posts, the Subversion project is on the verge of releasing version 1.5, a culmination of nearly two years of work. The release is jam-packed with some huge new features, but the one everyone&#8217;s excited about is &#8220;merge tracking&#8221;. Merge-tracking is when your version control system keeps track of how lines [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-computers","category-subversion"],"_links":{"self":[{"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92"}],"version-history":[{"count":0,"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.red-bean.com\/sussman\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}