<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Floehopper: Tag svn</title>
    <link>http://blog.floehopper.org/articles/tag/svn?tag=svn</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts on the bergy bits of life</description>
    <item>
      <title>Vim Learning Curve</title>
      <description>&lt;p&gt;Because I&amp;#8217;ve been doing a lot of &lt;a href="http://blog.floehopper.org/articles/2008/03/13/remote-pair-programming"&gt;remote pair programming&lt;/a&gt; using &lt;a href="http://www.vim.org/"&gt;vim&lt;/a&gt; and &lt;a href="http://www.gnu.org/software/screen/"&gt;screen&lt;/a&gt;,  I&amp;#8217;ve been making a real effort to improve my vim skills in order to be more productive and feel like I&amp;#8217;ve made some progress. &lt;a href="http://blog.seagul.co.uk"&gt;Chris&lt;/a&gt; has rightly suggested that the only way to really improve is to make vim your editor of choice even when not remote pairing, so that&amp;#8217;s what I&amp;#8217;ve been trying to do. I&amp;#8217;ve come across a few useful but random bits and pieces which I thought I&amp;#8217;d record in case they were useful to anyone else&amp;#8230;&lt;/p&gt;


	&lt;h2&gt;Textile&lt;/h2&gt;


	&lt;p&gt;I&amp;#8217;m using a &lt;a href="http://rubychan.de/share/textile.vim"&gt;vim syntax file&lt;/a&gt; for &lt;a href="http://hobix.com/textile/"&gt;Textile&lt;/a&gt; written by Kornelius Kalnbach to write this article.&lt;/p&gt;


	&lt;h2&gt;svn blame&lt;/h2&gt;


	&lt;p&gt;I&amp;#8217;ve found Tammer Saleh&amp;#8217;s &lt;a href="http://tammersaleh.com/posts/quick-vim-svn-blame-snippet"&gt;key mapping&lt;/a&gt; for &lt;a href="http://svnbook.red-bean.com/en/1.0/re02.html"&gt;svn blame&lt;/a&gt; useful&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;  vmap gl :&amp;lt;C-U&amp;gt;!svn blame &amp;lt;C-R&amp;gt;=expand(&amp;quot;%:p&amp;quot;) &amp;lt;CR&amp;gt; \| sed -n &amp;lt;C-R&amp;gt;=line(&amp;quot;'&amp;lt;&amp;quot;) &amp;lt;CR&amp;gt;,&amp;lt;C-R&amp;gt;=line(&amp;quot;'&amp;gt;&amp;quot;) &amp;lt;CR&amp;gt;p &amp;lt;CR&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I decided to invest a bit of time understanding how it worked and broke it down as follows&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;  # key mapping for visual mode
  vmap gl
  # remove all characters between the cursor position and the beginning of the line
  :&amp;lt;C-U&amp;gt;
  # current file with full path
  &amp;lt;C-R&amp;gt;=expand(&amp;quot;%:p&amp;quot;) &amp;lt;CR&amp;gt;
  # pipe std out to sed which only outputs line N to line M
  \| sed -n N,M
  # line number of first line of selection
  &amp;lt;C-R&amp;gt;=line(&amp;quot;'&amp;lt;&amp;quot;) &amp;lt;CR&amp;gt;
  # line number of last line of selection
  &amp;lt;C-R&amp;gt;=line(&amp;quot;'&amp;gt;&amp;quot;) &amp;lt;CR&amp;gt;
  # print output
  p &amp;lt;CR&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h2&gt;Search &amp;#38; Replace&lt;/h2&gt;


	&lt;p&gt;At the end of last week, &lt;a href="http://blog.seagul.co.uk"&gt;Chris&lt;/a&gt; &amp;#38; I found out from Ibrahim Ahmed&amp;#8217;s blog how to &lt;a href="http://www.ibrahim-ahmed.com/2008/01/find-and-replace-in-multiple-files-in.html"&gt;search and replace across multiple files&lt;/a&gt;...&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;  # select file on which to operate
  :args path/with/wildcards
  # find pattern, replace with replacement, and save file
  :argdo %s/pattern/replacement/ge | update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h2&gt;vimdiff&lt;/h2&gt;


	&lt;p&gt;&lt;a href="http://www.vim.org/htmldoc/diff.html"&gt;&lt;code&gt;vimdiff&lt;/code&gt;&lt;/a&gt; seems like a nice tool, but unfortunately it doesn&amp;#8217;t immediately play well with &lt;a href="http://svnbook.red-bean.com/en/1.0/re09.html"&gt;&lt;code&gt;svn diff&lt;/code&gt;&lt;/a&gt; and its &lt;code&gt;--diff-cmd&lt;/code&gt; option. There seem to be a couple of alternatives: (a) write a &lt;a href="http://svn.haxx.se/users/archive-2005-04/1048.shtml"&gt;wrapper script for &lt;code&gt;vimdiff&lt;/code&gt;&lt;/a&gt; which works with &lt;code&gt;--diff-cmd&lt;/code&gt;; or (b) write a &lt;a href="http://erik.thauvin.net/blog/comments.jsp?postid=1024"&gt;script which uses &lt;code&gt;svn cat&lt;/code&gt; and then calls &lt;code&gt;vimdiff&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;


	&lt;h2&gt;Test::Unit&lt;/h2&gt;


	&lt;p&gt;One of the things I really want to be able to do, is run Ruby &lt;a href="http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html"&gt;Test::Unit&lt;/a&gt; tests and view the output, so I can jump to the line where an assertion failed. I haven&amp;#8217;t managed to find anything suitable on the web, so here&amp;#8217;s my first attempt&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;  function! Ruby_run_tests()
    let results = tempname()
    set splitbelow
    silent execute &amp;quot;:! ruby % &amp;gt; &amp;quot; . results . &amp;quot; 2&amp;gt;&amp;amp;1 &amp;quot;
    silent execute &amp;quot;:10 sview &amp;quot; . results
  endfunction

  map &amp;lt;silent&amp;gt; &amp;lt;F7&amp;gt; :call Ruby_run_tests()&amp;lt;cr&amp;gt;
  imap &amp;lt;silent&amp;gt; &amp;lt;F7&amp;gt; &amp;lt;ESC&amp;gt;&amp;lt;F7&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I&amp;#8217;m sure this isn&amp;#8217;t the best way of doing it, but when you put this in your vimrc file, pressing the &lt;code&gt;F7&lt;/code&gt; key runs the current file using Ruby and pipes the results to a temporary file. This temporary file is opened in a read-only window 10 lines high at the bottom of the screen. By moving the cursor onto the relevant line of any stack trace, you can then use &amp;#8220;goto file&amp;#8221; key sequence &lt;code&gt;gf&lt;/code&gt; to goto the failing assertion. Although for some reason this only seems to work the first time round for me.&lt;/p&gt;


	&lt;p&gt;Ideally I&amp;#8217;d like to be able to do the equivalent of &amp;#8220;run focussed test&amp;#8221; in &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt;, which should be quite straightforward, but that&amp;#8217;ll have to wait for another day.&lt;/p&gt;


	&lt;p&gt;In the meantime, I&amp;#8217;d love to hear from anyone else who has useful vim tricks for &lt;a href="http://www.ruby-lang.org/"&gt;Ruby&lt;/a&gt; development. I&amp;#8217;ll be bookmarking any useful links I find on &lt;a href="http://del.icio.us/jamesthecat/vim"&gt;del.icio.us&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 12 Jul 2008 22:52:35 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c7afcd35-0c86-40a8-88c1-d0485fbc2477</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2008/07/12/vim-learning-curve</link>
      <category>vim</category>
      <category>svn</category>
      <category>diff</category>
      <category>blame</category>
      <category>syntax</category>
      <category>textile</category>
      <category>search</category>
      <category>replace</category>
      <category>testing</category>
      <category>textmate</category>
    </item>
    <item>
      <title>Prefer Commit Notes over Comments</title>
      <description>&lt;p&gt;My colleague, &lt;a href="http://blog.seagul.co.uk/"&gt;Chris&lt;/a&gt;, recently posted about &lt;a href="http://blog.seagul.co.uk/articles/2008/03/28/version-control-commit-note-best-practice-or-not-you-decide"&gt;what makes a good commit note&lt;/a&gt;. His main point is that a good commit note should explain &lt;strong&gt;why&lt;/strong&gt; the changeset exists rather than &lt;strong&gt;what&lt;/strong&gt; it contains (which should be more self-evident). I agree with this and (as Chris mentions) it&amp;#8217;s of particular benefit when you have to do some software archeology. I&amp;#8217;d go a step further and say that, for me, the best commit notes express the &lt;em&gt;business&lt;/em&gt; reason for the changeset. If as a developer you are struggling to explain the business case for a particular change, (imho) you should try to find out before committing &amp;#8211; otherwise how do you know the changeset is delivering value to the business?&lt;/p&gt;


	&lt;p&gt;In a previous post about &lt;a href="http://blog.floehopper.org/articles/2007/05/10/prefer-tests-over-comments"&gt;preferring tests over comments&lt;/a&gt;, I expressed similar sentiments about using comments and tests to explain &lt;strong&gt;why&lt;/strong&gt; rather than &lt;strong&gt;what&lt;/strong&gt;. Chris&amp;#8217; post prompted me to re-read that old post and I noticed that it didn&amp;#8217;t explain why I &lt;a href="http://blog.floehopper.org/articles/2007/05/10/prefer-tests-over-comments"&gt;prefer tests over comments&lt;/a&gt;. The reason is that comments have a nasty habit of becoming out-of-date and getting left lying around to confuse the unwary, whereas you are forced to keep tests up-to-date (assuming they are part of a &lt;a href="http://martinfowler.com/articles/continuousIntegration.html"&gt;continuous integration build&lt;/a&gt;). For similar reasons I also think that commit notes are better than code comments, because they are forever associated with a snapshot of the code at the time they were written &amp;#8211; leaving less scope for confusion.&lt;/p&gt;</description>
      <pubDate>Sat, 29 Mar 2008 19:05:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:11955d9f-4314-46f7-b708-dca8b3860930</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2008/03/29/prefer-commit-notes-over-comments</link>
      <category>version</category>
      <category>control</category>
      <category>commit</category>
      <category>note</category>
      <category>changeset</category>
      <category>svn</category>
      <category>vcs</category>
      <category>comment</category>
      <category>why</category>
      <category>what</category>
    </item>
    <item>
      <title>Trac Secret</title>
      <description>&lt;p&gt;We&amp;#8217;ve been using &lt;a href="http://trac.edgewall.org/"&gt;Trac&lt;/a&gt; at &lt;a href="http://www.reevoo.com"&gt;Reevoo&lt;/a&gt; since I joined the company over 2 years ago. In the main, I&amp;#8217;ve been pretty happy with it &amp;#8211; it&amp;#8217;s not fancy, but it does basic stuff tolerably well. However, I&amp;#8217;ve always found it annoying that I couldn&amp;#8217;t easily find a file/directory which I know used to be in our &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt; repository, but has been deleted.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m sure most people already know about the following feature of Trac, but just in case it&amp;#8217;s useful to somebody else&amp;#8230;&lt;/p&gt;


	&lt;p&gt;A couple of days ago, I had a small &amp;#8220;aha&amp;#8221; moment, when I decided to actually read an error page that Trac produces if you try to hack the &amp;#8220;browse&amp;#8221; url to navigate to your deleted file&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;http://wiki/trac/browser/mocha/trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You see something like the following&amp;#8230;&lt;/p&gt;


&lt;div style="" class="flickrplugin"&gt;&lt;a href="http://www.flickr.com/photos/jamesthecat/1542684116"&gt;&lt;img src="http://farm3.static.flickr.com/2212/1542684116_590a106b22.jpg" width="500" height="260" alt="TracInternalError" title="TracInternalError"/&gt;&lt;/a&gt;&lt;/div&gt;

	&lt;p&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;My attention has always been drawn to the line of highlighted text, which indicates that the file has not been found, but the line underneath includes a link to &amp;#8220;search in the repository history to see if that path existed but was later removed&amp;#8221;. If I click that link, lo and behold&amp;#8230;&lt;/p&gt;


&lt;div style="" class="flickrplugin"&gt;&lt;a href="http://www.flickr.com/photos/jamesthecat/1541823329"&gt;&lt;img src="http://farm3.static.flickr.com/2318/1541823329_b45abbaf8c.jpg" width="500" height="418" alt="TracLogSearch" title="TracLogSearch"/&gt;&lt;/a&gt;&lt;/div&gt;

	&lt;p&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;I can now see the directory I was looking for and its history, including the changeset in which it was deleted. What&amp;#8217;s more, it has a nice &lt;a href="http://urls.inelegant.org/hackable/"&gt;hackable&lt;/a&gt; url&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;http://wiki/trac/log/mocha/trunk?rev=7034&amp;amp;mode=path_history&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;The moral of the story is that you should always read error messages carefully!&lt;/p&gt;</description>
      <pubDate>Thu, 11 Oct 2007 13:31:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9da835ba-a053-4690-9ebb-f423ac33cd7c</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2007/10/11/trac-secret</link>
      <category>trac</category>
      <category>delete</category>
      <category>log</category>
      <category>svn</category>
      <category>history</category>
      <category>file</category>
      <category>directory</category>
    </item>
    <item>
      <title>Rails Plugin Versioning</title>
      <description>&lt;p&gt;A while ago &lt;a href="http://jayfields.blogspot.com/"&gt;Jay Fields&lt;/a&gt; described a number of ways to &lt;a href="http://jayfields.blogspot.com/2006/10/rubygems-shared-ruby-code.html"&gt;share Ruby code&lt;/a&gt; between projects and focussed on a useful technique which involves using &lt;a href="http://rubyforge.org/projects/rubygems/"&gt;RubyGems&lt;/a&gt; and unpacking them into your vendor directory. He also mentions the difficulties of versioning with &lt;a href="http://www.rubyonrails.org/"&gt;Rails&lt;/a&gt; plugins.&lt;/p&gt;


	&lt;p&gt;We use a number of &lt;a href="http://www.rubyonrails.org/"&gt;Rails&lt;/a&gt; plugins at &lt;a href="http://www.reevoo.com"&gt;Reevoo&lt;/a&gt;. Initially we used &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt; externals to include them in our projects, but for a while now we&amp;#8217;ve been successfully using &lt;a href="http://blog.teksol.info/"&gt;François Beausoleil&amp;#8217;s&lt;/a&gt; &lt;a href="http://piston.rubyforge.org/"&gt;Piston&lt;/a&gt; which is effectively an extension to &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt;. You end up with a copy of the plugin code in your own repository with the relevant revision number from the remote repository stored in your own &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt; metadata. &lt;a href="http://piston.rubyforge.org/"&gt;Piston&lt;/a&gt; prevents you getting new versions of the plugin code every time you update (as you would with an svn:external) which can lead to unexpected changes, but makes it straightforward to update to a newer version of a plugin when you want.&lt;/p&gt;


	&lt;p&gt;You can find Piston &lt;a href="http://piston.rubyforge.org/"&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 02 Dec 2006 09:36:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7ee628bb-96af-47f0-8e6e-0f66c2a5e03f</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2006/12/02/rails-plugin-versioning</link>
      <category>ruby</category>
      <category>rails</category>
      <category>plugin</category>
      <category>piston</category>
      <category>rubygem</category>
      <category>version</category>
      <category>svn</category>
      <category>external</category>
    </item>
  </channel>
</rss>
