@@ -26,8 +26,8 @@ use tauri_plugin_window_state::StateFlags;
2626
2727use messages:: {
2828 AbandonRevisions , CheckoutRevision , CopyChanges , CreateRef , CreateRevision , DeleteRef ,
29- DescribeRevision , DuplicateRevisions , FetchRemote , InputResponse , InsertRevision , MoveChanges ,
30- MoveRef , MoveRevision , MoveSource , MutationResult , PushRemote , RenameBranch , RevId ,
29+ DescribeRevision , DuplicateRevisions , GitFetch , GitPush , InputResponse , InsertRevision ,
30+ MoveChanges , MoveRef , MoveRevision , MoveSource , MutationResult , RenameBranch , RevId ,
3131 TrackBranch , UndoOperation , UntrackBranch ,
3232} ;
3333use worker:: { Mutation , Session , SessionEvent , WorkerSession } ;
@@ -140,6 +140,7 @@ fn main() -> Result<()> {
140140 query_log,
141141 query_log_next_page,
142142 query_revision,
143+ query_remotes,
143144 checkout_revision,
144145 create_revision,
145146 insert_revision,
@@ -156,8 +157,8 @@ fn main() -> Result<()> {
156157 create_ref,
157158 delete_ref,
158159 move_ref,
159- push_remote ,
160- fetch_remote ,
160+ git_push ,
161+ git_fetch ,
161162 undo_operation
162163 ] )
163164 . menu ( menu:: build_main)
@@ -316,6 +317,27 @@ fn query_revision(
316317 . map_err ( InvokeError :: from_anyhow)
317318}
318319
320+ #[ tauri:: command( async ) ]
321+ fn query_remotes (
322+ window : Window ,
323+ app_state : State < AppState > ,
324+ tracking_branch : Option < String > ,
325+ ) -> Result < Vec < String > , InvokeError > {
326+ let session_tx: Sender < SessionEvent > = app_state. get_session ( window. label ( ) ) ;
327+ let ( call_tx, call_rx) = channel ( ) ;
328+
329+ session_tx
330+ . send ( SessionEvent :: QueryRemotes {
331+ tx : call_tx,
332+ tracking_branch,
333+ } )
334+ . map_err ( InvokeError :: from_error) ?;
335+ call_rx
336+ . recv ( )
337+ . map_err ( InvokeError :: from_error) ?
338+ . map_err ( InvokeError :: from_anyhow)
339+ }
340+
319341#[ tauri:: command( async ) ]
320342fn checkout_revision (
321343 window : Window ,
@@ -461,19 +483,19 @@ fn move_ref(
461483}
462484
463485#[ tauri:: command( async ) ]
464- fn push_remote (
486+ fn git_push (
465487 window : Window ,
466488 app_state : State < AppState > ,
467- mutation : PushRemote ,
489+ mutation : GitPush ,
468490) -> Result < MutationResult , InvokeError > {
469491 try_mutate ( window, app_state, mutation)
470492}
471493
472494#[ tauri:: command( async ) ]
473- fn fetch_remote (
495+ fn git_fetch (
474496 window : Window ,
475497 app_state : State < AppState > ,
476- mutation : FetchRemote ,
498+ mutation : GitFetch ,
477499) -> Result < MutationResult , InvokeError > {
478500 try_mutate ( window, app_state, mutation)
479501}
0 commit comments