If you use Tortoise SVN ( http://tortoisesvn.tigris.org/ ), and you don't mind copying the contents of the directory you are trying to unbind, a very simple solution is to right click in the directory and choose 'export' from the Tortoise menu ( or use
svn exporton the command line ) - this will export ( i.e. copy directory structure minus bindings ) the tree to the location you specify. It should be noted, however, that it exports the tree in the state in which it finds it, not a copy of the repository you checked out of - any changes you have made locally are exported ( though unversioned files are not ).
If you want to avoid the copy of an export, or otherwise want to remove the source control bindings in place, a script may be the answer.
I'm not much of a shell scripter and I'm a huge fan of Python ( http://python.org/ ) so I wrote a Python script for removing Subversion ( http://subversion.tigris.org/ ) bindings which I have found so useful that I'm sharing it.
Feedback is extremely welcome, but please use with caution - it does remove entire directories.
''' this utility script was written by tosh afanasiev. it comes with no warrantee of any sort. http://tosh.me/ ''' import os, shutil, stat SVN_DIR = '.svn' def remove_bindings( dirname, binding_dir=SVN_DIR ): ''' deletes all svn binding directories in a directory tree. a different name can be specified for @binding_dir, with the result that directories with that name will be removed. ''' # walk the directory for root, dirs, files in os.walk( dirname ): # test for a binding directory if binding_dir in dirs: # if found, walk the binding directory path = os.path.join( root, binding_dir ) for broot, bdirs, bfiles in os.walk( path ): for f in bfiles: # ensure that all files are writeable os.chmod( os.path.join( broot, f ) , stat.S_IWRITE ) # and finally remove the binding directory shutil.rmtree( path ) def main(): ''' this function is called if you execute the script rather than import it ''' dirname = raw_input( 'directory name:\n' ) remove_bindings( dirname ) if __name__ == '__main__': main()
Alternatively, use TortoiseSVN. :-)ReplyDelete
Thanks for sharing this informative post. This article shares some rapid-fire advice for busy developers who need to get the most out of Subversion straight away Remove a bindingReplyDelete