git-stack-cli 2.6.0 → 2.7.0
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 +25 -6
- package/dist/js/index.js +639 -528
- package/package.json +1 -1
- package/scripts/bun-build.ts +5 -0
- package/src/app/App.tsx +11 -5
- package/src/app/AutoUpdate.tsx +72 -54
- package/src/app/GatherMetadata.tsx +2 -24
- package/src/app/Main.tsx +0 -4
- package/src/app/MultiSelect.tsx +1 -8
- package/src/app/RequireBranch.tsx +67 -0
- package/src/app/SelectCommitRanges.tsx +9 -17
- package/src/app/Status.tsx +1 -5
- package/src/app/Store.tsx +2 -1
- package/src/command.ts +68 -50
- package/src/commands/Config.tsx +106 -0
- package/src/commands/Rebase.tsx +50 -36
- package/src/components/ColorTest.tsx +49 -0
- package/src/core/cli.ts +2 -0
- package/src/core/colors.ts +4 -2
- package/src/index.tsx +2 -2
- package/src/types/global.d.ts +1 -1
- package/src/app/PreSelectCommitRanges.tsx +0 -29
- package/src/core/gs_short_id.ts +0 -5
package/package.json
CHANGED
package/scripts/bun-build.ts
CHANGED
package/src/app/App.tsx
CHANGED
|
@@ -14,8 +14,10 @@ import { Main } from "~/app/Main";
|
|
|
14
14
|
import { Output } from "~/app/Output";
|
|
15
15
|
import { Providers } from "~/app/Providers";
|
|
16
16
|
import { RebaseCheck } from "~/app/RebaseCheck";
|
|
17
|
+
import { RequireBranch } from "~/app/RequireBranch";
|
|
17
18
|
import { Store } from "~/app/Store";
|
|
18
19
|
import { VerboseDebugInfo } from "~/app/VerboseDebugInfo";
|
|
20
|
+
import { Config } from "~/commands/Config";
|
|
19
21
|
import { Fixup } from "~/commands/Fixup";
|
|
20
22
|
import { Log } from "~/commands/Log";
|
|
21
23
|
import { Rebase } from "~/commands/Rebase";
|
|
@@ -91,6 +93,8 @@ function MaybeMain() {
|
|
|
91
93
|
return <Log />;
|
|
92
94
|
} else if (positional_list.has("update")) {
|
|
93
95
|
return <Update />;
|
|
96
|
+
} else if (positional_list.has("config")) {
|
|
97
|
+
return <Config />;
|
|
94
98
|
} else if (positional_list.has("rebase")) {
|
|
95
99
|
return (
|
|
96
100
|
<DependencyCheck>
|
|
@@ -112,11 +116,13 @@ function MaybeMain() {
|
|
|
112
116
|
<DependencyCheck>
|
|
113
117
|
<DirtyCheck>
|
|
114
118
|
<GatherMetadata>
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
<RequireBranch>
|
|
120
|
+
<LocalCommitStatus>
|
|
121
|
+
<DetectInitialPR>
|
|
122
|
+
<Main />
|
|
123
|
+
</DetectInitialPR>
|
|
124
|
+
</LocalCommitStatus>
|
|
125
|
+
</RequireBranch>
|
|
120
126
|
</GatherMetadata>
|
|
121
127
|
</DirtyCheck>
|
|
122
128
|
</DependencyCheck>
|
package/src/app/AutoUpdate.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { Brackets } from "~/app/Brackets";
|
|
|
6
6
|
import { Command } from "~/app/Command";
|
|
7
7
|
import { FormatText } from "~/app/FormatText";
|
|
8
8
|
import { YesNoPrompt } from "~/app/YesNoPrompt";
|
|
9
|
+
import { assertNever } from "~/core/assertNever";
|
|
9
10
|
import { cli } from "~/core/cli";
|
|
10
11
|
import { colors } from "~/core/colors";
|
|
11
12
|
import { fetch_json } from "~/core/fetch_json";
|
|
@@ -28,7 +29,7 @@ type State = {
|
|
|
28
29
|
error: null | Error;
|
|
29
30
|
local_version: null | string;
|
|
30
31
|
latest_version: null | string;
|
|
31
|
-
status: "init" | "prompt" | "install" | "done"
|
|
32
|
+
status: "init" | "prompt" | "install" | "done";
|
|
32
33
|
is_brew_bun_standalone: boolean;
|
|
33
34
|
};
|
|
34
35
|
|
|
@@ -61,7 +62,24 @@ export function AutoUpdate(props: Props) {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
React.useEffect(() => {
|
|
64
|
-
|
|
65
|
+
switch (state.status) {
|
|
66
|
+
case "init":
|
|
67
|
+
case "prompt":
|
|
68
|
+
case "install":
|
|
69
|
+
break;
|
|
70
|
+
|
|
71
|
+
case "done": {
|
|
72
|
+
props.onDone?.();
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
default:
|
|
77
|
+
assertNever(state.status);
|
|
78
|
+
}
|
|
79
|
+
}, [state.status]);
|
|
80
|
+
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
let status: State["status"] = "init";
|
|
65
83
|
let latest_version: string | null = null;
|
|
66
84
|
let is_brew_bun_standalone = false;
|
|
67
85
|
|
|
@@ -73,17 +91,13 @@ export function AutoUpdate(props: Props) {
|
|
|
73
91
|
throw new Error("Auto update requires process.env.CLI_VERSION to be set");
|
|
74
92
|
}
|
|
75
93
|
|
|
76
|
-
if (is_output) {
|
|
77
|
-
handle_output(<Ink.Text key="init">Checking for latest version...</Ink.Text>);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
94
|
const timeout_ms = is_finite_value(props.timeoutMs) ? props.timeoutMs : 2 * 1000;
|
|
81
95
|
|
|
82
96
|
const npm_json = await Promise.race([
|
|
83
97
|
fetch_json(`https://registry.npmjs.org/${props.name}`),
|
|
84
98
|
|
|
85
99
|
sleep(timeout_ms).then(() => {
|
|
86
|
-
throw new Error("
|
|
100
|
+
throw new Error("AutoUpdate timeout");
|
|
87
101
|
}),
|
|
88
102
|
]);
|
|
89
103
|
|
|
@@ -126,8 +140,13 @@ export function AutoUpdate(props: Props) {
|
|
|
126
140
|
}
|
|
127
141
|
|
|
128
142
|
const semver_result = semver_compare(latest_version, local_version);
|
|
143
|
+
if (props_ref.current.verbose) {
|
|
144
|
+
handle_output(<Ink.Text dimColor>{JSON.stringify({ semver_result })}</Ink.Text>);
|
|
145
|
+
}
|
|
129
146
|
|
|
130
147
|
if (semver_result === 0) {
|
|
148
|
+
status = "done";
|
|
149
|
+
|
|
131
150
|
if (is_output) {
|
|
132
151
|
handle_output(
|
|
133
152
|
<Ink.Text>
|
|
@@ -138,15 +157,12 @@ export function AutoUpdate(props: Props) {
|
|
|
138
157
|
return;
|
|
139
158
|
}
|
|
140
159
|
|
|
141
|
-
if (semver_result ===
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
`latest version < local_version, skipping auto update [${latest_version} < ${local_version}]`,
|
|
145
|
-
);
|
|
160
|
+
if (semver_result === 1) {
|
|
161
|
+
// trigger yes no prompt
|
|
162
|
+
status = "prompt";
|
|
146
163
|
}
|
|
147
164
|
|
|
148
|
-
|
|
149
|
-
status = "prompt";
|
|
165
|
+
throw new Error("AutoUpdate failed");
|
|
150
166
|
}
|
|
151
167
|
|
|
152
168
|
const onError = props_ref.current.onError || (() => {});
|
|
@@ -156,9 +172,6 @@ export function AutoUpdate(props: Props) {
|
|
|
156
172
|
patch({ status, local_version, latest_version, is_brew_bun_standalone });
|
|
157
173
|
})
|
|
158
174
|
.catch((error) => {
|
|
159
|
-
patch({ status, error, local_version, latest_version, is_brew_bun_standalone });
|
|
160
|
-
onError(error);
|
|
161
|
-
|
|
162
175
|
if (props_ref.current.verbose) {
|
|
163
176
|
handle_output(
|
|
164
177
|
<Ink.Text key="error" color={colors.red}>
|
|
@@ -166,9 +179,11 @@ export function AutoUpdate(props: Props) {
|
|
|
166
179
|
</Ink.Text>,
|
|
167
180
|
);
|
|
168
181
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
182
|
+
|
|
183
|
+
// ensure we always exit
|
|
184
|
+
status = "done";
|
|
185
|
+
patch({ status, error, local_version, latest_version, is_brew_bun_standalone });
|
|
186
|
+
onError(error);
|
|
172
187
|
});
|
|
173
188
|
}, []);
|
|
174
189
|
|
|
@@ -180,54 +195,60 @@ export function AutoUpdate(props: Props) {
|
|
|
180
195
|
case "prompt": {
|
|
181
196
|
let install_command = "";
|
|
182
197
|
if (state.is_brew_bun_standalone) {
|
|
183
|
-
install_command =
|
|
198
|
+
install_command = "brew install magus/git-stack/git-stack";
|
|
184
199
|
} else {
|
|
185
|
-
install_command =
|
|
200
|
+
install_command = `npm install -g ${props.name}@latest`;
|
|
186
201
|
}
|
|
187
202
|
|
|
188
203
|
return (
|
|
189
204
|
<YesNoPrompt
|
|
190
205
|
message={
|
|
191
206
|
<Ink.Box flexDirection="column">
|
|
192
|
-
<Ink.
|
|
207
|
+
<Ink.Box flexDirection="column">
|
|
208
|
+
<Ink.Text color={colors.yellow}>
|
|
209
|
+
<FormatText
|
|
210
|
+
wrapper={<Ink.Text />}
|
|
211
|
+
message="New version available {latest_version}"
|
|
212
|
+
values={{
|
|
213
|
+
latest_version: <Brackets>{state.latest_version}</Brackets>,
|
|
214
|
+
}}
|
|
215
|
+
/>
|
|
216
|
+
,
|
|
217
|
+
</Ink.Text>
|
|
218
|
+
<Ink.Text> </Ink.Text>
|
|
219
|
+
<Command>{install_command}</Command>
|
|
220
|
+
<Ink.Text> </Ink.Text>
|
|
221
|
+
</Ink.Box>
|
|
222
|
+
<Ink.Box>
|
|
193
223
|
<FormatText
|
|
194
|
-
wrapper={<Ink.Text />}
|
|
195
|
-
message="
|
|
196
|
-
values={{
|
|
197
|
-
latest_version: <Brackets>{state.latest_version}</Brackets>,
|
|
198
|
-
}}
|
|
224
|
+
wrapper={<Ink.Text color={colors.yellow} />}
|
|
225
|
+
message="Would you like to run the above command to update?"
|
|
199
226
|
/>
|
|
200
|
-
|
|
201
|
-
</Ink.Text>
|
|
202
|
-
<Ink.Text> </Ink.Text>
|
|
203
|
-
<Command>{install_command}</Command>
|
|
204
|
-
<Ink.Text> </Ink.Text>
|
|
205
|
-
<FormatText
|
|
206
|
-
wrapper={<Ink.Text color={colors.yellow} />}
|
|
207
|
-
message="Would you like to run the above command to update?"
|
|
208
|
-
/>
|
|
227
|
+
</Ink.Box>
|
|
209
228
|
</Ink.Box>
|
|
210
229
|
}
|
|
211
230
|
onYes={async () => {
|
|
212
|
-
handle_output(
|
|
213
|
-
<FormatText
|
|
214
|
-
key="install"
|
|
215
|
-
wrapper={<Ink.Text />}
|
|
216
|
-
message="Installing {name}@{version}..."
|
|
217
|
-
values={{
|
|
218
|
-
name: <Ink.Text color={colors.yellow}>{props.name}</Ink.Text>,
|
|
219
|
-
version: <Ink.Text color={colors.blue}>{state.latest_version}</Ink.Text>,
|
|
220
|
-
}}
|
|
221
|
-
/>,
|
|
222
|
-
);
|
|
231
|
+
handle_output(<Command>{install_command}</Command>);
|
|
223
232
|
|
|
224
233
|
patch({ status: "install" });
|
|
225
234
|
|
|
226
|
-
await cli(install_command
|
|
235
|
+
await cli(install_command, {
|
|
236
|
+
env: {
|
|
237
|
+
...process.env,
|
|
238
|
+
HOMEBREW_COLOR: "1",
|
|
239
|
+
},
|
|
240
|
+
onOutput: (data: string) => {
|
|
241
|
+
handle_output(<Ink.Text>{data}</Ink.Text>);
|
|
242
|
+
},
|
|
243
|
+
});
|
|
227
244
|
|
|
228
|
-
|
|
245
|
+
handle_output(
|
|
246
|
+
<Ink.Text key="done">
|
|
247
|
+
✅ Installed <Brackets>{state.latest_version}</Brackets>
|
|
248
|
+
</Ink.Text>,
|
|
249
|
+
);
|
|
229
250
|
|
|
230
|
-
|
|
251
|
+
patch({ status: "done" });
|
|
231
252
|
}}
|
|
232
253
|
onNo={() => {
|
|
233
254
|
patch({ status: "done" });
|
|
@@ -239,9 +260,6 @@ export function AutoUpdate(props: Props) {
|
|
|
239
260
|
case "install":
|
|
240
261
|
return null;
|
|
241
262
|
|
|
242
|
-
case "exit":
|
|
243
|
-
return null;
|
|
244
|
-
|
|
245
263
|
case "done":
|
|
246
264
|
return props.children;
|
|
247
265
|
}
|
|
@@ -67,33 +67,10 @@ async function run() {
|
|
|
67
67
|
|
|
68
68
|
actions.debug(`master_branch = ${master_branch}`);
|
|
69
69
|
|
|
70
|
-
const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
|
|
71
|
-
|
|
72
|
-
// handle detahed head state
|
|
73
|
-
if (branch_name === "HEAD") {
|
|
74
|
-
actions.error("Must run within a branch.");
|
|
75
|
-
actions.exit(0);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// handle when there are no detected changes
|
|
80
|
-
if (`origin/${branch_name}` === master_branch) {
|
|
81
|
-
actions.error("Must run within a branch.");
|
|
82
|
-
actions.exit(0);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
70
|
const head = (await cli("git rev-parse HEAD")).stdout;
|
|
71
|
+
const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
|
|
87
72
|
const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
|
|
88
73
|
|
|
89
|
-
// handle when there are no detected changes
|
|
90
|
-
if (head === merge_base) {
|
|
91
|
-
actions.newline();
|
|
92
|
-
actions.output(<Ink.Text color={colors.gray}>No changes detected.</Ink.Text>);
|
|
93
|
-
actions.exit(0);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
74
|
// git@github.com:magus/git-multi-diff-playground.git
|
|
98
75
|
// https://github.com/magus/git-multi-diff-playground.git
|
|
99
76
|
const origin_url = (await cli(`git config --get remote.origin.url`)).stdout;
|
|
@@ -107,6 +84,7 @@ async function run() {
|
|
|
107
84
|
state.master_branch = master_branch;
|
|
108
85
|
state.head = head;
|
|
109
86
|
state.branch_name = branch_name;
|
|
87
|
+
state.merge_base = merge_base;
|
|
110
88
|
});
|
|
111
89
|
} catch (err) {
|
|
112
90
|
actions.error("Unable to gather git metadata.");
|
package/src/app/Main.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { ManualRebase } from "~/app/ManualRebase";
|
|
|
6
6
|
import { PostRebaseStatus } from "~/app/PostRebaseStatus";
|
|
7
7
|
import { PreLocalMergeRebase } from "~/app/PreLocalMergeRebase";
|
|
8
8
|
import { PreManualRebase } from "~/app/PreManualRebase";
|
|
9
|
-
import { PreSelectCommitRanges } from "~/app/PreSelectCommitRanges";
|
|
10
9
|
import { SelectCommitRanges } from "~/app/SelectCommitRanges";
|
|
11
10
|
import { Status } from "~/app/Status";
|
|
12
11
|
import { Store } from "~/app/Store";
|
|
@@ -32,9 +31,6 @@ export function Main() {
|
|
|
32
31
|
case "pre-local-merge-rebase":
|
|
33
32
|
return <PreLocalMergeRebase />;
|
|
34
33
|
|
|
35
|
-
case "pre-select-commit-ranges":
|
|
36
|
-
return <PreSelectCommitRanges />;
|
|
37
|
-
|
|
38
34
|
case "select-commit-ranges":
|
|
39
35
|
return <SelectCommitRanges />;
|
|
40
36
|
|
package/src/app/MultiSelect.tsx
CHANGED
|
@@ -191,7 +191,6 @@ type ItemRowProps = {
|
|
|
191
191
|
|
|
192
192
|
function ItemRow(props: ItemRowProps) {
|
|
193
193
|
let color;
|
|
194
|
-
let bold;
|
|
195
194
|
let underline;
|
|
196
195
|
let dimColor;
|
|
197
196
|
|
|
@@ -200,14 +199,8 @@ function ItemRow(props: ItemRowProps) {
|
|
|
200
199
|
underline = true;
|
|
201
200
|
}
|
|
202
201
|
|
|
203
|
-
if (props.selected) {
|
|
204
|
-
// color = "";
|
|
205
|
-
bold = true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
202
|
if (props.disabled) {
|
|
209
203
|
color = "";
|
|
210
|
-
bold = false;
|
|
211
204
|
underline = false;
|
|
212
205
|
dimColor = true;
|
|
213
206
|
}
|
|
@@ -218,7 +211,7 @@ function ItemRow(props: ItemRowProps) {
|
|
|
218
211
|
|
|
219
212
|
<Ink.Box width={props.maxWidth}>
|
|
220
213
|
<Ink.Text
|
|
221
|
-
|
|
214
|
+
// force line break
|
|
222
215
|
underline={underline}
|
|
223
216
|
color={color}
|
|
224
217
|
dimColor={dimColor}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import * as Ink from "ink-cjs";
|
|
4
|
+
|
|
5
|
+
import { Await } from "~/app/Await";
|
|
6
|
+
import { Store } from "~/app/Store";
|
|
7
|
+
import { colors } from "~/core/colors";
|
|
8
|
+
import { invariant } from "~/core/invariant";
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function RequireBranch(props: Props) {
|
|
15
|
+
const fallback = <Ink.Text color={colors.yellow}>Gathering local git information…</Ink.Text>;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Await fallback={fallback} function={run}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</Await>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function run() {
|
|
25
|
+
const state = Store.getState();
|
|
26
|
+
const actions = Store.getState().actions;
|
|
27
|
+
const master_branch = state.master_branch;
|
|
28
|
+
const head = state.head;
|
|
29
|
+
const branch_name = state.branch_name;
|
|
30
|
+
const merge_base = state.merge_base;
|
|
31
|
+
|
|
32
|
+
invariant(head, "head must exist");
|
|
33
|
+
invariant(branch_name, "branch_name must exist");
|
|
34
|
+
invariant(merge_base, "merge_base must exist");
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// handle detahed head state
|
|
38
|
+
if (branch_name === "HEAD") {
|
|
39
|
+
actions.error("Must run within a branch.");
|
|
40
|
+
actions.exit(0);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// handle when there are no detected changes
|
|
45
|
+
if (`origin/${branch_name}` === master_branch) {
|
|
46
|
+
actions.error("Must run within a branch.");
|
|
47
|
+
actions.exit(0);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// handle when there are no detected changes
|
|
52
|
+
if (head === merge_base) {
|
|
53
|
+
actions.newline();
|
|
54
|
+
actions.output(<Ink.Text color={colors.gray}>No changes detected.</Ink.Text>);
|
|
55
|
+
actions.exit(0);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
actions.error("Unable to detect branch changes.");
|
|
60
|
+
|
|
61
|
+
if (err instanceof Error) {
|
|
62
|
+
actions.error(err.message);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
actions.exit(17);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -10,8 +10,8 @@ import { Parens } from "~/app/Parens";
|
|
|
10
10
|
import { Store } from "~/app/Store";
|
|
11
11
|
import { TextInput } from "~/app/TextInput";
|
|
12
12
|
import { colors } from "~/core/colors";
|
|
13
|
-
import { gs_short_id } from "~/core/gs_short_id";
|
|
14
13
|
import { invariant } from "~/core/invariant";
|
|
14
|
+
import { short_id } from "~/core/short_id";
|
|
15
15
|
import { wrap_index } from "~/core/wrap_index";
|
|
16
16
|
|
|
17
17
|
import type { State } from "~/app/Store";
|
|
@@ -35,6 +35,8 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
35
35
|
const actions = Store.useActions();
|
|
36
36
|
|
|
37
37
|
const argv = Store.useState((state) => state.argv);
|
|
38
|
+
const branch_name = Store.useState((state) => state.branch_name);
|
|
39
|
+
invariant(branch_name, "branch_name must exist");
|
|
38
40
|
|
|
39
41
|
const [selected_group_id, set_selected_group_id] = React.useState(() => {
|
|
40
42
|
const first_group = props.commit_range.group_list.find(
|
|
@@ -232,7 +234,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
232
234
|
</Ink.Text>
|
|
233
235
|
<Ink.Text color={colors.blue}>
|
|
234
236
|
<FormatText
|
|
235
|
-
message="Press {c} to {create} a new PR
|
|
237
|
+
message="Press {c} to {create} a new PR"
|
|
236
238
|
values={{
|
|
237
239
|
c: (
|
|
238
240
|
<Ink.Text bold color={colors.green}>
|
|
@@ -271,7 +273,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
271
273
|
</Ink.Box>
|
|
272
274
|
|
|
273
275
|
<Ink.Box width={max_width}>
|
|
274
|
-
<Ink.Text wrap="truncate-end" bold color={colors.
|
|
276
|
+
<Ink.Text wrap="truncate-end" bold color={colors.white}>
|
|
275
277
|
{group.title}
|
|
276
278
|
</Ink.Text>
|
|
277
279
|
</Ink.Box>
|
|
@@ -359,7 +361,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
359
361
|
{group_input ? null : (
|
|
360
362
|
<FormatText
|
|
361
363
|
wrapper={<Ink.Text color={colors.gray} />}
|
|
362
|
-
message="Press {c} to {create} a new PR
|
|
364
|
+
message="Press {c} to {create} a new PR"
|
|
363
365
|
values={{
|
|
364
366
|
c: (
|
|
365
367
|
<Ink.Text bold color={colors.green}>
|
|
@@ -411,7 +413,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
411
413
|
<Ink.Box>
|
|
412
414
|
<FormatText
|
|
413
415
|
wrapper={<Ink.Text color={colors.gray} />}
|
|
414
|
-
message="Press {left} and {right} to view
|
|
416
|
+
message="Press {left} and {right} to view PRs"
|
|
415
417
|
values={{
|
|
416
418
|
left: (
|
|
417
419
|
<Ink.Text bold color={colors.green}>
|
|
@@ -444,17 +446,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
444
446
|
);
|
|
445
447
|
|
|
446
448
|
function get_group_id() {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
// branch prefix via cli flag or env var
|
|
450
|
-
// cli flag takes precedence since it is more explicit
|
|
451
|
-
if (argv["branch-prefix"]) {
|
|
452
|
-
branch_prefix = argv["branch-prefix"];
|
|
453
|
-
} else if (process.env.GIT_STACK_BRANCH_PREFIX) {
|
|
454
|
-
branch_prefix = process.env.GIT_STACK_BRANCH_PREFIX;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
return `${branch_prefix}${gs_short_id()}`;
|
|
449
|
+
return `${branch_name}-${short_id()}`;
|
|
458
450
|
}
|
|
459
451
|
|
|
460
452
|
function submit_group_input(title: string) {
|
|
@@ -463,7 +455,7 @@ function SelectCommitRangesInternal(props: Props) {
|
|
|
463
455
|
actions.output(
|
|
464
456
|
<FormatText
|
|
465
457
|
wrapper={<Ink.Text dimColor />}
|
|
466
|
-
message="Created new PR
|
|
458
|
+
message="Created new PR {group} {note}"
|
|
467
459
|
values={{
|
|
468
460
|
group: <Brackets>{title}</Brackets>,
|
|
469
461
|
note: <Parens>{id}</Parens>,
|
package/src/app/Status.tsx
CHANGED
|
@@ -42,11 +42,7 @@ async function run() {
|
|
|
42
42
|
Store.setState((state) => {
|
|
43
43
|
state.step = "pre-local-merge-rebase";
|
|
44
44
|
});
|
|
45
|
-
} else if (needs_update) {
|
|
46
|
-
Store.setState((state) => {
|
|
47
|
-
state.step = "pre-select-commit-ranges";
|
|
48
|
-
});
|
|
49
|
-
} else if (argv.force) {
|
|
45
|
+
} else if (needs_update || argv.force) {
|
|
50
46
|
Store.setState((state) => {
|
|
51
47
|
state.step = "select-commit-ranges";
|
|
52
48
|
});
|
package/src/app/Store.tsx
CHANGED
|
@@ -51,6 +51,7 @@ export type State = {
|
|
|
51
51
|
master_branch: string;
|
|
52
52
|
head: null | string;
|
|
53
53
|
branch_name: null | string;
|
|
54
|
+
merge_base: null | string;
|
|
54
55
|
commit_range: null | CommitMetadata.CommitRange;
|
|
55
56
|
commit_map: null | CommitMap;
|
|
56
57
|
pr_templates: Array<string>;
|
|
@@ -66,7 +67,6 @@ export type State = {
|
|
|
66
67
|
| "status"
|
|
67
68
|
| "pre-local-merge-rebase"
|
|
68
69
|
| "local-merge-rebase"
|
|
69
|
-
| "pre-select-commit-ranges"
|
|
70
70
|
| "select-commit-ranges"
|
|
71
71
|
| "pre-manual-rebase"
|
|
72
72
|
| "manual-rebase"
|
|
@@ -122,6 +122,7 @@ const BaseStore = createStore<State>()(
|
|
|
122
122
|
master_branch: "origin/master",
|
|
123
123
|
head: null,
|
|
124
124
|
branch_name: null,
|
|
125
|
+
merge_base: null,
|
|
125
126
|
commit_range: null,
|
|
126
127
|
commit_map: null,
|
|
127
128
|
pr_templates: [],
|