<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: pl code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 07 Oct 2008 03:11:07 GMT</pubDate>
    <description>DZone Snippets: pl code</description>
    <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>
  </channel>
</rss>
