neurastream 0.3.23 → 0.3.24
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 +1 -1
- package/src/core/mr-sweep.ts +19 -3
package/package.json
CHANGED
package/src/core/mr-sweep.ts
CHANGED
|
@@ -279,17 +279,33 @@ export function mrSweep(opts: SweepOpts = {}): SweepResult {
|
|
|
279
279
|
const mrs: SweepMr[] = [];
|
|
280
280
|
let missingCli = false;
|
|
281
281
|
let fail = false;
|
|
282
|
+
// Checkouts of one forge project share an origin: list its MRs once, and let a plan in any
|
|
283
|
+
// of those checkouts track them.
|
|
284
|
+
const urlOf = new Map<string, string>();
|
|
285
|
+
for (const repo of repos) {
|
|
286
|
+
if (!gitTop(repo)) continue;
|
|
287
|
+
const remote = cmd(["git", "-C", repo, "remote", "get-url", "origin"], { env: opts.env });
|
|
288
|
+
const url = remote.code === 0 ? remote.stdout.trim() : "";
|
|
289
|
+
if (url) urlOf.set(repo, url);
|
|
290
|
+
}
|
|
291
|
+
const keyOf = (repo: string): string | undefined => {
|
|
292
|
+
const url = urlOf.get(repo);
|
|
293
|
+
return url ? (remotePath(url) ?? url) : undefined;
|
|
294
|
+
};
|
|
295
|
+
const listedUrls = new Set<string>();
|
|
282
296
|
for (const repo of repos) {
|
|
283
297
|
if (!gitTop(repo)) {
|
|
284
298
|
lines.push(skip(repo, "not a git repo"));
|
|
285
299
|
continue;
|
|
286
300
|
}
|
|
287
|
-
const
|
|
288
|
-
const url = remote.code === 0 ? remote.stdout.trim() : "";
|
|
301
|
+
const url = urlOf.get(repo) ?? "";
|
|
289
302
|
if (!url) {
|
|
290
303
|
lines.push(skip(repo, "no origin remote"));
|
|
291
304
|
continue;
|
|
292
305
|
}
|
|
306
|
+
const key = keyOf(repo) ?? url;
|
|
307
|
+
if (listedUrls.has(key)) continue;
|
|
308
|
+
listedUrls.add(key);
|
|
293
309
|
const host = remoteHost(url);
|
|
294
310
|
const forge = host ? forgeOf(host) : null;
|
|
295
311
|
if (!forge) {
|
|
@@ -305,7 +321,7 @@ export function mrSweep(opts: SweepOpts = {}): SweepResult {
|
|
|
305
321
|
lines.push(skip(repo, "forge unreachable"));
|
|
306
322
|
continue;
|
|
307
323
|
}
|
|
308
|
-
const texts = plans.filter(p => p.repo ===
|
|
324
|
+
const texts = plans.filter(p => keyOf(p.repo) === key && p.status === "open").map(p => p.text);
|
|
309
325
|
const found = listed.items
|
|
310
326
|
.map(item => {
|
|
311
327
|
const token = forge === "gitlab" ? `!${item.number}` : `#${item.number}`;
|