You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/gonyx/cmd/cherry-pick.go
+71-33Lines changed: 71 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -11,27 +11,40 @@ import (
11
11
"github.com/spf13/cobra"
12
12
)
13
13
14
+
// CherryPickOptions holds options for the cherry-pick command
15
+
typeCherryPickOptionsstruct {
16
+
Releases []string
17
+
}
18
+
14
19
// NewCherryPickCommand creates a new cherry-pick command
15
20
funcNewCherryPickCommand() *cobra.Command {
21
+
opts:=&CherryPickOptions{}
22
+
16
23
cmd:=&cobra.Command{
17
24
Use: "cherry-pick <commit-sha>",
18
25
Short: "Cherry-pick a commit to a release branch",
19
26
Long: `Cherry-pick a commit to a release branch and create a PR.
20
27
21
28
This command will:
22
-
1. Find the nearest stable version tag (v*.*.*)
29
+
1. Find the nearest stable version tag (v*.*.* if --release not specified)
23
30
2. Fetch the corresponding release branch (release/vMAJOR.MINOR)
24
31
3. Create a hotfix branch with the cherry-picked commit
25
32
4. Push and create a PR using the GitHub CLI
26
-
5. Switch back to the original branch`,
33
+
5. Switch back to the original branch
34
+
35
+
The --release flag can be specified multiple times to cherry-pick to multiple release branches.`,
27
36
Args: cobra.ExactArgs(1),
28
-
Run: runCherryPick,
37
+
Run: func(cmd*cobra.Command, args []string) {
38
+
runCherryPick(cmd, args, opts)
39
+
},
29
40
}
30
41
42
+
cmd.Flags().StringSliceVar(&opts.Releases, "release", []string{}, "Release version(s) to cherry-pick to (e.g., v1.0, v1.1). Can be specified multiple times.")
0 commit comments