File tree Expand file tree Collapse file tree 2 files changed +24
-18
lines changed Expand file tree Collapse file tree 2 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -131,25 +131,9 @@ impl CheckoutOptionPopup {
131131
132132 fn change_kind ( & mut self , incr : bool ) {
133133 self . option = if incr {
134- match self . option {
135- CheckoutOptions :: KeepLocalChanges => {
136- CheckoutOptions :: Unchange
137- }
138- CheckoutOptions :: Unchange => CheckoutOptions :: Discard ,
139- CheckoutOptions :: Discard => {
140- CheckoutOptions :: KeepLocalChanges
141- }
142- }
134+ self . option . next ( )
143135 } else {
144- match self . option {
145- CheckoutOptions :: KeepLocalChanges => {
146- CheckoutOptions :: Discard
147- }
148- CheckoutOptions :: Unchange => {
149- CheckoutOptions :: KeepLocalChanges
150- }
151- CheckoutOptions :: Discard => CheckoutOptions :: Unchange ,
152- }
136+ self . option . previous ( )
153137 } ;
154138 }
155139}
Original file line number Diff line number Diff line change @@ -446,6 +446,28 @@ pub enum CheckoutOptions {
446446}
447447
448448impl CheckoutOptions {
449+ pub fn previous ( & self ) -> Self {
450+ match self {
451+ CheckoutOptions :: KeepLocalChanges => {
452+ CheckoutOptions :: Discard
453+ }
454+ CheckoutOptions :: Unchange => {
455+ CheckoutOptions :: KeepLocalChanges
456+ }
457+ CheckoutOptions :: Discard => CheckoutOptions :: Unchange ,
458+ }
459+ }
460+
461+ pub fn next ( & self ) -> Self {
462+ match self {
463+ CheckoutOptions :: KeepLocalChanges => CheckoutOptions :: Unchange ,
464+ CheckoutOptions :: Unchange => CheckoutOptions :: Discard ,
465+ CheckoutOptions :: Discard => {
466+ CheckoutOptions :: KeepLocalChanges
467+ }
468+ }
469+ }
470+
449471 pub fn to_string_pair ( & self ) -> ( & ' static str , & ' static str ) {
450472 const CHECKOUT_OPTION_STASH_AND_REAPPLY : & str =
451473 " 🟢 Stash and reapply changes" ;
You can’t perform that action at this time.
0 commit comments