def commit_offline(self,site_name): product_dir = self.workspace + os.sep + self.sites[site_name]["product_dir"] online_dir = self.workspace + os.sep + self.sites[site_name]["online_dir"] site_dir = self.workspace + os.sep + self.sites[site_name]["site_dir"] pywincmds.del_all_except_hidden_directories(product_dir) pywincmds.robocopy(online_dir, product_dir, py_exclude_dirs=".svn _svn") try: self.substitute(site_dir + os.sep + "config_test" + os.sep + "config", product_dir + os.sep + self.sites[site_name]["config"]) self.substitute(site_dir + os.sep + "config_test" + os.sep + self.sites[site_name]["web_config"]["config_test"], product_dir + os.sep + self.sites[site_name]["web_config"]["online"]) except: pass pywincmds.robocopy(site_dir + os.sep + "config_online", product_dir + os.sep + "Config_online", py_exclude_dirs = ".svn _svn") os.chdir(product_dir + os.sep + "Config_online") os.rename(self.sites[site_name]["web_config"]["config_online"], self.sites[site_name]["web_config"]["online"]) os.chdir(online_dir) lines = pysvn.st("") lines = [line.strip() for line in lines] if len(lines) == 0: pyemail.send(self.to_list, site_name + "无变化内容", "") return else: pywincmds.py_write_svn_message_to_file("\n".join(lines), product_dir + os.sep + "changelist.txt") if os.path.exists(self.getversion_exe): pywincmds.call_cmd(self.getversion_exe + " \"" + self.sourcecode_dir + "\"") time.sleep(10) #pywincmds.copy(self.sourcecode_dir + os.sep + "my_version.txt", self.product_dir + os.sep + self.site_names[site_name] + os.sep + "revision_numbers.txt") svn_log_message = "sourcecode : " + pysvn.py_get_svn_info_url(site_dir, self.sourcecode_username, self.sourcecode_password) + '\n' + "version number : " + pysvn.py_get_svn_info_revision(site_dir, self.sourcecode_username, self.sourcecode_password) + '\n' svn_log_message = svn_log_message + "main updated contents : " + '\n' + self.message pywincmds.py_write_svn_message_to_file(svn_log_message, self.py_log_file) updated_content = pysvn.commit_all(product_dir, self.product_username, self.product_password, self.py_log_file) pyprocessemail.commit_to_product(site_name, self.to_list, updated_content, self.sites[site_name]["product_url"], svn_log_message, self.log_url)
def make_label(self): title = self.full_site_name + "标签已打,谢谢!" os.chdir(self.product_tag_dir) svn_log = pysvn.py_get_log_message(self.online_site_path, self.online_username, self.online_password) pywincmds.py_write_svn_message_to_file(svn_log, self.py_log_file) commited_content = pysvn.commit_all(self.product_tag_dir, self.product_username, self.product_password, self.py_log_file) if commited_content == "": print("提交内容为空") exit(1) pyemail.send(self.to_list, title, commited_content) st = pysvn.st(self.product_tag_dir) pyemail.send("*****@*****.**", self.full_site_name + "标签内容如下,便于检查", '\n'.join(st).strip())