Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | None | 0 0
  1. #!/bin/sh
  2. # svnexport.sh
  3. # Export only modified files in SVN
  4.  
  5. # tests for parameters
  6. if [ ! $1 ];then echo "svnexport : No source specified.";exit;fi
  7. if [ ! $2 ];then echo "svnexport : No revision specified. ";exit;fi
  8. if [ ! $3 ];then echo "svnexport : No target directory specified. ";exit;fi
  9.  
  10. echo "Processing : source($1), revision($2), target_directory($3)"
  11.  
  12. for myfile in `svn diff -c $2 --summarize $1 | grep -e '^M ' -e '^A '`
  13. do
  14.     if  [  "$myfile" = "M"  -o  "$myfile" = "AM" -o "$myfile" = "A" -o "$myfile" = "." -o -d $myfile ]
  15.     then
  16.         continue
  17.     else
  18.         outfile=`echo $myfile | sed "s|$1||g"`
  19.         file="$3$outfile"
  20.         mkdir -p $(dirname $file)
  21.         svn export --force $myfile $file -r $2 >> /dev/null
  22.         echo "export $file "
  23.     fi
  24. done
  25.  
  26.  
  27. echo "\nDone"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement