@@ -15,6 +15,10 @@ class BranchesView : Subview
15
15
private const string ConfirmSwitchMessage = "Switch branch to {0}?" ;
16
16
private const string ConfirmSwitchOK = "Switch" ;
17
17
private const string ConfirmSwitchCancel = "Cancel" ;
18
+ private const string ConfirmCheckoutBranchTitle = "Confirm branch checkout" ;
19
+ private const string ConfirmCheckoutBranchMessage = "Checkout branch {0}?" ;
20
+ private const string ConfirmCheckoutBranchOK = "Checkout" ;
21
+ private const string ConfirmCheckoutBranchCancel = "Cancel" ;
18
22
private const string NewBranchCancelButton = "x" ;
19
23
private const string NewBranchConfirmButton = "Create" ;
20
24
private const string FavoritesSetting = "Favorites" ;
@@ -649,37 +653,41 @@ private void OnTreeNodeGUI(BranchTreeNode node)
649
653
650
654
if ( Event . current . clickCount > 1 && mode == BranchesMode . Default )
651
655
{
652
- if ( node . Type == NodeType . LocalBranch &&
653
- EditorUtility . DisplayDialog ( ConfirmSwitchTitle , String . Format ( ConfirmSwitchMessage , node . Name ) , ConfirmSwitchOK ,
654
- ConfirmSwitchCancel ) )
656
+ if ( node . Type == NodeType . LocalBranch )
655
657
{
656
- GitClient . SwitchBranch ( node . Name )
657
- . FinallyInUI ( ( success , e ) =>
658
- {
659
- if ( success )
660
- Refresh ( ) ;
661
- else
658
+ if ( EditorUtility . DisplayDialog ( ConfirmSwitchTitle , String . Format ( ConfirmSwitchMessage , node . Name ) , ConfirmSwitchOK , ConfirmSwitchCancel ) )
659
+ {
660
+ GitClient . SwitchBranch ( node . Name )
661
+ . FinallyInUI ( ( success , e ) =>
662
662
{
663
- EditorUtility . DisplayDialog ( Localization . SwitchBranchTitle ,
664
- String . Format ( Localization . SwitchBranchFailedDescription , node . Name ) ,
665
- Localization . Ok ) ;
666
- }
667
- } ) . Start ( ) ;
663
+ if ( success )
664
+ Refresh ( ) ;
665
+ else
666
+ {
667
+ EditorUtility . DisplayDialog ( Localization . SwitchBranchTitle ,
668
+ String . Format ( Localization . SwitchBranchFailedDescription , node . Name ) ,
669
+ Localization . Ok ) ;
670
+ }
671
+ } ) . Start ( ) ;
672
+ }
668
673
}
669
674
else if ( node . Type == NodeType . RemoteBranch )
670
675
{
671
- GitClient . CreateBranch ( selectedNode . Name . Substring ( selectedNode . Name . IndexOf ( '/' ) + 1 ) , selectedNode . Name )
672
- . FinallyInUI ( ( success , e ) =>
673
- {
674
- if ( success )
675
- Refresh ( ) ;
676
- else
676
+ if ( EditorUtility . DisplayDialog ( ConfirmCheckoutBranchTitle , String . Format ( ConfirmCheckoutBranchMessage , node . Name ) , ConfirmCheckoutBranchOK , ConfirmCheckoutBranchCancel ) )
677
+ {
678
+ GitClient . CreateBranch ( selectedNode . Name . Substring ( selectedNode . Name . IndexOf ( '/' ) + 1 ) , selectedNode . Name )
679
+ . FinallyInUI ( ( success , e ) =>
677
680
{
678
- EditorUtility . DisplayDialog ( Localization . SwitchBranchTitle ,
679
- String . Format ( Localization . SwitchBranchFailedDescription , node . Name ) ,
680
- Localization . Ok ) ;
681
- }
682
- } ) . Start ( ) ;
681
+ if ( success )
682
+ Refresh ( ) ;
683
+ else
684
+ {
685
+ EditorUtility . DisplayDialog ( Localization . SwitchBranchTitle ,
686
+ String . Format ( Localization . SwitchBranchFailedDescription , node . Name ) ,
687
+ Localization . Ok ) ;
688
+ }
689
+ } ) . Start ( ) ;
690
+ }
683
691
}
684
692
}
685
693
}
0 commit comments