@hupan56/wlkj 2.3.2 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -140,6 +140,7 @@ def validate_req_ids(prd_paths: List[str], repo_root: Union[str, Path]) -> None:
|
|
|
140
140
|
seen = {}
|
|
141
141
|
errors = []
|
|
142
142
|
# 全库已有 REQ-ID (用于跨人撞号检测)
|
|
143
|
+
# existing: {(year,n): [filepath, ...]}
|
|
143
144
|
existing = scan_existing_req_ids(repo_root)
|
|
144
145
|
|
|
145
146
|
for p in prd_paths:
|
|
@@ -158,13 +159,17 @@ def validate_req_ids(prd_paths: List[str], repo_root: Union[str, Path]) -> None:
|
|
|
158
159
|
)
|
|
159
160
|
else:
|
|
160
161
|
seen[key] = p
|
|
161
|
-
# 跨人/全库撞号检测:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
# 跨人/全库撞号检测: 该号已存在于仓库的其他文件
|
|
163
|
+
# existing[key] 是列表; 只要里面有"文件名跟当前不同的"就算撞号
|
|
164
|
+
if key in existing:
|
|
165
|
+
for other_path in existing[key]:
|
|
166
|
+
if os.path.basename(other_path) != basename:
|
|
167
|
+
errors.append(
|
|
168
|
+
"撞号: %s 与仓库已有的 %s 都是 REQ-%d-%03d "
|
|
169
|
+
"(两人离线各建了同号 PRD? 请改其中一个的编号)"
|
|
170
|
+
% (basename, os.path.basename(other_path), year, n)
|
|
171
|
+
)
|
|
172
|
+
break # 一个冲突够了
|
|
168
173
|
# 超界检测 (NNN 不能超过计数器, 防止跳号)
|
|
169
174
|
max_n = current_counter(str(year), repo_root)
|
|
170
175
|
if max_n > 0 and n > max_n:
|
|
@@ -253,7 +258,7 @@ def scan_existing_req_ids(repo_root: Optional[Union[str, Path]] = None) -> dict:
|
|
|
253
258
|
if d.is_dir():
|
|
254
259
|
scan_dirs.append(d)
|
|
255
260
|
|
|
256
|
-
existing = {}
|
|
261
|
+
existing = {} # (year, n) -> [filepath, ...] (一个号可能被多个文件用)
|
|
257
262
|
for d in scan_dirs:
|
|
258
263
|
if not d.is_dir():
|
|
259
264
|
continue
|
|
@@ -263,7 +268,7 @@ def scan_existing_req_ids(repo_root: Optional[Union[str, Path]] = None) -> dict:
|
|
|
263
268
|
continue
|
|
264
269
|
parsed = parse_req_id(f.name)
|
|
265
270
|
if parsed:
|
|
266
|
-
existing[
|
|
271
|
+
existing.setdefault(parsed, []).append(str(f))
|
|
267
272
|
except OSError:
|
|
268
273
|
continue
|
|
269
274
|
return existing
|