File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ pub mod vbranch {
5151 ListLocal ,
5252 /// Provide the current state of all applied virtual branches.
5353 Status ,
54+ /// Switch to the GitButler workspace.
55+ SetBase {
56+ /// The name of the remote branch to integrate with, like `origin/main`.
57+ short_tracking_branch_name : String ,
58+ } ,
5459 /// Make the named branch the default so all worktree or index changes are associated with it automatically.
5560 SetDefault {
5661 /// The name of the new default virtual branch.
Original file line number Diff line number Diff line change @@ -7,6 +7,16 @@ use gitbutler_stack::{Stack, VirtualBranchesHandle};
77
88use crate :: command:: debug_print;
99
10+ pub fn set_base ( project : Project , short_tracking_branch_name : String ) -> Result < ( ) > {
11+ let branch_name = format ! ( "refs/remotes/{}" , short_tracking_branch_name)
12+ . parse ( )
13+ . context ( "Invalid branch name" ) ?;
14+ debug_print ( gitbutler_branch_actions:: set_base_branch (
15+ & project,
16+ & branch_name,
17+ ) ?)
18+ }
19+
1020pub fn list_all ( project : Project ) -> Result < ( ) > {
1121 let ctx = CommandContext :: open ( & project) ?;
1222 debug_print ( list_branches ( & ctx, None , None ) ?)
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ fn main() -> Result<()> {
2828 args:: Subcommands :: Branch ( vbranch:: Platform { cmd } ) => {
2929 let project = command:: prepare:: project_from_path ( args. current_dir ) ?;
3030 match cmd {
31+ Some ( vbranch:: SubCommands :: SetBase {
32+ short_tracking_branch_name,
33+ } ) => command:: vbranch:: set_base ( project, short_tracking_branch_name) ,
3134 Some ( vbranch:: SubCommands :: ListLocal ) => command:: vbranch:: list_local ( project) ,
3235 Some ( vbranch:: SubCommands :: Status ) => command:: vbranch:: status ( project) ,
3336 Some ( vbranch:: SubCommands :: Unapply { name } ) => {
You can’t perform that action at this time.
0 commit comments