Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getStagingDetails(
propsWithInfo: PropsWithInfo
): { repoPath: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.info.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.info.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
repoPath: normalizeRepoPath(remote),
ref,
unconfigured: stagingInfo.status === 'repository.unconfigured',
}
}
}
}
return undefined
}
function getStagingDetails(
propsWithInfo: PropsWithInfo
): { repoPath: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.info.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.info.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
repoPath: normalizeRepoPath(remote),
ref,
unconfigured: stagingInfo.status === 'repository.unconfigured',
}
}
}
}
return undefined
}
function getStagingDetails(
propsWithInfo: PropsWithInfo
): { repoPath: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.info.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.info.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
repoPath: normalizeRepoPath(remote),
ref,
unconfigured: stagingInfo.status === 'repository.unconfigured',
}
}
}
}
return undefined
}
function getStagingDetails(
propsWithInfo: PropsWithDiffDetails
): { repoName: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.diffDetails.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.diffDetails.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
function getStagingDetails(
propsWithInfo: PropsWithInfo
): { repoPath: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.info.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.info.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
function getStagingDetails(
propsWithInfo: PropsWithInfo
): { repoPath: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.info.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.info.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
function getStagingDetails(
propsWithInfo: PropsWithDiffDetails
): { repoName: string; ref: ConduitRef; unconfigured: boolean } | undefined {
const stagingInfo = propsWithInfo.diffDetails.properties['arc.staging']
if (!stagingInfo) {
return undefined
}
let key: string
if (propsWithInfo.isBase) {
const type = propsWithInfo.useDiffForBase ? 'diff' : 'base'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
} else {
const type = propsWithInfo.useBaseForDiff ? 'base' : 'diff'
key = `refs/tags/phabricator/${type}/${propsWithInfo.diffID}`
}
for (const ref of propsWithInfo.diffDetails.properties['arc.staging'].refs) {
if (ref.ref === key) {
const remote = ref.remote.uri
if (remote) {
return {
repoName: normalizeRepoName(remote),
ref,
unconfigured: stagingInfo.status === 'repository.unconfigured',
}
}
}
}
return undefined
}