how to add a file as an svn:external using pysvn
I am working with pysvn, I want to a folder to reposi开发者_如何学JAVAtory as an svn:external . any idea how to do this in pysvn?
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)
精彩评论