def commit(): global release_notes_url title = site_name + "三段测试通过,请更新线上服务器,谢谢!" if release_notes_url == None: f = open(url_file) svn_url = f.readlines()[0].strip() release_notes_url = os.path.dirname(svn_url) try: if svn_url.rindex('/') == len(svn_url) - 1 or svn_url.rindex('\\') == len(svn_url): release_notes_url = os.path.dirname(release_notes_url) except: pass f.close() pt = pyupdate_three() sourcecode = {"username":username, "password":password} release_notes_file = pt.get_release_notes_path(release_notes_url, sourcecode, release_notes_local_path) commit_content = pysvn.commit_targets(site_path, changelist, username_online, password_online, message, isfile=False) content = "各位好:" + "\n" + "三段测试通过,请更新线上服务器,谢谢!" + "\n" + "提交内容为:" + "\n" + commit_content + "\n" content = content + "日志信息:\n" + message content = content + "\n" + "详情见:" + "\n" + log_url if release_notes_file == None: pyemail.send(to_list, title, content, []) else: pyemail.send(to_list, title, content, [release_notes_file]) st = pysvn.st(site_path) pyemail.send(["*****@*****.**"], site_name + "站点目录当前内容如下,便于检查", '\n'.join(st).strip() + " ", [])
def commit(): #pdb.set_trace() #读取文件http列表 url_transfer_path() #转换为路径 #提交路径文件 #两个工作,将新增的多层目录加到提交列表中,然后分组,按组提交 commit_arr = [[], [], []] all_paths = online_paths[0:len(online_paths)] temp_paths = [] for i in all_paths: temp_paths.append(i.lower()) for online_path in online_paths: stat = pysvn.st(online_path.strip()) if len(stat) == 1: if stat[0].find('?') == 0 or stat[0].find('is not a working copy') > -1: pysvn.py_cmd.command_str = 'svn add --parents "' + online_path.strip() + '"' pysvn.py_cmd.is_cmd_succeeded() addoutputs = pysvn.py_cmd.get_stdout_lines() for addoutput in addoutputs: addoutput_path = addoutput.replace(addoutput[0],'',1).strip() try: if temp_paths.index(addoutput_path.lower()) > -1: continue except: all_paths.append(addoutput_path) temp_paths.append(addoutput_path.lower()) #分组 for path in all_paths: if path.find(style_online_wks[0]) > -1: commit_arr[0].append(path) elif path.find(style_online_wks[1]) > -1: commit_arr[1].append(path) elif path.find(style_online_wks[2]) > -1: commit_arr[2].append(path) return_content = " " for index in range(0,len(commit_arr)): print(commit_arr[index]) print("\n\n") if len(commit_arr[index]) > 0: pywincmds.py_write_svn_message_to_file(os.linesep.join(commit_arr[index]), workspace + os.sep + "changelist.txt") return_content += pysvn.commit_targets(style_online_wks[index], workspace + os.sep + "changelist.txt", style_online_username, style_online_password, content, False) #发送邮件,确认已提交 pyemail.send(["*****@*****.**"], content.strip() + "样式已提交", return_content, []) pass
def commit(self): title = self.full_site_name + "三段测试通过,请更新线上服务器,谢谢!" os.chdir(self.online_site_path) svn_log = pysvn.py_get_log_message(self.product_trunk_dir, self.product_username, self.product_password) pywincmds.py_write_svn_message_to_file(svn_log, self.py_log_file) release_notes_file = self.get_release_notes_path(self.release_notes_url, self.sourcecode_username, self.sourcecode_password, self.release_notes_local_path) commited_content = pysvn.commit_targets(self.online_site_path, self.temp_changelist, self.online_username, self.online_password, self.py_log_file) #如果提交内容为空,则不提交。 if commited_content == "": print("提交内容为空") exit(1) #pyprocessemail.commit_to_online(site, to_list, commited_content, product_test["url"], svn_log, log_url) #print("邮件参数为:",site, to_list, commited_content, product_release_revision, svn_log, log_url, release_notes_path) content = "各位好:" + "\n" + "三段测试通过,请更新线上服务器,谢谢!" + "\n" + "提交内容为:" + "\n" + commited_content + "\n" content = content + "日志信息:\n" + svn_log content = content + "\n" + "详情见:" + "\n" + self.log_url if release_notes_file == None: pyemail.send(self.to_list, title, content, []) else: pyemail.send(self.to_list, title, content, [release_notes_file]) st = pysvn.st(self.online_site_path) pyemail.send("*****@*****.**", self.full_site_name + "站点目录当前内容如下,便于检查", '\n'.join(st).strip())