@aaronshaf/ger 1.2.10 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/commands/branch.ts +31 -15
package/README.md
CHANGED
package/package.json
CHANGED
package/src/commands/branch.ts
CHANGED
|
@@ -39,7 +39,9 @@ export function branch({
|
|
|
39
39
|
const changeId = localBranchDataMap[name].changeId;
|
|
40
40
|
if (changeId) {
|
|
41
41
|
const gerritData = gerritOutputByChangeId[changeId];
|
|
42
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
gerritData?.status === "MERGED" || gerritData?.status === "ABANDONED"
|
|
44
|
+
);
|
|
43
45
|
}
|
|
44
46
|
return false;
|
|
45
47
|
});
|
|
@@ -100,19 +102,21 @@ function output(
|
|
|
100
102
|
.filter(Boolean)
|
|
101
103
|
.map((str) => `[${str}]`) as string[];
|
|
102
104
|
|
|
103
|
-
const approvals = (gerritData.currentPatchSet.approvals || []).map(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const approvals = (gerritData.currentPatchSet.approvals || []).map(
|
|
106
|
+
(a) => {
|
|
107
|
+
let description = a.description;
|
|
108
|
+
if (a.type === "SUBM" && !description) {
|
|
109
|
+
description = "Submitted";
|
|
110
|
+
}
|
|
111
|
+
return isVerbose
|
|
112
|
+
? `${description || a.type}: ${normalizeValue(
|
|
113
|
+
a.value
|
|
114
|
+
)} (${normalizeApproverName(a.by.name)})`
|
|
115
|
+
: `${abbreviateApproverDescription(
|
|
116
|
+
description || a.type
|
|
117
|
+
)}${normalizeValue(a.value)}`;
|
|
107
118
|
}
|
|
108
|
-
|
|
109
|
-
? `${description || a.type}: ${normalizeValue(
|
|
110
|
-
a.value
|
|
111
|
-
)} (${normalizeApproverName(a.by.name)})`
|
|
112
|
-
: `${abbreviateApproverDescription(
|
|
113
|
-
description || a.type
|
|
114
|
-
)}${normalizeValue(a.value)}`;
|
|
115
|
-
});
|
|
119
|
+
);
|
|
116
120
|
|
|
117
121
|
const approvalText = approvals.join(isVerbose ? "\n" : ", ");
|
|
118
122
|
|
|
@@ -122,7 +126,9 @@ function output(
|
|
|
122
126
|
|
|
123
127
|
if (isVerbose) {
|
|
124
128
|
table.push([
|
|
125
|
-
`${bold(localBranch)}${topicText}\n${
|
|
129
|
+
`${bold(localBranch)}${topicText}\n${
|
|
130
|
+
localBranchDataMap[localBranch].shortHash
|
|
131
|
+
}`,
|
|
126
132
|
`${labels.join("\n")}`,
|
|
127
133
|
`${subject}\n${yellow(gerritData.url.replace("https://", ""))}`,
|
|
128
134
|
approvalText,
|
|
@@ -163,11 +169,21 @@ async function promptForMergedBranchDeletion(mergedBranches: string[]) {
|
|
|
163
169
|
input: process.stdin,
|
|
164
170
|
output: process.stdout,
|
|
165
171
|
});
|
|
172
|
+
|
|
173
|
+
if (mergedBranches.length > 0) {
|
|
174
|
+
console.log('')
|
|
175
|
+
console.log(
|
|
176
|
+
`The following ${bold(String(mergedBranches.length))} local branches are merged or abandoned:`
|
|
177
|
+
);
|
|
178
|
+
for (const mergedLocalBranch of mergedBranches) {
|
|
179
|
+
console.log(` ${bold(mergedLocalBranch)}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
166
182
|
|
|
167
183
|
for (const mergedLocalBranch of mergedBranches) {
|
|
168
184
|
const answer: string = await new Promise((resolve) => {
|
|
169
185
|
readline.question(
|
|
170
|
-
`Delete
|
|
186
|
+
`Delete local branch ${bold(mergedLocalBranch)}? (y/n) `,
|
|
171
187
|
resolve
|
|
172
188
|
);
|
|
173
189
|
});
|