def p4_edit_file(self, file_path):
file_abspath, file_p4fixed = file_path
p4cfg = self.target
p4 = p4cfg.p4
p4.run_sync('-k', file_p4fixed)
f_st = os.lstat(file_abspath)
is_executable = f_st.st_mode & (stat.S_IXGRP | stat.S_IXUSR)
is_symlink = os.path.islink(file_abspath)
if is_symlink:
output = p4.run_edit('-t', 'symlink', file_p4fixed)
elif is_executable:
output = p4.run_edit('-t', '+x', file_p4fixed)
else:
output = p4.run_edit('-t', 'auto', file_p4fixed)
# If the initial 'add' change was lost
# an edit on a missing file will report
# an error 'not on client'
if p4cfg.inWarnings('not on client'):
msg = '%s not on client. Changing P4 Edit to P4 Add' % file_abspath
self.logger.warning(msg)
output = p4.run_add('-f', file_abspath)
评论列表
文章目录