Skip to content

Commit

Permalink
chore: increase log outputs to better track backmerge process
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Jul 18, 2021
1 parent be4d2ef commit 45e998e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/perform-backmerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,35 @@ export async function performBackmerge(git: Git, pluginConfig: Partial<Config>,
return;
}

context.logger.log(
'Release succeeded. Performing back-merge into branch "' + developBranchName + '".'
);
context.logger.log('Release succeeded. Performing back-merge into branch "' + developBranchName + '".');

// Make sure all remotes are fetched
context.logger.log(`Fetching all remotes.`);
await git.configFetchAllRemotes();

// Get latest commits before checking out
await git.fetch(context.options?.repositoryUrl ?? null);
context.logger.log(`Fetching latest commits from repository at "${context.options.repositoryUrl}".`);
await git.fetch(context.options.repositoryUrl);

if (options.clearWorkspace) {
context.logger.log(
'Stashing uncommitted files from Git workspace.'
);
context.logger.log('Stashing uncommitted files from Git workspace.');
await git.stash();
}

if (developBranchName !== masterBranchName) {
// Branch is detached. Checkout master first to be able to check out other branches
context.logger.log('Branch is detached. Checking out master branch.');
await git.checkout(masterBranchName);
context.logger.log('Checking out develop branch.');
await git.checkout(developBranchName);
context.logger.log(`Performing backmerge with "${options.backmergeStrategy}" strategy.`);
if (options.backmergeStrategy === 'merge') {
await git.merge(masterBranchName, options.mergeMode);
} else {
await git.rebase(masterBranchName);
}
} else {
context.logger.log('Checking out develop branch directly.');
await git.checkout(developBranchName);
}

Expand All @@ -67,12 +69,11 @@ export async function performBackmerge(git: Git, pluginConfig: Partial<Config>,
);
}

context.logger.log(`Pushing backmerge to develop branch ${developBranchName}`);
await git.push(context.options.repositoryUrl, developBranchName, options.forcePush);

if (options.restoreWorkspace) {
context.logger.log(
'Restoring stashed files to Git workspace.'
);
context.logger.log('Restoring stashed files to Git workspace.');
await git.unstash();
}
}
Expand Down

0 comments on commit 45e998e

Please sign in to comment.