在linux下开发文件,但是当有代码被删除的时候,有时候忘记立马提交命令到svn服务器删除相应的文件,
但是svn本身没有提供相应的命令来批量删除,为此用python写了一个
import os
if __name__== '__main__':
svnfiles = os.popen("svn ls").readlines()
print svnfiles
localfiles = os.popen("ls").readlines()
print localfiles
svninfo = os.popen("svn info").readlines()
path = svninfo[1][:len(svninfo[1])-1]
for i in range(0,len(svnfiles)-1):
sourcefile = svnfiles[i][:len(svnfiles[i])-1]
if sourcefile[len(sourcefile)-1:] == "/":
sourcefile = sourcefile[:len(sourcefile)-1]
#print sourcefile
bDelete = True
for j in range(0,len(localfiles)-1):
localfile = localfiles[j][:len(localfiles[j])-1]
#print localfile
if sourcefile == localfile:
bDelete = False
break
if bDelete == True:
optstr = "svn delete %s/%s -m /"/" /n"%(path[5:],sourcefile)
print optstr
os.system(optstr)
os.system("svn up")
删除.svn以脱离svn管理
find ./ -name '.svn' -exec rm -rf {} /;
1、 将文 件checkout到本地目录
例如:svn checkout svn ://192.168 .1.1 /pro/domain
简写:svn co
2、 往版 本库中添加新的文件
例如:svn add test.php(添加test.php)
svn add *.php(添加当前目录