dsh-svn-review 0.2.1 → 0.2.2
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/lib/index.js +9 -1
- package/lib/wc.js +13 -14
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -209,7 +209,15 @@ export function apply(ctx) {
|
|
|
209
209
|
`工作副本 ${value.root}(基线 r${value.revision ?? '?'}):`
|
|
210
210
|
+ `M=${counts.M} A=${counts.A} D=${counts.D} !=${counts['!']} C=${counts.C}`,
|
|
211
211
|
)
|
|
212
|
-
|
|
212
|
+
// 清单过长会挤占上下文,而且一个真实的变更集不该有上千个文件。
|
|
213
|
+
// 截断但明确告知,不要静默吞掉。
|
|
214
|
+
const shown = value.files.slice(0, 300)
|
|
215
|
+
for (const file of shown) lines.push(` ${file.status} ${file.path}`)
|
|
216
|
+
if (value.files.length > shown.length) {
|
|
217
|
+
lines.push(` …另有 ${value.files.length - shown.length} 个未列出`)
|
|
218
|
+
lines.push(' 提示:变更集这么大通常说明判断有问题,而不是你真的改了这么多文件。')
|
|
219
|
+
lines.push(' 可先用 counts 确认规模;若确认属实,再按目录分批核对。')
|
|
220
|
+
}
|
|
213
221
|
}
|
|
214
222
|
const languages = value.project?.languages ?? []
|
|
215
223
|
if (languages.length > 0) {
|
package/lib/wc.js
CHANGED
|
@@ -120,31 +120,30 @@ export async function readChangeSet(start, options = {}) {
|
|
|
120
120
|
}
|
|
121
121
|
if (!stat.isFile()) continue
|
|
122
122
|
|
|
123
|
-
//
|
|
123
|
+
// 快路径:大小与 mtime 都与快照一致 → 未修改,跳过哈希(svn status 也是这么快判的)。
|
|
124
|
+
//
|
|
125
|
+
// 反过来不成立:快照对不上**不能**证明文件被改过。
|
|
126
|
+
// - 复制/还原工作副本会把 mtime 全部刷新,内容一个字节没动;
|
|
127
|
+
// - eol 翻译、快照本身的漂移会让尺寸和 translated_size 不等;
|
|
128
|
+
// - SVN 正在跑(update/commit)时 DB 与磁盘可能短暂不一致。
|
|
129
|
+
// 这几种情况若直接判 M,会一次性报出几千个假改动。所以判 M 一律要有哈希证据。
|
|
124
130
|
const snapshotSize = node.snapshotSize
|
|
125
|
-
if (typeof snapshotSize === 'number' && stat.size !== snapshotSize) {
|
|
126
|
-
files.push({ status: 'M', path: node.relpath, size: stat.size })
|
|
127
|
-
counts.M += 1
|
|
128
|
-
continue
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 快路径二:大小和 mtime 都和快照对得上,跳过哈希。
|
|
132
|
-
// 文件系统时间精度各平台不同,留 2 秒余量;对不上再算 SHA-1 兜底。
|
|
133
131
|
const snapshotMtime = node.snapshotMtime
|
|
134
132
|
if (
|
|
135
133
|
typeof snapshotSize === 'number'
|
|
134
|
+
&& stat.size === snapshotSize
|
|
136
135
|
&& typeof snapshotMtime === 'number'
|
|
137
136
|
&& Math.abs(stat.mtimeMs - snapshotMtime / 1000) < 2000
|
|
138
137
|
) {
|
|
139
138
|
continue
|
|
140
139
|
}
|
|
141
140
|
|
|
142
|
-
//
|
|
141
|
+
// 慢路径:内容与基线校验和一致就说明没改,不管快照字段说什么。
|
|
143
142
|
const base = checksumHex(node.checksum)
|
|
144
|
-
if (base
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
if (base !== null && sha1OfFile(absolute) === base) continue
|
|
144
|
+
|
|
145
|
+
files.push({ status: 'M', path: node.relpath, size: stat.size })
|
|
146
|
+
counts.M += 1
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
for (const node of workingNodes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-svn-review",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"displayName": "DSH SVN Review",
|
|
5
5
|
"description": "SVN change-set scoping plus language and version detection for DeepSeek Harness code review: reads .svn/wc.db directly (no svn.exe), pins down the project language and version, and hands over the matching review rules so findings are judged by that language instead of generic ones.",
|
|
6
6
|
"keywords": [
|