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.
|
||||
*/
|
||||
@@ -90,18 +89,17 @@ const buildRebaseDependencyGraph = async (branches: string[]): Promise<Record<st
|
||||
for (const branchA of branches) {
|
||||
for (const branchB of branches) {
|
||||
if(branchA !== branchB) {
|
||||
const infos = {
|
||||
superset: commitHistories[branchA].isSupersetOf(commitHistories[branchB]),
|
||||
difference: commitHistories[branchA].difference(commitHistories[branchB])
|
||||
}
|
||||
if (infos.superset) {
|
||||
const isSuperset: boolean = commitHistories[branchA].isSupersetOf(commitHistories[branchB]);
|
||||
const difference: Set<string> = commitHistories[branchA].difference(commitHistories[branchB]);
|
||||
|
||||
if (isSuperset) {
|
||||
if(branchB === mainBranch) {
|
||||
// SUPERSET OF MAIN BRANCH, MEANING ALREADY REBASED
|
||||
finalBranches[branchA] = {
|
||||
ignore: true
|
||||
}
|
||||
}
|
||||
if (infos.difference.size === 0) {
|
||||
if (difference.size === 0) {
|
||||
const prevBranches: string[] = finalBranches[branchA]?.equalBranches ?? [];
|
||||
finalBranches[branchA] = {
|
||||
rebaseBranch: mainBranch,
|
||||
@@ -109,11 +107,11 @@ const buildRebaseDependencyGraph = async (branches: string[]): Promise<Record<st
|
||||
equalBranches: [...prevBranches, branchB]
|
||||
};
|
||||
} 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],
|
||||
rebaseBranch: branchB,
|
||||
differenceWithRebase: infos.difference.size
|
||||
differenceWithRebase: difference.size
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -175,7 +173,7 @@ const rebaseBranch = async ({
|
||||
onBranch,
|
||||
action
|
||||
}: RebaseAction) => {
|
||||
console.log(`${ action === Action.Rebase ? "Rebasing" : "Resetting" } ${ branch } on ${ onBranch }`);
|
||||
writeConsole(`${ action === Action.Rebase ? "Rebasing" : "Resetting" } ${ branch } on ${ onBranch }`);
|
||||
|
||||
await runGitCommand([
|
||||
"checkout",
|
||||
@@ -255,7 +253,7 @@ const main = async (): Promise<void> => {
|
||||
}
|
||||
} catch (error) {
|
||||
writeConsole("Error during workflow execution", LogLevel.ERROR);
|
||||
writeConsole(error.message, LogLevel.ERROR);
|
||||
writeConsole(error, LogLevel.ERROR);
|
||||
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