From 101182f907a599184477b71d269d420ed668a597 Mon Sep 17 00:00:00 2001 From: wuaho Date: Mon, 18 Oct 2021 11:05:35 +0800 Subject: [PATCH] 'init' --- .gitignore | 2 +- main.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 main.py diff --git a/.gitignore b/.gitignore index 13d1490..dd1d1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -128,4 +128,4 @@ dmypy.json # Pyre type checker .pyre/ - +.idea diff --git a/main.py b/main.py new file mode 100644 index 0000000..88dc605 --- /dev/null +++ b/main.py @@ -0,0 +1,52 @@ +# coding:utf-8 +import os +import subprocess + + +class SvnUP: + def __init__(self, root_path): + self.json_files = set() + self.root_path = root_path + self.skeleton_json_files = set() + self.file_count = 0 + self.error_file = set() + + def check_all_file(self, path): + """ + 取所有文件 + :param path: + :return: + """ + if '.svn' in path: + return + all_files = os.listdir(path) + for file in all_files: + filepath = os.path.join(path, file) + # print(filepath) + self.file_count += 1 + if os.path.isdir(filepath): + self.check_all_file(filepath) + cmd = fr"""svn update {filepath}""" + try: + status, output = subprocess.getstatusoutput(cmd) + # print(output) + if 'svn: E130003' in output: + print('='*50) + print(filepath) + print(output) + self.error_file.add(filepath) + except Exception as e: + print('=' * 50) + print(e) + self.error_file.add(filepath) + + def run(self): + self.check_all_file(self.root_path) + print('*' * 50) + for i in self.error_file: + print(i) + + +if __name__ == '__main__': + up = SvnUP(r'I:\work\SVN\new_shenghua\cehua\EXCEL') + up.run()