MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / get_new_file

Method get_new_file

tools/ci/file_check.py:82–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80 return 1
81
82 def get_new_file(self):
83 file_list = list()
84 try:
85 os.system('git remote add rtt_repo {}'.format(self.rtt_repo))
86 os.system('git fetch rtt_repo')
87 os.system('git merge rtt_repo/{}'.format(self.rtt_branch))
88 os.system('git reset rtt_repo/{} --soft'.format(self.rtt_branch))
89 os.system('git status > git.txt')
90 except Exception as e:
91 logging.error(e)
92 return None
93 try:
94 with open('git.txt', 'r') as f:
95 file_lines = f.readlines()
96 except Exception as e:
97 logging.error(e)
98 return None
99 file_path = ''
100 for line in file_lines:
101 if 'new file' in line:
102 file_path = line.split('new file:')[1].strip()
103 logging.info('new file -> {}'.format(file_path))
104 elif 'deleted' in line:
105 logging.info('deleted file -> {}'.format(line.split('deleted:')[1].strip()))
106 elif 'modified' in line:
107 file_path = line.split('modified:')[1].strip()
108 logging.info('modified file -> {}'.format(file_path))
109 else:
110 continue
111
112 result = self.__exclude_file(file_path)
113 if result != 0:
114 file_list.append(file_path)
115
116 return file_list
117
118
119class FormatCheck:

Callers 2

checkFunction · 0.95
checkFunction · 0.95

Calls 2

__exclude_fileMethod · 0.95
openFunction · 0.50

Tested by

no test coverage detected