pysvn import_ pysvn._pysvn_3_6.ClientError:导入文件时需要新的条目名称

时间:2018-08-16 22:13:27

标签: svn python-3.x

client = pysvn.Client();
client.callback_get_login = get_login ;

drList = re.findall(r"[A-Z]+:.*$",os.popen("mountvol /").read(),re.MULTILINE) ;
for rootDir in drList:
    #for item in  [os.path.join(rootdir, file ) for rootdir, sbuFolders, files in os.walk(rootDir, topdown=True) for d in rootdir if d not in config.get('inc_exc','exclude_prefixes')  for file in files ]:
    for rootdir, subFolders, files in os.walk(rootDir, topdown=True):
        subFolders[:] = [d for d in subFolders if d not in config.get('inc_exc','exclude_prefixes')]
        print ( rootdir );
        print ( client.import_( rootdir  , "http://localhost/svn/repo1" , 'checking' ,         recurse=False,         ignore=False,     autoprops=False ) );

代码成功导入数据,但由于重复目录重复,导致导入重复文件的错误

print ( client.import_( os.path.join ( rootdir , file )   , "http://localhost/svn/repo1" , 'checking' ,         recurse=False,         ignore=False,     autoprops=False ) );

失败:pysvn._pysvn_3_6.ClientError:导入文件时需要新的条目名称

print ( client.import_( os.path.abspath( os.path.join ( rootdir , file ) )   , "http://localhost/svn/repo1" , 'checking' ,         recurse=False,         ignore=False,     autoprops=False ) );

失败于 pysvn._pysvn_3_6.ClientError:导入文件时需要新的条目名称

高度赞赏任何见识

1 个答案:

答案 0 :(得分:0)

print ( client.import_( os.path.join(root, file)  , "http://localhost/svn/repo1/"  +  root.replace ( os.path.sep , '/' ).replace(':','')+'/'+file  , 'checking' , recurse=True, ignore=False, autoprops=False ) );

以下代码有效