ZigZig Forums  


Post a new message in "General"
Name:
email*:
Subject:
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post a message in the forums. Enter the text in the image:
topic icon:
no
boardcode:
 Colour:  Size:   Close all tags
Message:

emoticons
B) ;) :) :P
:laugh: :ohmy: :sick: :angry:
:blink: :( :unsure: :kiss:
:woohoo: :lol: :silly: :pinch:
:side: :whistle: :evil: :S
:blush: :cheer: :huh: :dry:
* - your email address will never be displayed on the site.

Topic History of: Script for using bundles in subversion
Max. showing the last posts - (Last post first)
Author Message
Rob Hi,



What kind of problems does SVN have with bundles? I'm about to embark on using SVN for the first time and would like to know what the problems are.



Thanks,



Rob
Hadley Here's a simple bash script that does the same thing:



Code:

 svnfix() {
        
dir=presentation.key
        mv 
$"$1-backup"
        
svn up $1
        rsync 
-arC "$1-backup/" $1/
        
svn add --force $1
        rm 
-rf $1-backup
}



Usage:
svnfix name-of-my-presentation.key
(note that there's no trailing /)
Simon HARPER This is just what I've been looking for, Thanks....



However, I wonder if its possible to make this recurse a whole set of directories from a certain point in a series of working copy directories?



Thanks

Si
Daniel Lyons This is a good start, but it only solves one of the two bundle problems, which is if the Subversion metadata is somehow removed.



There is another problem that will have to be solved though, which is the problem of changes inside the bundle. For example, OmniGraffle stores its files as bundles, with almost all of the data in an Info.plist. If two users work on the same OmniGraffle file simultaneously, Subversion will mark the inner Info.plist files as conflicting. Of course, you can't "merge" the changes in a property list representing vector graphics.



I would suggest that some bundles, or maybe all bundles, need to be treated atomically. Nothing should prompt for merging when it would be as meaningful as, say, merging conflicts in a JPEG or an MP3.
Tom OK last one. This now works for bundles with spaces in their names as well as ful paths with spaces. Sorry but I don't usually do perl. Here's the DIFF:



Code:

 
--- /Users/tbrice/bin/update_bundle.pl    2006-07-20 06:20:02.000000000 -0500
+++ /Users/tbrice/bin/update_bundle_new.pl    2006-08-09 16:53:19.000000000 -0500
@@ -35,25 +35,25 @@
 
# remove and backup - do some error checking here so that if we screw up later we still have a  backup
 
unlink $tarball;
 if ( -
e $tarball ) { die "Unable to remove backup tar $tarball"; }
-`
tar cPzf $tarball $bundle_dir`; # backup
+print `tar cPzf "$tarball" "$bundle_dir"`; # backup
 
if ( ! -e $tarball ) { die "Unable to create backup tar $tarball"; }
 print 
"nBackup tar named $tarballnn";
-`
rm -rf $bundle_dir`; # nuke
-`svn up $bundle_dir`; # recreate directory structure with .svn dirs
-`find $bundle_dir -type f|grep -v .svn|xargs rm`; # get rid of all the files
-`tar xPzf $tarball`; # restore files
-open SVN_ST"svn st $bundle_dir|";
+`
rm -rf "$bundle_dir"`; # nuke
+`svn up "$bundle_dir"`; # recreate directory structure with .svn dirs
+`find "$bundle_dir" -type d -name .svn -prune -o -type f -print0 | xargs -0 rm`; # get rid of all the files excpet .svn directories
+`tar xPzf "$tarball"`; # restore files
+open SVN_ST"svn st '$bundle_dir'|";
 while (<
SVN_ST>)
 {
     if ( /^!
s+(.*)/ ) # missing files
     
{
         print 
"removing $1n";
-        `
svn rm $1`;
+        `
svn rm '$1'`;
     }
     if ( /^?
s+(.*)/ ) # unversioned files
     
{
         print 
"adding $1n";
-        `
svn add $1`;
+        `
svn add '$1'`;
     }
 }
 


Tom OK I think I've got this working. I had to rework the 'find' line and args for the final svn commands. Here's the DIFF:



Code:

 
--- /Users/tbrice/bin/update_bundle.pl    2006-08-09 13:57:31.000000000 -0500
+++ /Users/tbrice/bin/update_bundle_new.pl    2006-08-09 15:26:18.000000000 -0500
@@ -40,+40,@@
 print 
"nBackup tar named $tarballnn";
 `
rm -rf $bundle_dir`; # nuke
 
`svn up $bundle_dir`; # recreate directory structure with .svn dirs
-`find $bundle_dir -type f -print0|grep -v .svn|xargs -0 rm`; # get rid of all the files
+`find $bundle_dir -type d -name .svn -prune -o -type f -print0 | xargs -0 rm`; # get rid of all the files 
 
`tar xPzf $tarball`; # restore files
 
open SVN_ST"svn st $bundle_dir|";
 while (<
SVN_ST>)
@@ -
48,12 +48,12 @@
     if ( /^!
s+(.*)/ ) # missing files
     
{
         print 
"removing $1n";
-        `
svn rm $1`;
+        `
svn rm '$1'`;
     }
     if ( /^?
s+(.*)/ ) # unversioned files
     
{
         print 
"adding $1n";
-        `
svn add $1`;
+        `
svn add '$1'`;
     }
 }