@@ -12,12 +12,14 @@ use crate::{
1212 popups:: {
1313 AppOption , BlameFilePopup , BranchListPopup , CommitPopup ,
1414 CompareCommitsPopup , ConfirmPopup , CreateBranchPopup ,
15- ExternalEditorPopup , FetchPopup , FileRevlogPopup ,
16- FuzzyFindPopup , HelpPopup , InspectCommitPopup ,
17- LogSearchPopupPopup , MsgPopup , OptionsPopup , PullPopup ,
18- PushPopup , PushTagsPopup , RenameBranchPopup , ResetPopup ,
19- RevisionFilesPopup , StashMsgPopup , SubmodulesListPopup ,
20- TagCommitPopup , TagListPopup ,
15+ CreateRemotePopup , ExternalEditorPopup , FetchPopup ,
16+ FileRevlogPopup , FuzzyFindPopup , HelpPopup ,
17+ InspectCommitPopup , LogSearchPopupPopup , MsgPopup ,
18+ OptionsPopup , PullPopup , PushPopup , PushTagsPopup ,
19+ RemoteListPopup , RenameBranchPopup , RenameRemotePopup ,
20+ ResetPopup , RevisionFilesPopup , StashMsgPopup ,
21+ SubmodulesListPopup , TagCommitPopup , TagListPopup ,
22+ UpdateRemoteUrlPopup ,
2123 } ,
2224 queue:: {
2325 Action , AppTabs , InternalEvent , NeedsUpdate , Queue ,
@@ -86,6 +88,10 @@ pub struct App {
8688 fetch_popup : FetchPopup ,
8789 tag_commit_popup : TagCommitPopup ,
8890 create_branch_popup : CreateBranchPopup ,
91+ create_remote_popup : CreateRemotePopup ,
92+ rename_remote_popup : RenameRemotePopup ,
93+ update_remote_url_popup : UpdateRemoteUrlPopup ,
94+ remotes_popup : RemoteListPopup ,
8995 rename_branch_popup : RenameBranchPopup ,
9096 select_branch_popup : BranchListPopup ,
9197 options_popup : OptionsPopup ,
@@ -189,6 +195,10 @@ impl App {
189195 fetch_popup : FetchPopup :: new ( & env) ,
190196 tag_commit_popup : TagCommitPopup :: new ( & env) ,
191197 create_branch_popup : CreateBranchPopup :: new ( & env) ,
198+ create_remote_popup : CreateRemotePopup :: new ( & env) ,
199+ rename_remote_popup : RenameRemotePopup :: new ( & env) ,
200+ update_remote_url_popup : UpdateRemoteUrlPopup :: new ( & env) ,
201+ remotes_popup : RemoteListPopup :: new ( & env) ,
192202 rename_branch_popup : RenameBranchPopup :: new ( & env) ,
193203 select_branch_popup : BranchListPopup :: new ( & env) ,
194204 tags_popup : TagListPopup :: new ( & env) ,
@@ -484,6 +494,10 @@ impl App {
484494 tag_commit_popup,
485495 reset_popup,
486496 create_branch_popup,
497+ create_remote_popup,
498+ rename_remote_popup,
499+ update_remote_url_popup,
500+ remotes_popup,
487501 rename_branch_popup,
488502 select_branch_popup,
489503 revision_files_popup,
@@ -512,6 +526,10 @@ impl App {
512526 external_editor_popup,
513527 tag_commit_popup,
514528 select_branch_popup,
529+ remotes_popup,
530+ create_remote_popup,
531+ rename_remote_popup,
532+ update_remote_url_popup,
515533 submodule_popup,
516534 tags_popup,
517535 reset_popup,
@@ -646,6 +664,9 @@ impl App {
646664 if flags. contains ( NeedsUpdate :: BRANCHES ) {
647665 self . select_branch_popup . update_branches ( ) ?;
648666 }
667+ if flags. contains ( NeedsUpdate :: REMOTES ) {
668+ self . remotes_popup . update_remotes ( ) ?;
669+ }
649670
650671 Ok ( ( ) )
651672 }
@@ -727,7 +748,19 @@ impl App {
727748 InternalEvent :: TagCommit ( id) => {
728749 self . tag_commit_popup . open ( id) ?;
729750 }
730-
751+ InternalEvent :: CreateRemote => {
752+ self . create_remote_popup . open ( ) ?;
753+ }
754+ InternalEvent :: RenameRemote ( cur_name) => {
755+ self . rename_remote_popup . open ( cur_name) ?;
756+ }
757+ InternalEvent :: UpdateRemoteUrl ( remote_name, cur_url) => {
758+ self . update_remote_url_popup
759+ . open ( remote_name, cur_url) ?;
760+ }
761+ InternalEvent :: ViewRemotes => {
762+ self . remotes_popup . open ( ) ?;
763+ }
731764 InternalEvent :: CreateBranch => {
732765 self . create_branch_popup . open ( ) ?;
733766 }
@@ -926,6 +959,9 @@ impl App {
926959 Action :: DeleteRemoteBranch ( branch_ref) => {
927960 self . delete_remote_branch ( & branch_ref) ?;
928961 }
962+ Action :: DeleteRemote ( remote_name) => {
963+ self . delete_remote ( & remote_name) ;
964+ }
929965 Action :: DeleteTag ( tag_name) => {
930966 self . delete_tag ( tag_name) ?;
931967 }
@@ -1015,6 +1051,24 @@ impl App {
10151051 Ok ( ( ) )
10161052 }
10171053
1054+ fn delete_remote ( & self , remote_name : & str ) {
1055+ let res =
1056+ sync:: delete_remote ( & self . repo . borrow ( ) , remote_name) ;
1057+ match res {
1058+ Ok ( ( ) ) => {
1059+ self . queue . push ( InternalEvent :: Update (
1060+ NeedsUpdate :: ALL | NeedsUpdate :: REMOTES ,
1061+ ) ) ;
1062+ }
1063+ Err ( e) => {
1064+ log:: error!( "delete remote: {}" , e, ) ;
1065+ self . queue . push ( InternalEvent :: ShowErrorMsg (
1066+ format ! ( "delete remote error:\n {e}" , ) ,
1067+ ) ) ;
1068+ }
1069+ }
1070+ }
1071+
10181072 fn commands ( & self , force_all : bool ) -> Vec < CommandInfo > {
10191073 let mut res = Vec :: new ( ) ;
10201074
0 commit comments