{"id":6502,"date":"2014-11-07T01:39:24","date_gmt":"2014-11-07T06:39:24","guid":{"rendered":"http:\/\/esr.ibiblio.org\/?p=6502"},"modified":"2014-11-07T12:02:54","modified_gmt":"2014-11-07T17:02:54","slug":"i-wrote-a-version-control-system-today","status":"publish","type":"post","link":"http:\/\/esr.ibiblio.org\/?p=6502","title":{"rendered":"I wrote a version-control system today"},"content":{"rendered":"<p>I wrote a version-control system today.  Yes, an entire VCS.  Took me 14 hours.<\/p>\n<p>Yeah, you&#8217;re looking at me like I&#8217;m crazy.  &#8220;Why,&#8221; you ask, quite reasonably, &#8220;would you want to do a thing like that?  We&#8217;re not short of powerful VCSes these days.<\/p>\n<p>That is true.  But I got to thinking, early this morning, about the fact that I haven&#8217;t been able to settle on just one VCS.  I use git for most things, but there&#8217;s a use case git doesn&#8217;t cover.  I have some document directories in which I have piles of things like HOWTOs which have separate histories from each other.  Changes in them are not correlated, and I want to be able to move them around because I sometimes do that to reorganize them.<\/p>\n<p>What have I been using for this?  Why, RCS.  The ancient Revision Control System, second oldest VCS in existence and clinging tenaciously to this particular niche. It does single-file change histories pretty well, but its UI is horrible.  Worse than git&#8217;s, which is a pretty damning comparison.<\/p>\n<p>Then I got to thinking. If I were going to design a VCS to do this particular single-file, single-user job, what would it look like? Hm.  Sequential integer revision numbers, like Subversion and Mercurial used locally. Lockless operation.  Modern CLI design. Built-in command help.  Interchange with other VCSes via git import streams.  This sounds like it could be <em>nice<\/em>&#8230;<\/p>\n<p>Then, the idea that made it inevitable.  &#8220;I bet.&#8221; I thought, &#8220;I could write this thing as a Python wrapper around RCS tools.  Use them for delta storage but hide all the ugly parts.&#8221;<\/p>\n<p>Thus, SRC.  <a href=\"http:\/\/www.catb.org\/esr\/src\/\">Simple Revision Control, v0.1<\/a>.<\/p>\n<p><!--more--><\/p>\n<p>This first version is a very rough cut.  It does all the basic VCS things &#8211; commits, checkouts, diff listings, tags &#8211; but the implementation is fragile.  The first other person to look at it has reported that it inexplicably fails when you set EDITOR=vi. (UPDATE: This is already fixed.)<\/p>\n<p>Still&#8230;read the <a href=\"http:\/\/www.catb.org\/~esr\/src\/src.html\">manual page<\/a> to see where it&#8217;s going (I wrote the manual page before the code).  Most of the UI is shamelessly swiped from Subversion &#8211; I simplified where it made sense. <\/p>\n<p>Yes, I will implement branching and import\/export.  There will be Emacs VC support, too.  The overall emphasis will be on keeping it simple and light, a handy small tool for the jobs where a real VCS would be overkill.  And if it goes sproing &#8211; hey, the masters are RCS files, you have an easy recovery path.<\/p>\n<p>SRC &#8211; RCS as if user interface mattered.  SRC &#8211; maybe Rome wasn&#8217;t built in a day, but this tool was.  SRC &#8211; when you care enough to use the very least.  Thank you, I&#8217;ll be here all week.<\/p>\n<p>And if you&#8217;re thinking &#8220;Hey, that&#8217;s cheating! You didn&#8217;t really write a VCS, you let RCS do the hard parts!&#8221;, why, doing that is downright traditional.  CVS was implemented &#8211; badly &#8211; the same way.  But we&#8217;ve learned a lot in the quarter-century since, and know what mistakes not to repeat.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wrote a version-control system today. Yes, an entire VCS. Took me 14 hours. Yeah, you&#8217;re looking at me like I&#8217;m crazy. &#8220;Why,&#8221; you ask, quite reasonably, &#8220;would you want to do a thing like that? We&#8217;re not short of powerful VCSes these days. That is true. But I got to thinking, early this morning,&hellip; <a class=\"more-link\" href=\"http:\/\/esr.ibiblio.org\/?p=6502\">Continue reading <span class=\"screen-reader-text\">I wrote a version-control system today<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[46],"class_list":["post-6502","post","type-post","status-publish","format-standard","hentry","category-software","tag-version-control","entry"],"_links":{"self":[{"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/posts\/6502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6502"}],"version-history":[{"count":7,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/posts\/6502\/revisions"}],"predecessor-version":[{"id":6509,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=\/wp\/v2\/posts\/6502\/revisions\/6509"}],"wp:attachment":[{"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/esr.ibiblio.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}