首页 > 代码库 > python 提交SVN 写更新日志
python 提交SVN 写更新日志
SCENE = "mjdy_dyhry"DIRS = {"md5/scenes/" + SCENE,"data/tex/scenes/" + SCENE,"data/tex/share","data/mesh/scenes/" + SCENE,}import osWORKSPACE = "D:/workspace/muData/"#os.getcwd()+# execute command, and return the outputdef execCmd(cmd): r = os.popen(cmd) text = r.read() r.close() return text# write "data" to file-filenamedef writeFile(filename, data): f = open(filename, "w") f.write(data) f.close() def svnCommit(targetDir): cmd = "svn up \"%s\" --non-interactive -q" logtext = execCmd(cmd% targetDir) + "\n" cmd = "svn add \"%s\" --force" logtext += execCmd(cmd% targetDir) + "\n" cmd = "svn commit \"%s\" -m ‘Auto_Commit‘" logtext += execCmd(cmd% targetDir) + "\n" return logtext def updateAll(): logtext = "" for key in DIRS: logtext += svnCommit(WORKSPACE + key) print logtext return logtextimport reimport timedef filter(text): vec = text.split("\n") rs = "" for line in vec: print line if re.match( r‘Sending*‘, line, re.M|re.I): rs += line + "\n" elif re.match( r‘Adding*‘, line, re.M|re.I): rs += line + "\n" return rs info = updateAll()loginfo = filter(info)if not os.path.exists("loghistory"): os.mkdir("loghistory")curtime = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) + ".txt"logfile = "loghistory/" + curtimewriteFile(logfile, loginfo)if(len(loginfo) > 8): execCmd("loghistory\\" + curtime)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。