gitnexus 1.6.13-rc.22 → 1.6.13-rc.23
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/dist/core/run-analyze.js
CHANGED
|
@@ -949,6 +949,7 @@ async function runFullAnalysisInner(repoPath, options, callbacks, writeTarget, c
|
|
|
949
949
|
if (options.registryName) {
|
|
950
950
|
await registerRepo(repoPath, existingMeta, {
|
|
951
951
|
name: options.registryName,
|
|
952
|
+
onRename: (previousName, nextName) => log(`Registry name changed: "${previousName}" -> "${nextName}".`),
|
|
952
953
|
allowDuplicateName: options.allowDuplicateName,
|
|
953
954
|
branch: placement.branch,
|
|
954
955
|
storagePath,
|
|
@@ -1441,6 +1442,7 @@ async function runFullAnalysisInner(repoPath, options, callbacks, writeTarget, c
|
|
|
1441
1442
|
if (options.registryName) {
|
|
1442
1443
|
await registerRepo(repoPath, existingMeta, {
|
|
1443
1444
|
name: options.registryName,
|
|
1445
|
+
onRename: (previousName, nextName) => log(`Registry name changed: "${previousName}" -> "${nextName}".`),
|
|
1444
1446
|
allowDuplicateName: options.allowDuplicateName,
|
|
1445
1447
|
branch: placement.branch,
|
|
1446
1448
|
storagePath,
|
|
@@ -3638,6 +3640,7 @@ async function runFullAnalysisInner(repoPath, options, callbacks, writeTarget, c
|
|
|
3638
3640
|
// will look up (#979).
|
|
3639
3641
|
const projectName = await registerRepo(repoPath, meta, {
|
|
3640
3642
|
name: options.registryName,
|
|
3643
|
+
onRename: (previousName, nextName) => log(`Registry name changed: "${previousName}" -> "${nextName}".`),
|
|
3641
3644
|
allowDuplicateName: options.allowDuplicateName,
|
|
3642
3645
|
// Non-primary branch runs upsert into the entry's branches[]; the
|
|
3643
3646
|
// primary/flat run (placement.branch === undefined) refreshes the
|
|
@@ -258,6 +258,13 @@ export interface RegisterRepoOptions {
|
|
|
258
258
|
* re-analyses of the same path without `--name` preserve the alias.
|
|
259
259
|
*/
|
|
260
260
|
name?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Best-effort notification after an explicit alias change has been committed
|
|
263
|
+
* to the registry. Invoked after the registry lock is released. Callback
|
|
264
|
+
* failures are ignored: reporting must not turn a successful registry write
|
|
265
|
+
* into an apparent transaction failure.
|
|
266
|
+
*/
|
|
267
|
+
onRename?: (previousName: string, nextName: string) => void | Promise<void>;
|
|
261
268
|
/**
|
|
262
269
|
* Allow two DIFFERENT repo paths to register under the same alias
|
|
263
270
|
* (#829). Mapped from the `--allow-duplicate-name` CLI flag.
|
|
@@ -944,9 +944,23 @@ const registerRepoUnlocked = async (repoPath, meta, opts) => {
|
|
|
944
944
|
fresh.push(merged);
|
|
945
945
|
}
|
|
946
946
|
await writeRegistry(fresh);
|
|
947
|
+
const rename = opts?.name !== undefined && freshExisting && freshExisting.name !== name
|
|
948
|
+
? { previousName: freshExisting.name, nextName: name }
|
|
949
|
+
: undefined;
|
|
950
|
+
return { name, ...(rename ? { rename } : {}) };
|
|
951
|
+
};
|
|
952
|
+
export const registerRepo = async (repoPath, meta, opts) => {
|
|
953
|
+
const { name, rename } = await withRegistryLock(() => registerRepoUnlocked(repoPath, meta, opts));
|
|
954
|
+
if (rename) {
|
|
955
|
+
try {
|
|
956
|
+
await opts?.onRename?.(rename.previousName, rename.nextName);
|
|
957
|
+
}
|
|
958
|
+
catch {
|
|
959
|
+
// The rename is already durable; observer failures cannot roll it back.
|
|
960
|
+
}
|
|
961
|
+
}
|
|
947
962
|
return name;
|
|
948
963
|
};
|
|
949
|
-
export const registerRepo = async (repoPath, meta, opts) => withRegistryLock(() => registerRepoUnlocked(repoPath, meta, opts));
|
|
950
964
|
/**
|
|
951
965
|
* Remove a repo from the global registry.
|
|
952
966
|
* Called after `gitnexus clean`.
|
package/package.json
CHANGED