git-stack-cli 2.3.0 → 2.3.2
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 +50 -37
- package/package.json +1 -1
- package/src/app/Exit.tsx +28 -28
- package/src/app/LocalMergeRebase.tsx +12 -1
- package/src/commands/Rebase.tsx +13 -6
- package/src/components/ErrorBoundary.tsx +4 -1
package/dist/js/index.js
CHANGED
|
@@ -32698,34 +32698,34 @@ async function sleep(time) {
|
|
|
32698
32698
|
// src/app/Exit.tsx
|
|
32699
32699
|
function Exit(props) {
|
|
32700
32700
|
React14.useEffect(() => {
|
|
32701
|
-
handle_exit().catch((err) => {
|
|
32701
|
+
Exit.handle_exit(props).catch((err) => {
|
|
32702
32702
|
console.error(err);
|
|
32703
32703
|
});
|
|
32704
|
-
async function handle_exit() {
|
|
32705
|
-
const state = Store.getState();
|
|
32706
|
-
const actions = state.actions;
|
|
32707
|
-
actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
|
|
32708
|
-
let exit_code = props.code;
|
|
32709
|
-
if (state.abort_handler) {
|
|
32710
|
-
exit_code = await state.abort_handler();
|
|
32711
|
-
}
|
|
32712
|
-
if (state.is_dirty_check_stash) {
|
|
32713
|
-
await cli("git stash pop");
|
|
32714
|
-
actions.output(/* @__PURE__ */ React14.createElement(Text, {
|
|
32715
|
-
color: colors.green
|
|
32716
|
-
}, "✅ Changes restored from stash"));
|
|
32717
|
-
}
|
|
32718
|
-
await sleep(1);
|
|
32719
|
-
if (props.clear) {
|
|
32720
|
-
actions.clear();
|
|
32721
|
-
}
|
|
32722
|
-
actions.unmount();
|
|
32723
|
-
process.exitCode = exit_code;
|
|
32724
|
-
process.exit();
|
|
32725
|
-
}
|
|
32726
32704
|
}, [props.clear, props.code]);
|
|
32727
32705
|
return null;
|
|
32728
32706
|
}
|
|
32707
|
+
Exit.handle_exit = async function handle_exit(props) {
|
|
32708
|
+
const state = Store.getState();
|
|
32709
|
+
const actions = state.actions;
|
|
32710
|
+
actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
|
|
32711
|
+
let exit_code = props.code;
|
|
32712
|
+
if (state.abort_handler) {
|
|
32713
|
+
exit_code = await state.abort_handler();
|
|
32714
|
+
}
|
|
32715
|
+
if (state.is_dirty_check_stash) {
|
|
32716
|
+
await cli("git stash pop");
|
|
32717
|
+
actions.output(/* @__PURE__ */ React14.createElement(Text, {
|
|
32718
|
+
color: colors.green
|
|
32719
|
+
}, "✅ Changes restored from stash"));
|
|
32720
|
+
}
|
|
32721
|
+
await sleep(1);
|
|
32722
|
+
if (props.clear) {
|
|
32723
|
+
actions.clear();
|
|
32724
|
+
}
|
|
32725
|
+
actions.unmount();
|
|
32726
|
+
process.exitCode = exit_code;
|
|
32727
|
+
process.exit();
|
|
32728
|
+
};
|
|
32729
32729
|
|
|
32730
32730
|
// src/app/LogTimestamp.tsx
|
|
32731
32731
|
var React15 = __toESM(require_react(), 1);
|
|
@@ -39193,15 +39193,15 @@ function encode(value) {
|
|
|
39193
39193
|
}
|
|
39194
39194
|
|
|
39195
39195
|
// src/commands/Rebase.tsx
|
|
39196
|
-
function Rebase() {
|
|
39196
|
+
function Rebase(props) {
|
|
39197
39197
|
return /* @__PURE__ */ React34.createElement(Await, {
|
|
39198
39198
|
fallback: /* @__PURE__ */ React34.createElement(Text, {
|
|
39199
39199
|
color: colors.yellow
|
|
39200
39200
|
}, "Rebasing commits…"),
|
|
39201
|
-
function: Rebase.run
|
|
39201
|
+
function: () => Rebase.run(props)
|
|
39202
39202
|
});
|
|
39203
39203
|
}
|
|
39204
|
-
Rebase.run = async function run5() {
|
|
39204
|
+
Rebase.run = async function run5(props) {
|
|
39205
39205
|
const state = Store.getState();
|
|
39206
39206
|
const actions = state.actions;
|
|
39207
39207
|
const branch_name = state.branch_name;
|
|
@@ -39216,7 +39216,7 @@ Rebase.run = async function run5() {
|
|
|
39216
39216
|
actions.output(/* @__PURE__ */ React34.createElement(Text, {
|
|
39217
39217
|
color: colors.red
|
|
39218
39218
|
}, "\uD83D\uDEA8 Abort"));
|
|
39219
|
-
|
|
39219
|
+
handle_exit2();
|
|
39220
39220
|
return 19;
|
|
39221
39221
|
});
|
|
39222
39222
|
const temp_branch_name = `${branch_name}_${short_id()}`;
|
|
@@ -39293,8 +39293,12 @@ Rebase.run = async function run5() {
|
|
|
39293
39293
|
actions.set((state2) => {
|
|
39294
39294
|
state2.commit_range = next_commit_range;
|
|
39295
39295
|
});
|
|
39296
|
-
|
|
39297
|
-
|
|
39296
|
+
if (props.onComplete) {
|
|
39297
|
+
props.onComplete();
|
|
39298
|
+
} else {
|
|
39299
|
+
actions.output(/* @__PURE__ */ React34.createElement(Status, null));
|
|
39300
|
+
actions.exit(0);
|
|
39301
|
+
}
|
|
39298
39302
|
function restore_git() {
|
|
39299
39303
|
const spawn_options = { ignoreExitCode: true };
|
|
39300
39304
|
cli.sync(`git reset --hard`, spawn_options);
|
|
@@ -39306,7 +39310,7 @@ Rebase.run = async function run5() {
|
|
|
39306
39310
|
}
|
|
39307
39311
|
cli.sync(`pwd`, spawn_options);
|
|
39308
39312
|
}
|
|
39309
|
-
function
|
|
39313
|
+
function handle_exit2() {
|
|
39310
39314
|
actions.output(/* @__PURE__ */ React34.createElement(Text, {
|
|
39311
39315
|
color: colors.yellow
|
|
39312
39316
|
}, "Restoring ", /* @__PURE__ */ React34.createElement(Brackets, null, branch_name), "…"));
|
|
@@ -39319,7 +39323,14 @@ Rebase.run = async function run5() {
|
|
|
39319
39323
|
|
|
39320
39324
|
// src/app/LocalMergeRebase.tsx
|
|
39321
39325
|
function LocalMergeRebase() {
|
|
39322
|
-
|
|
39326
|
+
const actions = Store.useActions();
|
|
39327
|
+
return /* @__PURE__ */ React35.createElement(Rebase, {
|
|
39328
|
+
onComplete: () => {
|
|
39329
|
+
actions.set((state) => {
|
|
39330
|
+
state.step = "status";
|
|
39331
|
+
});
|
|
39332
|
+
}
|
|
39333
|
+
});
|
|
39323
39334
|
}
|
|
39324
39335
|
|
|
39325
39336
|
// src/app/ManualRebase.tsx
|
|
@@ -39349,7 +39360,7 @@ async function run6() {
|
|
|
39349
39360
|
actions.output(/* @__PURE__ */ React36.createElement(Text, {
|
|
39350
39361
|
color: colors.red
|
|
39351
39362
|
}, "\uD83D\uDEA8 Abort"));
|
|
39352
|
-
|
|
39363
|
+
handle_exit2();
|
|
39353
39364
|
return 15;
|
|
39354
39365
|
});
|
|
39355
39366
|
const temp_branch_name = `${branch_name}_${short_id()}`;
|
|
@@ -39428,7 +39439,7 @@ async function run6() {
|
|
|
39428
39439
|
}
|
|
39429
39440
|
cli.sync(`pwd`, spawn_options);
|
|
39430
39441
|
}
|
|
39431
|
-
function
|
|
39442
|
+
function handle_exit2() {
|
|
39432
39443
|
actions.output(/* @__PURE__ */ React36.createElement(Text, {
|
|
39433
39444
|
color: colors.yellow
|
|
39434
39445
|
}, "Restoring ", /* @__PURE__ */ React36.createElement(Brackets, null, branch_name), "…"));
|
|
@@ -40247,7 +40258,7 @@ async function run9() {
|
|
|
40247
40258
|
actions.output(/* @__PURE__ */ React44.createElement(Text, {
|
|
40248
40259
|
color: colors.red
|
|
40249
40260
|
}, "\uD83D\uDEA8 Abort"));
|
|
40250
|
-
|
|
40261
|
+
handle_exit2();
|
|
40251
40262
|
return 17;
|
|
40252
40263
|
});
|
|
40253
40264
|
let DEFAULT_PR_BODY = "";
|
|
@@ -40392,7 +40403,7 @@ async function run9() {
|
|
|
40392
40403
|
});
|
|
40393
40404
|
}
|
|
40394
40405
|
}
|
|
40395
|
-
function
|
|
40406
|
+
function handle_exit2() {
|
|
40396
40407
|
actions.output(/* @__PURE__ */ React44.createElement(Text, {
|
|
40397
40408
|
color: colors.yellow
|
|
40398
40409
|
}, "Restoring PR state…"));
|
|
@@ -40698,7 +40709,9 @@ class ErrorBoundary extends React52.Component {
|
|
|
40698
40709
|
component_stack = component_stack.split(`
|
|
40699
40710
|
`).slice(1).join(`
|
|
40700
40711
|
`);
|
|
40701
|
-
this.setState({ component_stack })
|
|
40712
|
+
this.setState({ component_stack }, async () => {
|
|
40713
|
+
await Exit.handle_exit({ code: 30, clear: true });
|
|
40714
|
+
});
|
|
40702
40715
|
}
|
|
40703
40716
|
}
|
|
40704
40717
|
render() {
|
|
@@ -45653,7 +45666,7 @@ var yargs_default = Yargs;
|
|
|
45653
45666
|
|
|
45654
45667
|
// src/command.ts
|
|
45655
45668
|
async function command2() {
|
|
45656
|
-
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.3.
|
|
45669
|
+
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.3.2").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45657
45670
|
}
|
|
45658
45671
|
var GlobalOptions = {
|
|
45659
45672
|
verbose: {
|
package/package.json
CHANGED
package/src/app/Exit.tsx
CHANGED
|
@@ -15,44 +15,44 @@ type Props = {
|
|
|
15
15
|
export function Exit(props: Props) {
|
|
16
16
|
React.useEffect(() => {
|
|
17
17
|
// immediately handle exit on mount
|
|
18
|
-
handle_exit().catch((err) => {
|
|
18
|
+
Exit.handle_exit(props).catch((err) => {
|
|
19
19
|
// eslint-disable-next-line no-console
|
|
20
20
|
console.error(err);
|
|
21
21
|
});
|
|
22
|
+
}, [props.clear, props.code]);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const actions = state.actions;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Exit.handle_exit = async function handle_exit(props: Props) {
|
|
28
|
+
const state = Store.getState();
|
|
29
|
+
const actions = state.actions;
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
if (state.abort_handler) {
|
|
33
|
-
exit_code = await state.abort_handler();
|
|
34
|
-
}
|
|
33
|
+
let exit_code = props.code;
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
// run abort_handler if it exists
|
|
36
|
+
if (state.abort_handler) {
|
|
37
|
+
exit_code = await state.abort_handler();
|
|
38
|
+
}
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
// restore git stash if necessary
|
|
41
|
+
if (state.is_dirty_check_stash) {
|
|
42
|
+
await cli("git stash pop");
|
|
43
|
+
actions.output(<Ink.Text color={colors.green}>✅ Changes restored from stash</Ink.Text>);
|
|
44
|
+
}
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
actions.clear();
|
|
48
|
-
}
|
|
46
|
+
// ensure output has a chance to render
|
|
47
|
+
await sleep(1);
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
// finally handle the actual app and process exit
|
|
50
|
+
if (props.clear) {
|
|
51
|
+
actions.clear();
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
process.exit();
|
|
54
|
-
}
|
|
55
|
-
}, [props.clear, props.code]);
|
|
54
|
+
actions.unmount();
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
process.exitCode = exit_code;
|
|
57
|
+
process.exit();
|
|
58
|
+
};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
import { Store } from "~/app/Store";
|
|
3
4
|
import { Rebase } from "~/commands/Rebase";
|
|
4
5
|
|
|
5
6
|
export function LocalMergeRebase() {
|
|
6
|
-
|
|
7
|
+
const actions = Store.useActions();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Rebase
|
|
11
|
+
onComplete={() => {
|
|
12
|
+
actions.set((state) => {
|
|
13
|
+
state.step = "status";
|
|
14
|
+
});
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
7
18
|
}
|
package/src/commands/Rebase.tsx
CHANGED
|
@@ -15,16 +15,20 @@ import { colors } from "~/core/colors";
|
|
|
15
15
|
import { invariant } from "~/core/invariant";
|
|
16
16
|
import { short_id } from "~/core/short_id";
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
type Props = {
|
|
19
|
+
onComplete?: () => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function Rebase(props: Props) {
|
|
19
23
|
return (
|
|
20
24
|
<Await
|
|
21
25
|
fallback={<Ink.Text color={colors.yellow}>Rebasing commits…</Ink.Text>}
|
|
22
|
-
function={Rebase.run}
|
|
26
|
+
function={() => Rebase.run(props)}
|
|
23
27
|
/>
|
|
24
28
|
);
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
Rebase.run = async function run() {
|
|
31
|
+
Rebase.run = async function run(props: Props) {
|
|
28
32
|
const state = Store.getState();
|
|
29
33
|
const actions = state.actions;
|
|
30
34
|
const branch_name = state.branch_name;
|
|
@@ -145,9 +149,12 @@ Rebase.run = async function run() {
|
|
|
145
149
|
state.commit_range = next_commit_range;
|
|
146
150
|
});
|
|
147
151
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
if (props.onComplete) {
|
|
153
|
+
props.onComplete();
|
|
154
|
+
} else {
|
|
155
|
+
actions.output(<Status />);
|
|
156
|
+
actions.exit(0);
|
|
157
|
+
}
|
|
151
158
|
|
|
152
159
|
// cleanup git operations if cancelled during manual rebase
|
|
153
160
|
function restore_git() {
|
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
import * as Ink from "ink-cjs";
|
|
5
5
|
|
|
6
|
+
import { Exit } from "~/app/Exit";
|
|
6
7
|
import { FormatText } from "~/app/FormatText";
|
|
7
8
|
import { Store } from "~/app/Store";
|
|
8
9
|
import { colors } from "~/core/colors";
|
|
@@ -36,7 +37,9 @@ export class ErrorBoundary extends React.Component<Props, State> {
|
|
|
36
37
|
if (component_stack) {
|
|
37
38
|
// remove first line of component_stack
|
|
38
39
|
component_stack = component_stack.split("\n").slice(1).join("\n");
|
|
39
|
-
this.setState({ component_stack })
|
|
40
|
+
this.setState({ component_stack }, async () => {
|
|
41
|
+
await Exit.handle_exit({ code: 30, clear: true });
|
|
42
|
+
});
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
|