MCPcopy
hub / github.com/ChinaGodMan/UserScripts / is_file_updated_more_than

Function is_file_updated_more_than

utils/helper.py:78–93  ·  view source on GitHub ↗
(file_path, timeout_minutes)

Source from the content-addressed store, hash-verified

76
77# 检查文件提交时间是否超过指定时间
78def is_file_updated_more_than(file_path, timeout_minutes):
79 # 对于被修改的文件,直接返回False
80 if (is_file_modified(file_path)):
81 return False
82 try:
83 result = subprocess.run(
84 ['git', 'log', '-1', '--format=%ct', file_path],
85 capture_output=True, text=True, check=True
86 )
87 last_commit_time = int(result.stdout.strip())
88 current_time = int(time.time())
89 time_diff_minutes = (current_time - last_commit_time) / 60
90 return time_diff_minutes > timeout_minutes
91 except subprocess.CalledProcessError as e:
92 print(f"错误: 无法获取提交时间 - {file_path} {e}")
93 return None
94
95
96# 加载json文件

Callers 5

translate_readmeFunction · 0.90
go_workFunction · 0.90
mainFunction · 0.90
fix_toc.pyFile · 0.90
mainFunction · 0.90

Calls 1

is_file_modifiedFunction · 0.85

Tested by

no test coverage detected