This repository has been archived on 2017-04-03. You can view files and clone it, but cannot push or open issues/pull-requests.
blog_post_tests/20140105074017.blog

14 lines
4.1 KiB
Plaintext

Reposturgeon and Santa Claus Against The Martians!
<p>Here&#8217;s a late New Year&#8217;s gift for all you repository-editing fiends out there: the long-awaited and perhaps long-dreaded <a href="http://www.catb.org/~esr/reposurgeon/">reposurgeon 3.0</a>. </p>
<p>In <a href="http://esr.ibiblio.org/?p=5135">Heads up: the reposturgeon is mutating!</a> I described the downside of a strategy of incremental small language changes aimed at preserving compatibility: you can wind up trapped by suboptimal early decisions. Sometimes, you have to bust out and do the big redesign, which I did and why there&#8217;s a bump in the major version number (the last time that happened was when reposurgeon got the ability to read Subversion dump files directly).</p>
<p>The biggest change is that the command language syntax has mutated from VSO to SVO. What? You&#8217;re not up on your comparative linguistic morphology and gave no idea what I&#8217;m talking about? That&#8217;s Verb-Subject-Object to Subject-Verb-Object.</p>
<p><span id="more-5185"></span></p>
<p>Before 3.0 the order of syntactic elements in a command was: action verb first, then (for most commands) an event selection set, then (for some commands) an object like a directory or repository name. Now the selection set always comes first, followed by the action verb, followed by any object-like arguments. </p>
<p>This change makes the syntax more regular and easier to describe. Easier mainly because there is no longer any of the previous confusion, when a selection set was present after the command verb, over what the first argument of the command was. The selection set, or what came after it? (Correct answer: what came after.)</p>
<p>In making this change I am moving closer to a Unix design archetype that had already influenced reposurgeon pretty heavily: ed(1). ed had a horrendously awful UI by modern standards, but it was (and still is) great for scripting. If you think of ed as a record editor for which the records are text lines, and study its selection syntax, the influence &#8211; and the reasons ed makes a useful model for what reposurgeon is doing &#8211; should be obvious.</p>
<p>A significant new feature is that reposurgeon now has a user-definable macro facility. I have written in the past that these are generally a bad idea and I still think that&#8217;s true in general. (One representative major problem with them is that when macro expressions cross certain kinds of syntactic boundaries in the base language they often become a serious impediment to readability and maintainability.)</p>
<p>But I found I wanted macros while converting the groff repository, and reposurgeon&#8217;s base language is simple in some ways that make the obscuring effect of macros less dangerous. There are no analogs of the &#8220;++&#8221; postfix operator which in C makes &#8220;#define square(x) (x)*(x)&#8221; such a wonderful way to generate unanticipated side effects. (Hint: consider what happens when you say &#8220;square(a++)&#8221;. How many times will a be incremented, again?)</p>
<p>Many small irritations in the language have been fixed. &#8220;delete&#8221; now really means delete and is no longer overloaded with several variants of a commit-squashing operation; that is now &#8220;squash&#8221;. (Yes, this adopts some git terminology.)</p>
<p>Pathset syntax is now simpler and more powerful. For starters, pathsets now match not only commits touching matching paths but the content blobs that the paths point at (you can select either subset by qualifying with the =C or =B selectors). This is particularly useful in connection with the &#8216;filter&#8217; command, which allows you to modify comments and blobs by passing them through a user-specified filter.</p>
<p>There are lots of other changes as well. If you have worked with reposurgeon before you&#8217;ll have a bit of relearning to do. Sorry about that, but experience has taught me that (when you can get away with it at all) one big, obvious compatibility break is kinder than a long-drawn-out series of little ones that leave everybody wondering what the feature set of the week is,</p>