Skip to content

Commit f687b4f

Browse files
Vikram KaltaVikram Kalta
authored andcommitted
fix: version bumped and no item selection message handlign
1 parent 77301ae commit f687b4f

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

packages/contentstack-branches/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-branches",
33
"description": "Contentstack CLI plugin to do branches operations",
4-
"version": "1.3.0",
4+
"version": "1.3.1",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {

packages/contentstack-branches/src/branch/merge-handler.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import os from 'os';
22
import path from 'path';
33
import forEach from 'lodash/forEach';
44
import { cliux } from '@contentstack/cli-utilities';
5+
import chalk from 'chalk';
56
import { MergeInputOptions, MergeSummary } from '../interfaces';
67
import {
78
selectMergeStrategy,
@@ -132,8 +133,11 @@ export default class MergeHandler {
132133
} else if (this.strategy === 'overwrite_with_compare') {
133134
this.mergeSettings.strategy = 'overwrite_with_compare';
134135
}
135-
136-
await this.displayMergeSummary();
136+
if (this.checkEmptySelection()) {
137+
cliux.print(chalk.red('No items selected'));
138+
} else {
139+
await this.displayMergeSummary();
140+
}
137141

138142
if (!this.executeOption) {
139143
const executionResponse = await selectMergeExecution();
@@ -152,6 +156,17 @@ export default class MergeHandler {
152156
}
153157
}
154158

159+
checkEmptySelection() {
160+
for (let module in this.branchCompareData) {
161+
if (this.mergeSettings.mergeContent[module]?.modified?.length
162+
|| this.mergeSettings.mergeContent[module]?.added?.length
163+
|| this.mergeSettings.mergeContent[module]?.deleted?.length) {
164+
return false;
165+
}
166+
}
167+
return true;
168+
}
169+
155170
displayMergeSummary() {
156171
if (this.mergeSettings.strategy !== 'ignore') {
157172
for (let module in this.branchCompareData) {

0 commit comments

Comments
 (0)