I am working with pysvn, I want to a folder to repository as an svn:external . any idea how to do this in pysvn?
A:
Let's say you have a working copy in D:\myWorkingCopy, and you want to map some external svn folders to be checked out in MYPROJ\SOMEDIR. The code below exemplifies this.
import pysvn
def setExternals(dir, externalValues):
svnClient = pysvn.Client()
externalsPropValue = '\n'.join(['%s %s' % (extVal[0], extVal[1]) for extVal in externalValues])
svnClient.propset('svn:externals', externalsPropValue, dir)
rev = svnClient.checkin(dir, 'Set externals')
print str(rev)
if __name__ == '__main__':
externalValues = [('^/OTHERPROJ1/DIRINPROJ1', 'DIRINPROJ1'),('^/OTHERPROJ1/DIRINPROJ1', 'DIRINPROJ2')]
setExternals(r'D:\myWorkingCopy\MYPROJ\SOMEDIR', externalValues)
Victor Ionescu
2010-10-13 13:45:39