Fixed logs
This commit is contained in:
20
app.ts
20
app.ts
@@ -46,7 +46,6 @@ const runGitCommand = (args: string[], options?: SpawnOptions): Promise<string>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all remote branches.
|
* Fetch all remote branches.
|
||||||
*/
|
*/
|
||||||
@@ -90,18 +89,17 @@ const buildRebaseDependencyGraph = async (branches: string[]): Promise<Record<st
|
|||||||
for (const branchA of branches) {
|
for (const branchA of branches) {
|
||||||
for (const branchB of branches) {
|
for (const branchB of branches) {
|
||||||
if(branchA !== branchB) {
|
if(branchA !== branchB) {
|
||||||
const infos = {
|
const isSuperset: boolean = commitHistories[branchA].isSupersetOf(commitHistories[branchB]);
|
||||||
superset: commitHistories[branchA].isSupersetOf(commitHistories[branchB]),
|
const difference: Set<string> = commitHistories[branchA].difference(commitHistories[branchB]);
|
||||||
difference: commitHistories[branchA].difference(commitHistories[branchB])
|
|
||||||
}
|
if (isSuperset) {
|
||||||
if (infos.superset) {
|
|
||||||
if(branchB === mainBranch) {
|
if(branchB === mainBranch) {
|
||||||
// SUPERSET OF MAIN BRANCH, MEANING ALREADY REBASED
|
// SUPERSET OF MAIN BRANCH, MEANING ALREADY REBASED
|
||||||
finalBranches[branchA] = {
|
finalBranches[branchA] = {
|
||||||
ignore: true
|
ignore: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (infos.difference.size === 0) {
|
if (difference.size === 0) {
|
||||||
const prevBranches: string[] = finalBranches[branchA]?.equalBranches ?? [];
|
const prevBranches: string[] = finalBranches[branchA]?.equalBranches ?? [];
|
||||||
finalBranches[branchA] = {
|
finalBranches[branchA] = {
|
||||||
rebaseBranch: mainBranch,
|
rebaseBranch: mainBranch,
|
||||||
@@ -109,11 +107,11 @@ const buildRebaseDependencyGraph = async (branches: string[]): Promise<Record<st
|
|||||||
equalBranches: [...prevBranches, branchB]
|
equalBranches: [...prevBranches, branchB]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (branchA !== mainBranch && (!finalBranches[branchA] || finalBranches[branchA].differenceWithRebase > infos.difference.size)) {
|
if (branchA !== mainBranch && (!finalBranches[branchA] || finalBranches[branchA].differenceWithRebase > difference.size)) {
|
||||||
finalBranches[branchA] = {
|
finalBranches[branchA] = {
|
||||||
...finalBranches[branchA],
|
...finalBranches[branchA],
|
||||||
rebaseBranch: branchB,
|
rebaseBranch: branchB,
|
||||||
differenceWithRebase: infos.difference.size
|
differenceWithRebase: difference.size
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +173,7 @@ const rebaseBranch = async ({
|
|||||||
onBranch,
|
onBranch,
|
||||||
action
|
action
|
||||||
}: RebaseAction) => {
|
}: RebaseAction) => {
|
||||||
console.log(`${ action === Action.Rebase ? "Rebasing" : "Resetting" } ${ branch } on ${ onBranch }`);
|
writeConsole(`${ action === Action.Rebase ? "Rebasing" : "Resetting" } ${ branch } on ${ onBranch }`);
|
||||||
|
|
||||||
await runGitCommand([
|
await runGitCommand([
|
||||||
"checkout",
|
"checkout",
|
||||||
@@ -255,7 +253,7 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
writeConsole("Error during workflow execution", LogLevel.ERROR);
|
writeConsole("Error during workflow execution", LogLevel.ERROR);
|
||||||
writeConsole(error.message, LogLevel.ERROR);
|
writeConsole(error, LogLevel.ERROR);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
dist/app.js
vendored
10
dist/app.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user