svn_check/main.py
2021-10-18 11:05:35 +08:00

53 lines
1.4 KiB
Python

# 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()