开发者

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜