azdo-cli 0.5.0-025-multi-org-support.453 → 0.5.0-025-multi-org-support.457
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/index.js +14 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -288,11 +288,12 @@ async function fetchWorkItemWithFallback(context, id, cred, normalizedExtraField
|
|
|
288
288
|
} catch (err) {
|
|
289
289
|
const msg = err instanceof Error ? err.message : String(err);
|
|
290
290
|
if (!msg.includes("TF51535")) throw err;
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
const
|
|
291
|
+
const orgFieldNames = await getOrgFieldNames(context, cred);
|
|
292
|
+
const orgFieldsLower = new Set(orgFieldNames.map((n) => n.toLowerCase()));
|
|
293
|
+
const missing = normalizedExtraFields.filter((f) => !orgFieldsLower.has(f.toLowerCase()));
|
|
294
|
+
const effectiveExtraFields = normalizedExtraFields.filter((f) => orgFieldsLower.has(f.toLowerCase()));
|
|
294
295
|
for (const f of missing) {
|
|
295
|
-
process.stderr.write(`
|
|
296
|
+
process.stderr.write(`azdo: warning: field '${f}' does not exist in organization '${context.org}' and was skipped
|
|
296
297
|
`);
|
|
297
298
|
}
|
|
298
299
|
const data = await fetchWorkItemResponse(context, id, cred, {
|
|
@@ -889,11 +890,15 @@ function selectRemote(candidates) {
|
|
|
889
890
|
if (origin) return origin;
|
|
890
891
|
if (candidates.length === 1) return candidates[0];
|
|
891
892
|
const first = candidates[0];
|
|
892
|
-
const allSame = candidates.every(
|
|
893
|
+
const allSame = candidates.every(
|
|
894
|
+
(c) => c.org.toLowerCase() === first.org.toLowerCase() && c.project.toLowerCase() === first.project.toLowerCase()
|
|
895
|
+
);
|
|
893
896
|
if (allSame) return first;
|
|
894
|
-
const
|
|
897
|
+
const lines = candidates.map((c) => ` ${c.remoteName.padEnd(8)} \u2192 ${c.org}/${c.project}`).join("\n");
|
|
895
898
|
throw new Error(
|
|
896
|
-
`
|
|
899
|
+
`Multiple Azure DevOps remotes found with different org/project:
|
|
900
|
+
${lines}
|
|
901
|
+
Use --org/--project (or 'git remote rename <name> origin') to disambiguate.`
|
|
897
902
|
);
|
|
898
903
|
}
|
|
899
904
|
function readGitConfigContent() {
|
|
@@ -980,7 +985,7 @@ function parseRepoName(url) {
|
|
|
980
985
|
function detectRepoName() {
|
|
981
986
|
let remoteUrl;
|
|
982
987
|
try {
|
|
983
|
-
remoteUrl = execSync("git remote get-url origin", { encoding: "utf-8" }).trim();
|
|
988
|
+
remoteUrl = execSync("git remote get-url origin", { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
984
989
|
} catch {
|
|
985
990
|
throw new Error('Not in a git repository. Check that git remote "origin" exists and try again.');
|
|
986
991
|
}
|
|
@@ -991,7 +996,7 @@ function detectRepoName() {
|
|
|
991
996
|
return repo;
|
|
992
997
|
}
|
|
993
998
|
function getCurrentBranch() {
|
|
994
|
-
const branch = execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
|
|
999
|
+
const branch = execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
995
1000
|
if (branch === "HEAD") {
|
|
996
1001
|
throw new Error("Not on a named branch. Check out a named branch and try again.");
|
|
997
1002
|
}
|