Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Peter Vandenberk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Copy all svn:* properties from one file to another

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).

   1  
   2  #!/bin/sh
   3  
   4  ORIG=$1 ; shift ;
   5  [ -e "$ORIG" ] || exit ;
   6  
   7  for PROP in `svn pl "$ORIG" | sed -n '2,$p'` ; do
   8          VALUE=`svn pg $PROP "$ORIG"` ;
   9          for FILE ; do
  10                  [ -e "$FILE" ] && svn ps $PROP "$VALUE" "$FILE" ;
  11          done
  12  done
  13  
  14  # That's it, Folks!


If you put the above code in a shell script called...

   1  
   2  svnprops.sh


... then you can run it as follows if you want to copy all svn:* properties FROM original.file TO blegga:

   1  
   2  pvdb@localhost ~ $ ./svnprops.sh original.file blegga 
   3  property 'svn:mime-type' set on 'blegga'
   4  property 'svn:eol-style' set on 'blegga'
   5  pvdb@localhost ~ $ _


... or as follows for multiple target files:

   1  
   2  pvdb@localhost ~ $ ./svnprops.sh another.original.file blegga foo bar 
   3  property 'svn:mime-type' set on 'blegga'
   4  property 'svn:mime-type' set on 'foo'
   5  property 'svn:mime-type' set on 'bar'
   6  pvdb@localhost ~ $ _ 

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS