@@ -57,7 +57,6 @@ impl State {
5757 let current_branch_exists_in_tree = self . branch_exists_in_tree ( repo, & current_branch) ;
5858
5959 if git_branch_exists ( & branch_name) {
60- println ! ( "AAA" ) ;
6160 if !branch_exists_in_tree {
6261 tracing:: warn!(
6362 "Branch {branch_name} exists in the git repo but is not tracked by git-stack. \
@@ -93,6 +92,11 @@ impl State {
9392 // Actually create the git branch.
9493 run_git ( & [ "checkout" , "-b" , & branch_name, & current_branch] ) ?;
9594
95+ println ! (
96+ "Branch {branch_name} created and checked out." ,
97+ branch_name = branch_name. yellow( )
98+ ) ;
99+
96100 // Save the state after modifying it.
97101 save_state ( self ) ?;
98102
@@ -153,6 +157,11 @@ impl State {
153157 bail ! ( "Branch {branch_name} not found in the git-stack tree." ) ;
154158 } ;
155159 tree. branches . retain ( |branch| branch. name != branch_name) ;
160+ println ! (
161+ "Branch {branch_name} removed from git-stack tree." ,
162+ branch_name = branch_name. yellow( )
163+ ) ;
164+
156165 save_state ( self ) ?;
157166
158167 Ok ( ( ) )
@@ -189,7 +198,7 @@ impl State {
189198 ) ;
190199 }
191200
192- tracing:: info !( "Mounting {branch_name} on {parent_branch:?}" ) ;
201+ tracing:: debug !( "Mounting {branch_name} on {parent_branch:?}" ) ;
193202
194203 // Make sure the parent branch is actually changing.
195204 if let ( Some ( Branch { name : name_a, .. } ) , Some ( Branch { name : name_b, .. } ) ) = (
@@ -220,15 +229,25 @@ impl State {
220229 } else {
221230 bail ! ( "Parent branch {parent_branch} not found in the git-stack tree." ) ;
222231 }
232+ println ! (
233+ "Branch {branch_name} stacked on {parent_branch}." ,
234+ branch_name = branch_name. yellow( ) ,
235+ parent_branch = parent_branch. yellow( )
236+ ) ;
237+
223238 save_state ( self ) ?;
224239 Ok ( ( ) )
225240 }
226- fn get_parent_branch_of ( & self , repo : & str , branch_name : & str ) -> Option < & Branch > {
241+ pub fn get_parent_branch_of ( & self , repo : & str , branch_name : & str ) -> Option < & Branch > {
227242 self . trees
228243 . get ( repo)
229244 . and_then ( |tree| find_parent_of_branch ( tree, branch_name) )
230245 }
231- fn get_parent_branch_of_mut ( & mut self , repo : & str , branch_name : & str ) -> Option < & mut Branch > {
246+ pub fn get_parent_branch_of_mut (
247+ & mut self ,
248+ repo : & str ,
249+ branch_name : & str ,
250+ ) -> Option < & mut Branch > {
232251 self . trees
233252 . get_mut ( repo)
234253 . and_then ( |tree| find_parent_of_branch_mut ( tree, branch_name) )
@@ -366,7 +385,7 @@ pub fn load_state() -> anyhow::Result<State> {
366385
367386pub fn save_state ( state : & State ) -> Result < ( ) > {
368387 let config_path = get_xdg_path ( ) ?;
369- tracing:: info !( ?state, ?config_path, "Saving state to config file" ) ;
388+ tracing:: debug !( ?state, ?config_path, "Saving state to config file" ) ;
370389 Ok ( fs:: write ( config_path, serde_yaml:: to_string ( & state) ?) ?)
371390}
372391
0 commit comments