首页
学习
活动
专区
工具
TVP
发布

授客的专栏

专业软件测试知识分享平台
专栏作者
609
文章
1058081
阅读量
42
订阅数
svn checkout 实用小技巧
用svn小乌龟软件,进行update,commit之前,先要把svn工作目录checkout到本地,那么问题就来了:
授客
2019-09-11
1.4K0
Python 一键上传下载&一键提交文件到SVN入基线工具
[CONFIG] deault_svn_work_path = D:\svn\ version = V8.3 rc = RC1 path_for_localconf = D:\svn\myfolder\V8.3 path_for_localdb = D:\Git\ddt-core-ws\db\V8.3 svn_work_path_for_baseline = D:\svn\myfolder\base
授客
2019-09-11
1K0
Python 一键commit文件、目录到SVN服务器
#!/usr/bin/env/ python # -*- coding:utf-8 -*- __author__ = 'shouke' import subprocess import os.path class SVNClient: def __init__(self): self.svn_work_path = 'D:\svn\myfolder' if not os.path.exists(self.svn_work_path): print('svn工作路径:%s 不存在,退出程序' % self.svn_work_path) exit() self.try_for_filure = 1 # 提交失败,重试次数 def get_svn_work_path(self): return self.svn_work_path def set_svn_work_path(self, svn_work_path): self.svn_work_path = svn_work_path def update(self): args = 'cd /d ' + self.svn_work_path + ' & svn update' with subprocess.Popen(args, shell=True, universal_newlines = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: output = proc.communicate() print('执行svn update命令输出:%s' % str(output)) if not output[1]: print('svn update命令执行成功' ) return [True,'执行成功'] else: print('svn update命令执行失败:%s' % str(output)) return [False, str(output)] def add(self, path): args = 'cd /d ' + self.svn_work_path + ' & svn add ' + path with subprocess.Popen(args, shell=True, universal_newlines = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: output = proc.communicate() print('执行svn add命令输出:%s' % str(output)) if not output[1] or ( not str(output) and str(output).find('is already under version control') != -1): print('svn add命令执行成功' ) return [True,'执行成功'] else: print('svn add命令执行失败:%s' % str(output)) return [False, 'svn add命令执行失败:%s' % str(output)] def commit(self, path): args = 'cd /d ' + self.svn_work_path + ' & svn commit -m "添加版本文件"' + path with subprocess.Popen(args, shell=True, universal_newlines = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: output = proc.communicate() print('执行svn commit命令输出:%s' % str(output)) if not output[1]: print('svn commit命令执行成功' ) return [True,'执行成功'] else: print('svn commit命令执行失败,正在重试:%s' % str(output)) if self
授客
2019-09-11
2K0
Python 文件复制&按目录树结构拷贝&批量删除目录及其子目录下的文件
#!/usr/bin/env/ python # -*- coding:utf-8 -*- __author__ = 'shouke' import os import subprocess # 复制文件或目录到指定目录(非自身目录) def copy_dir_or_file(src, dest): if not os.path.exists(dest): print('目标路径:%s 不存在' % dest) return [False, '目标路径:%s 不存在' % dest] elif not os.path.isdir(dest): print('目标路径:%s 不为目录' % dest) return [False, '目标路径:%s 不为目录' % dest] elif src.replace('/', '\\').rstrip('\\') == dest.replace('/', '\\').rstrip('\\'): print('源路径和目标路径相同,无需复制') return [True,'源路径和目标路径相同,不需要复制'] if not os.path.exists(src): print('源路径:%s 不存在' % src) return [False, '源路径:%s 不存在' % src] # /E 复制目录和子目录,包括空的 /Y 无需确认,自动覆盖已有文件 args = 'xcopy /YE ' + os.path.normpath(src) + ' ' + os.path.normpath(dest) # 注意:xcopy不支持 d:/xxx,只支持 d:\xxxx,所以要转换 try: with subprocess.Popen(args, shell=True, universal_newlines = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: output = proc.communicate() print('复制文件操作输出:%s' % str(output)) if not output[1]: print('复制目标文件|目录(%s) 到目标目录(%s)成功' % (src, dest)) return [True,'复制成功'] else: print('复制目标文件|目录(%s) 到目标目录(%s)失败:%s' % (src, dest, output[1])) return [False,'复制目标文件|目录(%s) 到目标目录(%s)失败:%s' % (src, dest, output[1])] except Exception as e: print('复制目标文件|目录(%s) 到目标目录(%s)失败 %s' % (src, dest, e)) return [False, '复制目标文件|目录(%s) 到目标目录(%s)失败 %s' % (src, dest, e)] # 删除指定目录及其子目录下的所有子文件,不删除目录 def delete_file(dirpath): if not os.path.exists(dirpath): print('要删除的目标路径:%s 不存在' % dirpath) return [False, '要删除的目标路径:%s 不存在' % dirpath] elif not os.path.isdir(dirpath): print('要删除的目标路径:%s 不为目录' % dirpath) return [False, '要删除的目标路径:%s 不为目录' % dirpath] # 注意:同xcopy命令,del也不支持 d:/xxxx,Linux/Unix路径的写法,只支持d:\xxx windows路径的写法 args = 'del /F/S/Q ' + os.path.normpath(dirpath) # /F 强制删除只读文件。 /S 删除所有子目录中的指定的文件。 /Q 安静模式。删除前,不要求确认 try: with subprocess.Popen(args, shell=True, universal_newlines = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc:
授客
2019-09-11
1.8K0
Python基于Python实现批量上传文件或目录到不同的Linux服务器
批量上传文件、目录(包括该目录下的所有文件,子目录及其文件)到不同的Linux服务器
授客
2019-09-11
2.1K0
测试思想-流程规范 软件测试版本管理与版本发布
阅读该文章之前,建议先了解下做产品和做项目的区别,只有理解了做项目和做产品的联系与区别后,我们才知道怎么对测试工作进行规划,更好的把控质量。
授客
2019-09-11
1.5K0
SVN SVN合并(Merge)与拉取分支(Branch/tag)操作简介
例子:把对feature_branch\project_name_v3.3.7_branch的修改合并到develop
授客
2019-09-10
9K0
测试思想-流程规范 SVN代码管理与版本控制
[root@localhost svn]# svnadmin create --fs-type fsfs project1
授客
2019-09-10
9770
没有更多了
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档