<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Mark Stosberg</title>
    <link rel="alternate" type="text/html" href="http://mark.stosberg.com/blog/" />
    <link rel="self" type="application/atom+xml" href="http://mark.stosberg.com/blog/atom.xml" />
    <id>tag:mark.stosberg.com,2008-11-25:/blog/2</id>
    <updated>2009-04-02T02:18:48Z</updated>
    <subtitle>balancing simplicity and technology in Richmond, Indiana</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.33-en</generator>

<entry>
    <title>Darcs vs. git annoyances: getting to know you</title>
    <link rel="alternate" type="text/html" href="http://mark.stosberg.com/blog/2009/04/darcs-vs-git-annoyances-getting-to-know-you.html" />
    <id>tag:mark.stosberg.com,2009:/blog//2.270</id>

    <published>2009-04-02T02:09:23Z</published>
    <updated>2009-04-02T02:18:48Z</updated>

    <summary><![CDATA[I just saw a patch I created on github attributed to &#8220;mark@freekbox.(none)&#8221;. &nbsp; That&#8217;s nothing like an email I use and it&#8217;s annoying that git not only selected this as my identity to use in the commit log, but then...]]></summary>
    <author>
        <name>Mark Stosberg</name>
        <uri>http://mark.stosberg.com/</uri>
    </author>
    
        <category term="Darcs" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="darcs" label="darcs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://mark.stosberg.com/blog/">
        <![CDATA[<p>I just saw a patch I created on github attributed to &#8220;mark@freekbox.(none)&#8221;. &nbsp; That&#8217;s nothing like an email I use and it&#8217;s annoying that git not only selected this as my identity to use in the commit log, but then didn&#8217;t even run it by me for a reality check. Now that I&#8217;ve committed that patch and pushed it to github, there&#8217;s no real way to alter that. Extra annoying.</p>

<p>By contrast, the first time you record a patch in a darcs repo, you are prompted for your e-mail address in a friendly way:</p>

<pre><code>$ darcs record
Darcs needs to know what name (conventionally an email address)
to use as the patch author, e.g. 'Fred Bloggs &lt;fred@bloggs.invalid&gt;'.
If you provide one now it will be stored in the file 
'_darcs/prefs/author' and used as a default in the future.  
To change your preferred author address, simply delete or edit
this file.

What is your email address?
</code></pre>

<p>Easy and pleasant. </p>
]]>
        

    </content>
</entry>

<entry>
    <title>Darcs vs. git annoyances: pushing specific patches</title>
    <link rel="alternate" type="text/html" href="http://mark.stosberg.com/blog/2008/11/darcs-vs-git-annoyances-pushing-specific-patches.html" />
    <id>tag:mark.stosberg.com,2008:/blog//2.250</id>

    <published>2008-11-26T00:14:41Z</published>
    <updated>2008-11-29T18:06:36Z</updated>

    <summary><![CDATA[With darcs, it&#8217;s easy to push a limited number of patches, instead of everything in the branch. There are several ways to do this: The default is interactively: $ darcs push Tue Jan 1 22:33:33 EST 2008 Mark Stosberg &lt;mark@stosberg.com&gt;...]]></summary>
    <author>
        <name>Mark Stosberg</name>
        <uri>http://mark.stosberg.com/</uri>
    </author>
    
        <category term="Darcs" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="annoyances" label="annoyances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="darcs" label="darcs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://mark.stosberg.com/blog/">
        <![CDATA[<p>With <a href="http://www.darcs.net">darcs</a>, it&#8217;s easy to push a limited number of patches, instead of everything in the branch. There are several ways to do this:</p>

<p>The default is <em>interactively</em>:</p>

<pre><code>$ darcs push 

Tue Jan  1 22:33:33 EST 2008  Mark Stosberg &lt;mark@stosberg.com&gt;
  * RT#1234: new subsystem
Shall I push this patch? (1/1)  [ynWsfvpxdaqjk], or ? for help:
</code></pre>

<p>Even if you&#8217;ve never used darcs, before it&#8217;s easy to figure what to do. You might press &#8220;?&#8221; for help:</p>

<pre><code>How to use push:
y: push this patch
n: don't push it
w: wait and decide later, defaulting to no

s: don't push the rest of the changes to this file
f: push the rest of the changes to this file

v: view this patch in full
p: view this patch in full with pager
x: view a summary of this patch

d: push selected patches, skipping all the remaining patches
a: push all the remaining patches
q: cancel push

j: skip to next patch
k: back up to previous patch

?: show this help
</code></pre>

<p>I like to use &#8220;x&#8221; to review which files I&#8217;m about to push, or &#8220;p&#8221; to review the patch in a pager. I haven&#8217;t yet found that <code>git</code> has this kind of review possibility built into the workflow. Also with darcs, it&#8217;s easy to push just one patch:</p>

<pre><code>$ darcs push -p 'new subsystem'
</code></pre>

<p>It&#8217;s also very useful to push all the patches related to a specific ticket or project:</p>

<pre><code>$ darcs push -p 'RT#1234'
</code></pre>

<p>In darcs we call that <a href="http://wiki.darcs.net/DarcsWiki/SpontaneousBranches">spontaneous branches</a> because you get
some benefits of a branch, without actually doing anything to create one.</p>

<p>The related user experience with <code>git push</code> is worse in a couple significant ways. First, I don&#8217;t see a way to use
the human readable patch name. A separate step is required to review &#8216;git log&#8217; to find the SHA1 hash, which must
be copy/pasted, because there&#8217;s no way you remember it like a human-friendly word or phrase like darcs allows.</p>

<p>Armed with that, you ready to start the four step process that git requires to push specific patches, by creating
a new branch, &#8216;cherry-picking&#8217; to it, doing the push, and then deleting the new branch</p>

<pre><code>$ git checkout --track -b &lt;tmp local branch&gt; origin/&lt;remote branch&gt;
$ git cherry-pick -x &lt;sha1 refspec of commit from other (local or remote) branch&gt;
$ git push origin &lt;tmp local branch&gt;
$ git branch -D &lt;tmp local branch&gt;
</code></pre>

<p>It&#8217;s because of a number of annoyances like this that I continue to use <a href="http://www.darcs.net/">darcs</a> whenever I can,
and git when I have to.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Darcs vs. git annoyances: push --dry-run</title>
    <link rel="alternate" type="text/html" href="http://mark.stosberg.com/blog/2008/11/darcs-vs-git-annoyances-push---dry-run.html" />
    <id>tag:mark.stosberg.com,2008:/blog//2.246</id>

    <published>2008-11-14T03:19:05Z</published>
    <updated>2008-11-29T18:06:22Z</updated>

    <summary><![CDATA[Both darcs and git support a &#8212;dry-run option for pull, but git 1.6 provides no details about what it&#8217;s going to push. Take a look: git push -v --dry-run git@github.com:markstos/foo.git Pushing to git@github.com:markstos/foo.git To git@github.com:markstos/foo.git b233f62..1eb8888 master -&gt; master Yes,...]]></summary>
    <author>
        <name>Mark Stosberg</name>
        <uri>http://mark.stosberg.com/</uri>
    </author>
    
        <category term="Darcs" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="annoyances" label="annoyances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="darcs" label="darcs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://mark.stosberg.com/blog/">
        <![CDATA[<p>Both <a href="http://www.darcs.net/">darcs</a> and <code>git</code> support a &#8212;dry-run
option for pull, but <code>git</code> 1.6 provides no details about what it&#8217;s going to push. Take a
look:</p>

<pre><code>git push -v --dry-run git@github.com:markstos/foo.git
Pushing to git@github.com:markstos/foo.git
To git@github.com:markstos/foo.git
   b233f62..1eb8888  master -&gt; master
</code></pre>

<p>Yes, <code>git</code> managed to repeat back to me the name of the remote repo not once, but
twice, but didn&#8217;t tell me a single thing about the patches that might be
pushed.  Now compare that with &#8220;darcs push &#8212;dry-run&#8221;:</p>

<pre><code>$ darcs push --dry-run --summary
Would push to "/home/mark/tmp/tmp2"...
Would push the following changes:
Thu Nov 13 22:24:40 EST 2008  m
  * My new patch name.

    M ./one.txt -2 +1

Making no changes:  this is a dry run.
</code></pre>

<p><code>darcs</code> reports what&#8217;s going in plain English, including the patch names and file change details.
Even better, if I just used <code>darcs</code> push, I would have gotten an interactive prompt by default, with a built-in help system:</p>

<pre><code>$ darcs push
Pushing to "/home/mark/tmp/tmp2"...
Thu Nov 13 22:24:40 EST 2008  m
  * My new patch name.
Shall I push this patch? (1/1)  [ynWsfvpxdaqjk], or ? for help:
</code></pre>

<p>Using that, I can navigate between the patches, cherry pick which ones I want to push, and inspect each patch by reviewing just the file changes involved, or directly viewing the actual diffs.</p>

<p>The lack of an interactive &#8220;push&#8221; command for <code>git</code> is just one of the annoyances  that cause me to continue to use <code>darcs</code> whenever I can, and <code>git</code> when I have to.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Benefits from a real world switch from CVS to darcs</title>
    <link rel="alternate" type="text/html" href="http://mark.stosberg.com/blog/2005/01/benefits-from-a-real-world-switch-from-cvs-to-darcs.html" />
    <id>tag:mark.stosberg.com,2005:/blog//2.266</id>

    <published>2005-01-06T17:00:00Z</published>
    <updated>2009-03-14T02:09:52Z</updated>

    <summary> Merging branches? I recently switched the source control management for a project at work from CVS to darcs. For others who may be considering such a switch, I&apos;d like to explain those areas that I feel like have improved,...</summary>
    <author>
        <name>Mark Stosberg</name>
        <uri>http://mark.stosberg.com/</uri>
    </author>
    
        <category term="Darcs" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="cvs" label="cvs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="darcs" label="darcs" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://mark.stosberg.com/blog/">
        <![CDATA[<p>
<div class="floatimgright"><a href="http://www.flickr.com/photos/markstos/2499470196/" title="Spiral Vine at Clifty Falls State Park by Mark Stosberg, on Flickr"><img src="http://farm3.static.flickr.com/2374/2499470196_e9233285ef_m.jpg" width="180" height="240" alt="Spiral Vine at Clifty Falls State Park" /></a><br/>Merging branches?</div>
I recently switched the source control management for a project at work from CVS to <a href=
  "http://www.darcs.net/">darcs</a>. For others who may be considering such a switch, I'd like to explain those areas
  that I feel like have improved, and those where darcs is currently weak.</p>

  <p>First, I'll give some details about the project scope, so you can better compare it to your own usage model. My team
  consists of four darcs users. We use a mix of Mac OS X and Linux on the desktop, although we primarily interact
  with darcs through shell accounts on FreeBSD servers.</p>

  <p>The project itself is a website, including about 40,000 lines of Perl
  code, with over 3,000 files stored in over 600 directories. It uses about 150
  Megs of disk space per copy, which includes some video files as big as 10
  Megs each. At the time we switched, we had over 2,000 commits in the CVS
  tree, spanning about a years worth of work.</p>

]]>
        <![CDATA[


  <h2>Background: Our usage model and reasons for switching</h2>

  <p>Each developer had their own code copy of the repository. We used an
  "alphasite" for internal quality reviews, a "betasite" for client work
  reviews, and a production copy for the live website.</p>

  <p>
  We weren't trying to maintain branches in CVS. I was aware they
  are one of the <a
      href="http://www.ohse.de/uwe/articles/cvs-fails.html">hassles of using
      CVS</a>.  If we wanted to share code with each other, or update the
  alphasite, the betasite or or the production site, we would commit to CVS
  HEAD and update the desired location. 
  </p>

  <p>This worked OK, with some coordination among ourselves about when it was a good time to <code>commit</code>

  or <code>update</code> and when it wasn't.</p>

  <p>The problem was the exceptional cases: While some work was being previewed on the alphasite or betasite, a
  high-priority request would come in that should be fast-tracked to production, ahead of the work that was already
  committed.</p>

  <p>We handled that with a little bit of luck and a fair amount of headache. If we were lucky, the fast-track change
  affected different files, and only those would be updated on the live site. If we weren't so lucky, some one-off
  solution would be devised for the particular case, until the project could reach equilibrium again.</p>

  <p>I felt there should be a better way.</p>

  <h3 a name="looking_past">Looking Past CVS: Comparing the Alternatives</h3>

  <p>So I got the itch to look at CVS alternatives. I read a fair amount about
  alternatives, and tried Arch on some personal projects before arriving at
  darcs. You can read more about why I think <a
      href="http://lwn.net/Articles/113347">distributed source control is the way to go</a>.</p>
  
  <p>I preferred Arch to CVS and found it usable. I simply found that darcs was simpler
  and more pleasant to use, with a feature set I found sufficient for my needs.</p>


  <h2>How darcs has made my life easier</h2>

  <h3>basic work flow design and our new smoke bot</h3>

  <p>I took a chance and designed a new work flow around darcs' decentralized nature, taking advantage of
  its metaphor that every repository is a working directory.</p>

  <p>First, I eliminated the abstract "central repository". Now our "alphasite" is the place the developers push
  their changes.</p>

  <p>This on its own has multiple advantages. First, the alphasite is constantly updated, and doesn't need to be
  updated specially for an alphasite review. When these reviews do happen, which are relatively brief and infrequent
  compared to development time, we can simply do not <code>push</code> then, keeping the alphasite stable.</p>

  <p>This design also helped with a problem that's perhaps somewhat unique to
  website projects. To run our automated test suite, we need a mod_perl server
  dedicated to this code line, and many Perl modules installed in the system
  libraries.</p>

  <p>Since we already had to have a mod_perl setup for the alphasite, there was little to do to create a "smoke bot",
  a script that frequently tests the code via cron and e-mails the developers if there any problems. In fact,
  our current solution is a single line cron script entry which restarts the Apache server and runs the test
  suite.</p>

  <p>With CVS this would be more complex, as a new check-out of the code would need to be made. In our case, the
  extra effort was enough that the smoke bot system never got setup to run under CVS.</p>

  <h3>A better launch process</h3>

  <p>I made one other tweak to the repository flow. Although the betasite pulls its changes from the alphasite, the
  production copy does not. Instead, it pulls from the betasite by default.</p>

  <p>Although we could subvert this flow, by design our agreed quality control flow is now built-in
  into the system. With CVS, it was easy for me to make a change to my personal copy, and then switch to the
  production copy to do a <code>cvs update</code> to get that change.</p>

  <p>Now there is at least one extra step: I have to pull the change to the betasite before pulling it to the
  production site. This helps to prevent subversion of the quality control mechanisms simply because it's easy to do so.</p>

  <h3>Better personal change management</h3>

  <p>Admittedly, we are all still adjusting to the fact that a <code>darcs record</code> does not share our changes like 
  <code>cvs commit</code> does.</p>

  <p>We are also noticing the benefits of it. Each us may be personally working on a task of some complexity, such as
  "optimize site", which may involve several individual optimization tasks. With darcs, a developer can <code>record</code>
  several individual optimization changes, but only push them once the whole task is complete.</p>

  <p>This is another way in which we avoid changes that are not ready for launch or review from getting in the way of
  something that is. This illustrates that each copy is indeed like it's own branch, without the overhead of learning
  extra commands to deal with branches.</p>

  <h3>Easy cherry picking</h3>

  <p>
<div class="floatimgright"><a href="http://www.flickr.com/photos/markstos/154711238/" title="Untitled by Mark Stosberg, on Flickr"><img src="http://farm1.static.flickr.com/64/154711238_515271774f_m.jpg" width="180" height="240" alt="" /></a><br/>Branching.</div>
We use <a href="http://www.bestpractical.com/rt">RT</a> as our issue tracking system. So we may track a
  particular programming task as RT#123.</p>

  <p>We use darcs' ability to take action based on the patch name to create another branch-like feature based our
  issue numbers.</p>

  <p>The "fast track" change request is a great example of the benefits of this. Let's say my personal repo, the
  alphasite and betasite all have various changes that are not ready to launch, and each is in a different state.</p>

  <p>A request comes in as RT#654 that should be launched ASAP, ahead of other work. I complete the work with three
  <code>record</code>s, including "RT#654" as prefix to each <code>record</code> message. From there, it's easy to let these updates flow
  by the others towards production. I do:</p>

<pre>
darcs push -p 'RT#654'
</pre>

  <p>And just those patches will flow to the alphasite. Then on the betasite and then production, I simply do:</p>

<pre>
darcs pull -p 'RT#654'
</pre>

  <p>The change launches with a minimum of fuss, and we all leave early to play mini-golf. (That's actually happened
  at my office...)</p>

  <p>As the launch-master, this feature alone is worth the switch.</p>

  <h3>Easier developer collaboration</h3>

  <p>On occasion, I'll want to help another developer on a task before his work is ready to send our central
  repository. With darcs, I could pull a changeset from one of my peer's personal repos. With CVS, we may have resorted to 
  committing something broken, just so another developer could have a copy to work on, or resort to manually shuffling files
  around in our directories. Darcs is a cleaner solution.</p>

  <h3>Better exception handling</h3>

  <p>Although we try to eliminate special cases for each place we checkout code, we have at least one exception on
  the production site: There is an e-mail handling script that we haven't yet figured out how to make work with
  relative paths, so the complete paths of the production environment are hardcoded in it.</p>

  <p>In CVS, the files involved were left un-committed, thus CVS reported them with a  "modified" status, which is
  usually something that shouldn't happen on the production site.
   This was
  messy, because it relied on remembering about uncommitted changes.</p>

  <p>Darcs has a cleaner solution. Until the production-specific cases are eliminated, I can record them as
  darcs changesets which only exist on the production site.</p>

  <p>Then instead of wondering why there are some modified files in production, I see (using
  <code>darcs pull --dry-run --verbose</code>) that there are a few
changes which only exist in production and darcs shows me the human-friendly
  patch names to remind me why the heck that is.</p>

  <h3>Better code review</h3>

  <p>By default, darcs works with changes at a more detailed level
than CVS does. It not only tells that there are changes in
  particular files, it <em>shows</em> you each change and
interactively asks you to confirm each patch "hunk" you are about to
  record.</p>

  <p>If "show not tell" is a recipe for good storytelling, it's also a good recipe for a source control system
  interface.</p>

  <p>Seeing the changes in detail encourages better habits. For
example, I may see a forgotten about change and record it as second change or not at all. I may see some extra debugging statements which I left
  in my personal copy, but don't want to include in the changeset.</p>

  <p>Soon I will have recorded all my changes, except a few debugging statements which I now want to remove. Instead
  of searching through the code for spurious output to STDERR, I can just run <code>darcs revert</code>. Like <code>record</code>, I will
  be prompted to review each pending change, but this time to <em>remove</em> them. Cleaning up my code just got a little
  faster.</p>

  <h3>Better infrastructure: Built-in XML support</h3>

  <p>Besides the improvements to my user-level experience, I also appreciate some of the deeper design decisions in
  darcs. Here's an anecdote which illustrates the benefit of darcs built-in support for XML.</p>

  <p>Pedro Melo wrote a <a href="http://www.scannedinavian.org/DarcsWiki/RelatedSoftware#head-62e9ce54aa53a3ca4a664bd80721b7ea1b836d21">Darcs-Changes-to-RSS</a> Perl script in 82 lines and less than one hour. Alexander Staubo noted
  that with the right XML stylesheet, this function can be done in a single line:</p>

<pre>

darcs changes --xml | xsltproc rss.xsl -
</pre>

  <p>That's notable because to accomplish the same function for CVS, the
  cvs2rss Perl script takes over 3 times as much code, and in turn relies on
  the non-standard cvs2cl.pl script, adding almost another 1,200 lines of
  complexity to the system.</p>

  <p>Darcs was designed to play well with others, and it shows in its simplicity of integration.</p>


  <h2>Performance: the good and the bad.</h2>

  <h3>When darcs performs better</h3>

  <p>In my common usage, there is one case where darcs is noticeably faster than CVS: Tagging the repository. With
  CVS it takes 5 minutes or more to tag a release, as I wait for CVS to update records for the thousands of files in
  the project.</p>

  <p>With darcs, tagging is instant because it's unrelated to the size of the repository.</p>

  <h3>When darcs performs worse and what I can do about it.</h3>

  <p>There are some cases when darcs performs noticeably slower. In the most common cases with the most common commands
  (record, push and pull), performance is fine.</p>

  <p>One that is much slower than CVS right now is using <a href=
  "http://www.scannedinavian.org/DarcsWiki/Performance#head-cf41cf00c0e718275e6aa550f4e28f336e4a7465">darcs diff</a>
  to see what's changed in a file since the last version.</p>

  <p>This is more of annoyance than a real problem. With CVS the equivalent command was nearly instant, with darcs it
  can take more like 10 seconds -- enough to notice and become impatient. This issue may have been adequately solved
  for me today through the release of <a href=
  "http://robotics.eecs.berkeley.edu/~srinath/darcs/index.php">darcs.vim</a>, a Vim text editor plugin which provides
  darcs integration. It takes a known shortcut which makes the speed
instant, not to mention presenting me a nicely
  formatted <code>diff</code> in my editor! (For those in the Emacs camp, I believe there is an Emacs mode
  which uses the same technique )</p> 

  <p>The real problem is that sometimes when there are conflicts, darcs can go
  into an exponential computation, hogging the processor for <em>hours</em> to
  compute the correct result. I should add that this is on top of the
  author's priority list and is currently being worked on over the 2004-2005
  winter break. The problem cuts to the core of darcs' design.  Since there
  aren't any other systems designed quite like this, no one really knows
  how much the performance can be improved, although the author
  is optimistic. (Or perhaps that should be 'optimizationistic'?)</p>

  <p>Since our switch, this hasn't been a problem for us that I recall, although I have seen it happen a number of
  times in other places. I expect it to occur at some point.</p>

  <p>However as a small isolated team, I think we could workaround this fairly
  quickly.  With the design of our patch flows, we should notice the
  potential conflict before we are pulling a patch into production.  After
  isolating the conflicting patches, we can eliminate one from our system, and
  create another one that means that same thing, but conflicts a minimal
  amount.  </p>

  <p>I still see these performance issues as a notable drawback, but considering
  all the benefits I presented above, I think they are worthwhile to put up
  with, especially if they will be addressed soon.</p> 


<h2>Final words</h2>

<p>I have no illusions that darcs has reached the maturity that CVS has. 
CVS is stable and consistent, even if it's not ideal. </p>

<p>Darcs still has some performance problems to work through and some other
rough edges. Yet, darcs has helped me at every level of source control
management, from designing a better flow between repositories, to helping me
work productively with individual changes in file. </p>

<p>
So, I feel like darcs has contributed enough to my productivity and
source code management to merit the switch of an important real world project.</p>

<p>I encourage others to evaluate it as well. </p>
]]>
    </content>
</entry>

</feed>
