<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: svn code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 07:04:43 GMT</pubDate>
    <description>DZone Snippets: svn code</description>
    <item>
      <title>rails-commit: Rails Commit Script for Subversion</title>
      <link>http://snippets.dzone.com/posts/show/5636</link>
      <description>#!/usr/bin/env ruby&lt;br /&gt;&lt;br /&gt;# my take on a easy commit script for rails...&lt;br /&gt;# it is far from prefect, so:&lt;br /&gt;# please feed back the modifications you made to it!&lt;br /&gt;#&lt;br /&gt;# Fixed bugs on empty to_ arrays and spelling mistakes&lt;br /&gt;# by Vesa-Pekka Palmu&lt;br /&gt;# orginal by Cies Breijs -- cies.breijsATgmailDOTcom&lt;br /&gt;# based on a bash script by Anonymous Gentleman&lt;br /&gt;# found here: &lt;a href="http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion"&gt;http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion&lt;/a&gt;&lt;br /&gt;# cleaned up an pasted by Ed Laczynski http://idisposable.net &lt;br /&gt;&lt;br /&gt;to_add = []&lt;br /&gt;to_remove = []&lt;br /&gt;to_checkin = []&lt;br /&gt;&lt;br /&gt;`svn status`.each_line do |l|&lt;br /&gt;  puts l&lt;br /&gt;  action_char, path = l.split(' ', 2)&lt;br /&gt;  path.strip!&lt;br /&gt;  case action_char&lt;br /&gt;    when '?'&lt;br /&gt;      to_add &lt;&lt; path&lt;br /&gt;    when '!'&lt;br /&gt;      to_remove &lt;&lt; path&lt;br /&gt;    when 'M'&lt;br /&gt;      to_checkin &lt;&lt; path&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts "\nyou are about to" &lt;br /&gt;&lt;br /&gt;def print_list(array, str)&lt;br /&gt;  puts "\n#{str}:"&lt;br /&gt;  array.each { |i| puts "\t"+i }&lt;br /&gt;  puts "\t&lt;nothing&gt;" if array.length == 0&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;print_list(to_add, 'add')&lt;br /&gt;print_list(to_remove, 'remove')&lt;br /&gt;print_list(to_checkin, 'checkin')&lt;br /&gt;&lt;br /&gt;puts "\nplease write something for the commit log and hit enter"&lt;br /&gt;puts "(hitting enter on an empty line will cancel this commit)\n\n" &lt;br /&gt;&lt;br /&gt;log = gets.strip&lt;br /&gt;&lt;br /&gt;if log.empty?&lt;br /&gt;  puts "commit cancelled!\n"&lt;br /&gt;  exit&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts "\ncontacting repository\n" &lt;br /&gt;&lt;br /&gt;`svn add #{to_add.join(' ')}` unless to_add.empty?&lt;br /&gt;`svn remove #{to_remove.join(' ')}` unless to_remove.empty?&lt;br /&gt;puts "\n" + `svn commit -m "#{log.gsub('"', '"')}"` + "\n" &lt;br /&gt;&lt;br /&gt;puts "running \'svn update\' to be sure we are up-to-date"&lt;br /&gt;puts `svn update`&lt;br /&gt;&lt;br /&gt;puts "\nfinished.\n"&lt;br /&gt;</description>
      <pubDate>Wed, 11 Jun 2008 21:23:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5636</guid>
      <author>edltech (Ed Laczynski)</author>
    </item>
    <item>
      <title>Copy all svn:* properties from one file to another</title>
      <link>http://snippets.dzone.com/posts/show/5501</link>
      <description>The following script can be used to copy all SVN properties from one file (presumably a file that's already under SVN control) to another file (which you presumably want to put under SVN control, and which you want to check in with the same SVN properties).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;ORIG=$1 ; shift ;&lt;br /&gt;[ -e "$ORIG" ] || exit ;&lt;br /&gt;&lt;br /&gt;for PROP in `svn pl "$ORIG" | sed -n '2,$p'` ; do&lt;br /&gt;        VALUE=`svn pg $PROP "$ORIG"` ;&lt;br /&gt;        for FILE ; do&lt;br /&gt;                [ -e "$FILE" ] &amp;&amp; svn ps $PROP "$VALUE" "$FILE" ;&lt;br /&gt;        done&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;# That's it, Folks!&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you put the above code in a shell script called...&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;svnprops.sh&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;... then you can run it as follows if you want to copy all svn:* properties FROM original.file TO blegga:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;pvdb@localhost ~ $ ./svnprops.sh original.file blegga &lt;br /&gt;property 'svn:mime-type' set on 'blegga'&lt;br /&gt;property 'svn:eol-style' set on 'blegga'&lt;br /&gt;pvdb@localhost ~ $ _&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;... or as follows for multiple target files:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;pvdb@localhost ~ $ ./svnprops.sh another.original.file blegga foo bar &lt;br /&gt;property 'svn:mime-type' set on 'blegga'&lt;br /&gt;property 'svn:mime-type' set on 'foo'&lt;br /&gt;property 'svn:mime-type' set on 'bar'&lt;br /&gt;pvdb@localhost ~ $ _ &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Fri, 16 May 2008 11:25:10 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5501</guid>
      <author>pvdb (Peter Vandenberk)</author>
    </item>
    <item>
      <title>SVN Diff While Ignoring Whitespace</title>
      <link>http://snippets.dzone.com/posts/show/5215</link>
      <description>A command line alias for doing an svn diff while ignoring whitespace differences. Placed in ~/.bashrc or your profile.&lt;br /&gt;&lt;br /&gt;Can be used in a directory:&lt;br /&gt;$ dw&lt;br /&gt;&lt;br /&gt;Or on a single file:&lt;br /&gt;$ dw functions.php&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;alias dw="svn diff --diff-cmd diff -x -uw"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 12 Mar 2008 05:42:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5215</guid>
      <author>philsown (Phil)</author>
    </item>
    <item>
      <title>Resolve all SVN conflicts with the right version of the file</title>
      <link>http://snippets.dzone.com/posts/show/5184</link>
      <description>This small PHP shell script recourses through the subdirectories and looks for files that match the "conflict" files that SVN creates when merging from another branch. It chooses the "right" version of the files and resolves the conflict.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."));&lt;br /&gt;foreach($dir as $file)&lt;br /&gt;{&lt;br /&gt;  $path = $file-&gt;getPathname();&lt;br /&gt;  if (preg_match('/\.merge-right\.r\d+$/', $path, $matches)) {&lt;br /&gt;    $orig = str_replace($matches[0], '' , $path);&lt;br /&gt;    copy($path, $orig);&lt;br /&gt;    $cmd = "svn resolved $orig";&lt;br /&gt;    `$cmd`;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 28 Feb 2008 10:57:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5184</guid>
      <author>thesaint ()</author>
    </item>
    <item>
      <title>Rename old HTML views for Rails 2</title>
      <link>http://snippets.dzone.com/posts/show/5044</link>
      <description>&lt;code&gt;&lt;br /&gt;# Snagged from http://softiesonrails.com/2007/7/11/upgrading-your-views-to-rails-2-0&lt;br /&gt;for old in `find app/views -name *.rhtml`; do svn mv $old `dirname $old`/`basename $old .rhtml`.html.erb; done&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 27 Jan 2008 22:57:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5044</guid>
      <author>sikelianos (Zeke Sikelianos)</author>
    </item>
    <item>
      <title>Checkout a Git clone of an SVN repository in parent folder</title>
      <link>http://snippets.dzone.com/posts/show/4813</link>
      <description>Here is a quick executable cmd that you run inside a folder checked out with Subversion. It will clone the repository using Git into the parent folder as &amp;lt;projname&amp;gt;.git&lt;br /&gt;&lt;br /&gt;Stick this code into ~/bin/gitify and add ~/bin to your path:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby -wKU&lt;br /&gt;&lt;br /&gt;# get svn info location&lt;br /&gt;svnurl = `svn info | grep "^URL:"`.gsub('URL: ','').chomp&lt;br /&gt;&lt;br /&gt;# project = basename&lt;br /&gt;project = File.basename(Dir.pwd)&lt;br /&gt;&lt;br /&gt;puts cmd = "git-svn clone #{svnurl} ../#{project}.git"&lt;br /&gt;&lt;br /&gt;`#{cmd}`&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 22 Nov 2007 22:35:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4813</guid>
      <author>nicwilliams (Dr Nic Williams)</author>
    </item>
    <item>
      <title>svn merging</title>
      <link>http://snippets.dzone.com/posts/show/4809</link>
      <description>&lt;code&gt;&lt;br /&gt;svn log | more&lt;br /&gt;svn merge -r339:HEAD https://wush.net/svn/givezooks/trunk&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 21 Nov 2007 22:24:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4809</guid>
      <author>sikelianos (Zeke Sikelianos)</author>
    </item>
    <item>
      <title>svn-add-all-new-files</title>
      <link>http://snippets.dzone.com/posts/show/4722</link>
      <description>alias svn-add-all-new-files='svn st|grep ^?|sed s/?//|xargs svn add $1'</description>
      <pubDate>Wed, 31 Oct 2007 10:00:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4722</guid>
      <author>sessy (sessy)</author>
    </item>
    <item>
      <title>Subversion basic commands Part I</title>
      <link>http://snippets.dzone.com/posts/show/4689</link>
      <description>New users to SVN should be familiar with the following commands.  Examples based on the code from Gentoo-wiki - HOWTO subversion SVN http://urltea.com/1urj . &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#server side&lt;br /&gt;&lt;br /&gt;# create the project directory structure outside of svn&lt;br /&gt;mkdir -p ~/Documents/code/my-project/{trunk,tags,branches} &lt;br /&gt;&lt;br /&gt;# create the new repository&lt;br /&gt;svnadmin create /var/svn/my-repository &lt;br /&gt;&lt;br /&gt;# add the new project&lt;br /&gt;svn import my-project file:////var/svn/my-repository/my-project&lt;br /&gt;&lt;br /&gt;# remove the project&lt;br /&gt;rm -rf /var/svn/my-repository/my-project &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#client side&lt;br /&gt;&lt;br /&gt;# list the contents of my-project&lt;br /&gt;svn list --verbose http://my-site.com/svn/my-repository/my-project &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# *update 29-Oct-07*&lt;br /&gt;# it's possible to import, or remove the project from the client-side&lt;br /&gt;&lt;br /&gt;# add the new project&lt;br /&gt;svn import my-project http://my-site.com/svn/my-repository/my-project &lt;br /&gt;&lt;br /&gt;# remove the project&lt;br /&gt;svn delete http://my-site.com/svn/my-repository/my-project &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note: To use http on the client side, it's necessary to have Apache configured using SVN and DAV. Refer to HOWTO Apache2 with subversion SVN and DAV. http://urltea.com/1uqg</description>
      <pubDate>Tue, 23 Oct 2007 11:37:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4689</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Ignore a folder in subversion</title>
      <link>http://snippets.dzone.com/posts/show/4552</link>
      <description>&lt;code&gt;&lt;br /&gt;# In this case, ignore contents of 'coverage' folder in current directory.&lt;br /&gt;svn propset svn:ignore 'coverage' .&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 18 Sep 2007 18:50:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4552</guid>
      <author>sikelianos (Zeke Sikelianos)</author>
    </item>
  </channel>
</rss>
