git-stack-cli 2.9.5 → 2.9.7
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/dist/js/index.js +31 -31
- package/package.json +1 -1
- package/src/app/ManualRebase.tsx +1 -0
- package/src/app/MultiSelect.tsx +11 -0
- package/src/app/SelectCommitRanges.tsx +146 -140
- package/src/commands/Rebase.tsx +1 -0
- package/src/core/CommitMetadata.ts +7 -0
package/package.json
CHANGED
package/src/app/ManualRebase.tsx
CHANGED
|
@@ -147,6 +147,7 @@ async function run() {
|
|
|
147
147
|
// always hard reset and clean to allow subsequent checkout
|
|
148
148
|
// if there are files checkout will fail and cascade fail subsequent commands
|
|
149
149
|
cli.sync(`git reset --hard`, spawn_options);
|
|
150
|
+
cli.sync(`git cherry-pick --abort`, spawn_options);
|
|
150
151
|
cli.sync(`git clean -fd`, spawn_options);
|
|
151
152
|
|
|
152
153
|
// always put self back in original branch
|
package/src/app/MultiSelect.tsx
CHANGED
|
@@ -92,6 +92,7 @@ export function MultiSelect<T>(props: Props<T>) {
|
|
|
92
92
|
React.useEffect(ensure_selectable_focus, [props.items]);
|
|
93
93
|
function ensure_selectable_focus() {
|
|
94
94
|
const current = props.items[index];
|
|
95
|
+
|
|
95
96
|
if (current && !current.disabled) {
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
@@ -115,6 +116,11 @@ export function MultiSelect<T>(props: Props<T>) {
|
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
// prevent accessing `.value` of undefined item
|
|
120
|
+
if (!props.items[index]) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
const item = props.items[index].value;
|
|
119
125
|
const selected_list = Array.from(selected_set);
|
|
120
126
|
const selected = selected_set.has(index);
|
|
@@ -125,6 +131,11 @@ export function MultiSelect<T>(props: Props<T>) {
|
|
|
125
131
|
}, [selected_set]);
|
|
126
132
|
|
|
127
133
|
React.useEffect(() => {
|
|
134
|
+
// prevent accessing `.value` of undefined item
|
|
135
|
+
if (!props.items[index]) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
128
139
|
const item = props.items[index].value;
|
|
129
140
|
const selected_list = Array.from(selected_set);
|
|
130
141
|
const selected = selected_set.has(index);
|
|
@@ -107,18 +107,24 @@ export function SelectCommitRanges() {
|
|
|
107
107
|
Ink.useInput((input, key) => {
|
|
108
108
|
const input_lower = input.toLowerCase();
|
|
109
109
|
|
|
110
|
-
// only allow pr select when on unassigned group
|
|
111
|
-
if (has_unassigned_commits && input_lower === SYMBOL.p) {
|
|
112
|
-
set_pr_select((v) => !v);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
110
|
// allow cancelling pr select with esc
|
|
116
111
|
if (pr_select && key.escape) {
|
|
117
112
|
set_pr_select(false);
|
|
118
113
|
return;
|
|
119
114
|
}
|
|
120
115
|
|
|
121
|
-
//
|
|
116
|
+
// only allow pr select when…
|
|
117
|
+
// 1. we have unassigned commits
|
|
118
|
+
// 2. not inputting group
|
|
119
|
+
// 3. at least one existing prs exists
|
|
120
|
+
if (has_unassigned_commits && !group_input && existing_pr_list.length > 0) {
|
|
121
|
+
if (input_lower === SYMBOL.p) {
|
|
122
|
+
set_pr_select((v) => !v);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// disable key handlers below when inputting
|
|
122
128
|
if (is_input_mode) {
|
|
123
129
|
return;
|
|
124
130
|
}
|
|
@@ -298,23 +304,25 @@ export function SelectCommitRanges() {
|
|
|
298
304
|
/>
|
|
299
305
|
</Ink.Text>
|
|
300
306
|
|
|
301
|
-
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
<
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
307
|
+
{existing_pr_list.length === 0 ? null : (
|
|
308
|
+
<Ink.Text color={colors.blue}>
|
|
309
|
+
<FormatText
|
|
310
|
+
message="Press {p} to {pick} an existing PR"
|
|
311
|
+
values={{
|
|
312
|
+
p: (
|
|
313
|
+
<Ink.Text bold color={colors.green}>
|
|
314
|
+
p
|
|
315
|
+
</Ink.Text>
|
|
316
|
+
),
|
|
317
|
+
pick: (
|
|
318
|
+
<Ink.Text bold color={colors.green}>
|
|
319
|
+
<Parens>p</Parens>pick
|
|
320
|
+
</Ink.Text>
|
|
321
|
+
),
|
|
322
|
+
}}
|
|
323
|
+
/>
|
|
324
|
+
</Ink.Text>
|
|
325
|
+
)}
|
|
318
326
|
</Ink.Box>
|
|
319
327
|
)}
|
|
320
328
|
|
|
@@ -386,7 +394,7 @@ export function SelectCommitRanges() {
|
|
|
386
394
|
</React.Fragment>
|
|
387
395
|
)}
|
|
388
396
|
|
|
389
|
-
{!pr_select ? null : (
|
|
397
|
+
{!pr_select || !existing_pr_list.length ? null : (
|
|
390
398
|
<React.Fragment>
|
|
391
399
|
<FormatText
|
|
392
400
|
wrapper={<Ink.Text color={colors.gray} />}
|
|
@@ -460,6 +468,8 @@ export function SelectCommitRanges() {
|
|
|
460
468
|
</React.Fragment>
|
|
461
469
|
)}
|
|
462
470
|
|
|
471
|
+
{is_input_mode ? null : <React.Fragment></React.Fragment>}
|
|
472
|
+
|
|
463
473
|
<Ink.Box height={1} />
|
|
464
474
|
|
|
465
475
|
<MultiSelect
|
|
@@ -489,143 +499,139 @@ export function SelectCommitRanges() {
|
|
|
489
499
|
}}
|
|
490
500
|
/>
|
|
491
501
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
{has_unassigned_commits ? (
|
|
502
|
+
{is_input_mode ? null : (
|
|
495
503
|
<React.Fragment>
|
|
504
|
+
<Ink.Box height={1} />
|
|
505
|
+
|
|
506
|
+
{has_unassigned_commits ? (
|
|
507
|
+
<React.Fragment>
|
|
508
|
+
<FormatText
|
|
509
|
+
wrapper={<Ink.Text color={colors.gray} />}
|
|
510
|
+
message="{count} unassigned commits"
|
|
511
|
+
values={{
|
|
512
|
+
count: (
|
|
513
|
+
<Ink.Text color={colors.yellow} bold>
|
|
514
|
+
{unassigned_count}
|
|
515
|
+
</Ink.Text>
|
|
516
|
+
),
|
|
517
|
+
}}
|
|
518
|
+
/>
|
|
519
|
+
|
|
520
|
+
<FormatText
|
|
521
|
+
wrapper={<Ink.Text color={colors.gray} />}
|
|
522
|
+
message="Press {c} to {create} a new PR"
|
|
523
|
+
values={{
|
|
524
|
+
c: (
|
|
525
|
+
<Ink.Text bold color={colors.green}>
|
|
526
|
+
c
|
|
527
|
+
</Ink.Text>
|
|
528
|
+
),
|
|
529
|
+
create: (
|
|
530
|
+
<Ink.Text bold color={colors.green}>
|
|
531
|
+
<Parens>c</Parens>reate
|
|
532
|
+
</Ink.Text>
|
|
533
|
+
),
|
|
534
|
+
}}
|
|
535
|
+
/>
|
|
536
|
+
|
|
537
|
+
{existing_pr_list.length === 0 ? null : (
|
|
538
|
+
<FormatText
|
|
539
|
+
wrapper={<Ink.Text color={colors.gray} />}
|
|
540
|
+
message="Press {p} to {pick} an existing PR"
|
|
541
|
+
values={{
|
|
542
|
+
p: (
|
|
543
|
+
<Ink.Text bold color={colors.green}>
|
|
544
|
+
p
|
|
545
|
+
</Ink.Text>
|
|
546
|
+
),
|
|
547
|
+
pick: (
|
|
548
|
+
<Ink.Text bold color={colors.green}>
|
|
549
|
+
<Parens>p</Parens>pick
|
|
550
|
+
</Ink.Text>
|
|
551
|
+
),
|
|
552
|
+
}}
|
|
553
|
+
/>
|
|
554
|
+
)}
|
|
555
|
+
|
|
556
|
+
{sync_status !== "allow_unassigned" ? null : (
|
|
557
|
+
<FormatText
|
|
558
|
+
wrapper={<Ink.Text color={colors.gray} />}
|
|
559
|
+
message={
|
|
560
|
+
argv.sync
|
|
561
|
+
? "Press {s} to {sync} the {count} assigned commits to Github"
|
|
562
|
+
: "Press {s} to {sync} the {count} assigned commits locally"
|
|
563
|
+
}
|
|
564
|
+
values={{
|
|
565
|
+
...S_TO_SYNC_VALUES,
|
|
566
|
+
count: (
|
|
567
|
+
<Ink.Text color={colors.yellow} bold>
|
|
568
|
+
{assigned_count}
|
|
569
|
+
</Ink.Text>
|
|
570
|
+
),
|
|
571
|
+
}}
|
|
572
|
+
/>
|
|
573
|
+
)}
|
|
574
|
+
</React.Fragment>
|
|
575
|
+
) : (
|
|
576
|
+
<FormatText
|
|
577
|
+
wrapper={<Ink.Text color={colors.blue} />}
|
|
578
|
+
message={
|
|
579
|
+
argv.sync
|
|
580
|
+
? "🎉 Done! Press {s} to {sync} the PRs to Github"
|
|
581
|
+
: "🎉 Done! Press {s} to {sync} the PRs locally"
|
|
582
|
+
}
|
|
583
|
+
values={S_TO_SYNC_VALUES}
|
|
584
|
+
/>
|
|
585
|
+
)}
|
|
586
|
+
|
|
496
587
|
<FormatText
|
|
497
588
|
wrapper={<Ink.Text color={colors.gray} />}
|
|
498
|
-
message="{
|
|
589
|
+
message="Press {left} and {right} to view PRs"
|
|
499
590
|
values={{
|
|
500
|
-
|
|
501
|
-
<Ink.Text color={colors.
|
|
502
|
-
{
|
|
591
|
+
left: (
|
|
592
|
+
<Ink.Text bold color={colors.green}>
|
|
593
|
+
{SYMBOL.left}
|
|
594
|
+
</Ink.Text>
|
|
595
|
+
),
|
|
596
|
+
right: (
|
|
597
|
+
<Ink.Text bold color={colors.green}>
|
|
598
|
+
{SYMBOL.right}
|
|
503
599
|
</Ink.Text>
|
|
504
600
|
),
|
|
505
601
|
}}
|
|
506
602
|
/>
|
|
507
603
|
|
|
508
|
-
|
|
509
|
-
<
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
<Ink.Text bold color={colors.green}>
|
|
520
|
-
<Parens>c</Parens>reate
|
|
521
|
-
</Ink.Text>
|
|
522
|
-
),
|
|
523
|
-
}}
|
|
524
|
-
/>
|
|
525
|
-
)}
|
|
526
|
-
|
|
527
|
-
{is_input_mode ? null : (
|
|
528
|
-
<FormatText
|
|
529
|
-
wrapper={<Ink.Text color={colors.gray} />}
|
|
530
|
-
message="Press {p} to {pick} an existing PR"
|
|
531
|
-
values={{
|
|
532
|
-
p: (
|
|
533
|
-
<Ink.Text bold color={colors.green}>
|
|
534
|
-
p
|
|
535
|
-
</Ink.Text>
|
|
536
|
-
),
|
|
537
|
-
pick: (
|
|
538
|
-
<Ink.Text bold color={colors.green}>
|
|
539
|
-
<Parens>p</Parens>pick
|
|
540
|
-
</Ink.Text>
|
|
541
|
-
),
|
|
542
|
-
}}
|
|
543
|
-
/>
|
|
544
|
-
)}
|
|
604
|
+
<FormatText
|
|
605
|
+
wrapper={<Ink.Text color={colors.gray} />}
|
|
606
|
+
message="Press {enter} to toggle commit selection"
|
|
607
|
+
values={{
|
|
608
|
+
enter: (
|
|
609
|
+
<Ink.Text bold color={colors.green}>
|
|
610
|
+
{SYMBOL.enter}
|
|
611
|
+
</Ink.Text>
|
|
612
|
+
),
|
|
613
|
+
}}
|
|
614
|
+
/>
|
|
545
615
|
|
|
546
|
-
{
|
|
616
|
+
{group.id === commit_range.UNASSIGNED ? null : (
|
|
547
617
|
<FormatText
|
|
548
618
|
wrapper={<Ink.Text color={colors.gray} />}
|
|
549
619
|
message={
|
|
550
|
-
|
|
551
|
-
? "Press {
|
|
552
|
-
: "Press {
|
|
620
|
+
is_master_base
|
|
621
|
+
? "Press {m} to {reset} current PR base to stack position"
|
|
622
|
+
: "Press {m} to set current PR base to master"
|
|
553
623
|
}
|
|
554
624
|
values={{
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
{assigned_count}
|
|
625
|
+
m: (
|
|
626
|
+
<Ink.Text bold color={colors.green}>
|
|
627
|
+
{SYMBOL.m}
|
|
559
628
|
</Ink.Text>
|
|
560
629
|
),
|
|
630
|
+
reset: <Ink.Text color={colors.yellow}>reset</Ink.Text>,
|
|
561
631
|
}}
|
|
562
632
|
/>
|
|
563
633
|
)}
|
|
564
634
|
</React.Fragment>
|
|
565
|
-
) : (
|
|
566
|
-
<FormatText
|
|
567
|
-
wrapper={<Ink.Text />}
|
|
568
|
-
message={
|
|
569
|
-
argv.sync
|
|
570
|
-
? "🎉 Done! Press {s} to {sync} the PRs to Github"
|
|
571
|
-
: "🎉 Done! Press {s} to {sync} the PRs locally"
|
|
572
|
-
}
|
|
573
|
-
values={S_TO_SYNC_VALUES}
|
|
574
|
-
/>
|
|
575
|
-
)}
|
|
576
|
-
|
|
577
|
-
<Ink.Box>
|
|
578
|
-
<FormatText
|
|
579
|
-
wrapper={<Ink.Text color={colors.gray} />}
|
|
580
|
-
message="Press {left} and {right} to view PRs"
|
|
581
|
-
values={{
|
|
582
|
-
left: (
|
|
583
|
-
<Ink.Text bold color={colors.green}>
|
|
584
|
-
{SYMBOL.left}
|
|
585
|
-
</Ink.Text>
|
|
586
|
-
),
|
|
587
|
-
right: (
|
|
588
|
-
<Ink.Text bold color={colors.green}>
|
|
589
|
-
{SYMBOL.right}
|
|
590
|
-
</Ink.Text>
|
|
591
|
-
),
|
|
592
|
-
}}
|
|
593
|
-
/>
|
|
594
|
-
</Ink.Box>
|
|
595
|
-
|
|
596
|
-
<Ink.Box>
|
|
597
|
-
<FormatText
|
|
598
|
-
wrapper={<Ink.Text color={colors.gray} />}
|
|
599
|
-
message="Press {enter} to toggle commit selection"
|
|
600
|
-
values={{
|
|
601
|
-
enter: (
|
|
602
|
-
<Ink.Text bold color={colors.green}>
|
|
603
|
-
{SYMBOL.enter}
|
|
604
|
-
</Ink.Text>
|
|
605
|
-
),
|
|
606
|
-
}}
|
|
607
|
-
/>
|
|
608
|
-
</Ink.Box>
|
|
609
|
-
|
|
610
|
-
{group.id === commit_range.UNASSIGNED ? null : (
|
|
611
|
-
<Ink.Box>
|
|
612
|
-
<FormatText
|
|
613
|
-
wrapper={<Ink.Text color={colors.gray} />}
|
|
614
|
-
message={
|
|
615
|
-
is_master_base
|
|
616
|
-
? "Press {m} to {reset} current PR base to stack position"
|
|
617
|
-
: "Press {m} to set current PR base to master"
|
|
618
|
-
}
|
|
619
|
-
values={{
|
|
620
|
-
m: (
|
|
621
|
-
<Ink.Text bold color={colors.green}>
|
|
622
|
-
{SYMBOL.m}
|
|
623
|
-
</Ink.Text>
|
|
624
|
-
),
|
|
625
|
-
reset: <Ink.Text color={colors.yellow}>reset</Ink.Text>,
|
|
626
|
-
}}
|
|
627
|
-
/>
|
|
628
|
-
</Ink.Box>
|
|
629
635
|
)}
|
|
630
636
|
</Ink.Box>
|
|
631
637
|
);
|
package/src/commands/Rebase.tsx
CHANGED
|
@@ -184,6 +184,7 @@ Rebase.run = async function run(props: Props) {
|
|
|
184
184
|
// always hard reset and clean to allow subsequent checkout
|
|
185
185
|
// if there are files checkout will fail and cascade fail subsequent commands
|
|
186
186
|
cli.sync(`git reset --hard`, spawn_options);
|
|
187
|
+
cli.sync(`git cherry-pick --abort`, spawn_options);
|
|
187
188
|
cli.sync(`git clean -fd`, spawn_options);
|
|
188
189
|
|
|
189
190
|
// always put self back in original branch
|
|
@@ -260,14 +260,21 @@ export async function range(commit_group_map?: CommitGroupMap) {
|
|
|
260
260
|
const all_commits: Array<git.Commit> = [];
|
|
261
261
|
const previous_groups = group_value_list.slice(0, i);
|
|
262
262
|
for (const g of previous_groups) {
|
|
263
|
+
actions.debug(` BOUNDARY_COMMIT group=${g.title}`);
|
|
264
|
+
|
|
263
265
|
for (const c of g.commits) {
|
|
266
|
+
actions.debug(` BOUNDARY_COMMIT commit=${c.subject_line}`);
|
|
264
267
|
all_commits.push(c);
|
|
265
268
|
}
|
|
266
269
|
}
|
|
267
270
|
for (const c of group.commits) {
|
|
271
|
+
actions.debug(` BOUNDARY_COMMIT commit=${c.subject_line}`);
|
|
268
272
|
all_commits.push(c);
|
|
269
273
|
}
|
|
270
274
|
|
|
275
|
+
actions.debug(` BOUNDARY_COMMIT group.pr.commits.length=${group.pr.commits.length}`);
|
|
276
|
+
actions.debug(` BOUNDARY_COMMIT all_commits=${all_commits.length}`);
|
|
277
|
+
|
|
271
278
|
// compare all commits against pr commits
|
|
272
279
|
if (group.pr.commits.length !== all_commits.length) {
|
|
273
280
|
actions.debug(" BOUNDARY_COMMIT_LENGTH_MISMATCH");
|