Reimporting cache deleted the .svn folders in Library/cache

When doing a Reimport All, my Library/cache folder is recreated, however the process seems to be Unity deletes the current cache folder, then create it all over again. Unfortunately, this deletes the .svn folders inside it.

How can I recover the .svn folders in the cache folder? I’m using a Mac. Is there a command or a set of commands to recover or recreate the .svn folders for a folder? I don’t want to do an update since that would possibly bring old cache files that have been deleted in my current working copy (if they have been deleted in my current project), and that could possibly screw Unity hard.

Move this thread if its in the wrong category, thanks.

You must not add any of the subfolders in library to SVN or it will fuck up.

Please check the Version Control System manual page for a full list of what you are meant to not have on the SVN if you want the VCS support to work

Ah, I should not add the metadata or cache folder to svn? Unity will somehow recreate the metadata or cache folders on-the-fly if it is not found then? How will it fuck up? From the back door? In the pink taco?

Thanks.

Well I fixed my issue. I made a Python script to copy .svn folders from the last HEAD version to the working copy, provided you check out another working copy and update it to the last HEAD.

Do not do this until you make a temporary backup copy of your working copy. I don’t condone this practice as this is unsupported by official Unity support.

import os
from os.path import join, getsize
import string
import shutil

if __name__ == "__main__":

	# store all .svn folders in bakPath
	# copy the .svn folder in bakPath to workingCopyPath, unless an .svn folder already exists there

	# WARNING: MAKE SURE THERE ARE NO PRECEEDING SLASHES
	bakPath = "/Users/User/Documents/Unity BAK/Library/cache"
	workingCopyPath = "/Users/User/Documents/Unity/Library/cache"

	bakSvnFolders = []

	for root, dirs, files in os.walk(bakPath):
		for dir in dirs:
			#print dir
			if dir == ".svn":
				#print root + "/" + dir
				svnPath = root + "/" + dir
				svnPath = string.replace(svnPath, bakPath + "/", "")
				#print svnPath
				bakSvnFolders.append(svnPath)

	for svnFolder in bakSvnFolders:
		#print workingCopyPath + "/" + svnFolder
		# check if workingCopyPath + "/" + svnFolder already exists
		if os.path.isdir(workingCopyPath + "/" + svnFolder) == False:
			# copy bakPath + "/" + svnFolder into workingCopyPath + "/" + svnFolder
			shutil.copytree(bakPath + "/" + svnFolder, workingCopyPath + "/" + svnFolder)

The meta data are created in a VCS usable way if you enable the VCS support in your Unity Pro Editor Settings.

Out of this it can generate the local cache and also update it if something changes

I do not have Unity Pro. Are you suggesting I “liberate” a copy of Pro for “evaluation purposes”?

Just a minor revision to make this work on Windows:

import os
from os.path import join, getsize
import string
import shutil

if __name__ == "__main__":

	# store all .svn folders in bakPath
	# copy the .svn folder in bakPath to workingCopyPath, unless an .svn folder already exists there

	# WARNING: MAKE SURE THERE ARE NO PRECEEDING SLASHES
	bakPath = "E:/WorksPrivate/Vae Victis/TacticsEnsemble/Source/TacticsEnsemblePristineLibrary/Library/previews"
	workingCopyPath = "E:/WorksPrivate/Vae Victis/TacticsEnsemble/Source/SVN-TacticsEnsembleWorkingCopy/Trunk/TacticsEnsembleProject/Library/previews"

	bakSvnFolders = []

	for root, dirs, files in os.walk(bakPath):
		for dir in dirs:
			#print dir
			if dir == ".svn":
				#print root + "/" + dir
				svnPath = root + "/" + dir
				svnPath = string.replace(svnPath, "\\", "/")
				svnPath = string.replace(svnPath, bakPath + "/", "")
				#print svnPath
				bakSvnFolders.append(svnPath)

	for svnFolder in bakSvnFolders:
		#print workingCopyPath + "/" + svnFolder
		# check if workingCopyPath + "/" + svnFolder already exists
		if os.path.isdir(workingCopyPath + "/" + svnFolder) == False:
			# copy bakPath + "/" + svnFolder into workingCopyPath + "/" + svnFolder
			print "Creating " + workingCopyPath + "/" + svnFolder
			shutil.copytree(bakPath + "/" + svnFolder, workingCopyPath + "/" + svnFolder)