Add support for git branches on remote projects (#19755)
Release Notes: - Fixed a bug where the branch switcher could not be used remotely.
This commit is contained in:
parent
5506669b06
commit
c69da2df70
25 changed files with 993 additions and 127 deletions
|
@ -256,6 +256,9 @@ pub struct AppContext {
|
|||
pub(crate) layout_id_buffer: Vec<LayoutId>, // We recycle this memory across layout requests.
|
||||
pub(crate) propagate_event: bool,
|
||||
pub(crate) prompt_builder: Option<PromptBuilder>,
|
||||
|
||||
#[cfg(any(test, feature = "test-support", debug_assertions))]
|
||||
pub(crate) name: Option<&'static str>,
|
||||
}
|
||||
|
||||
impl AppContext {
|
||||
|
@ -309,6 +312,9 @@ impl AppContext {
|
|||
layout_id_buffer: Default::default(),
|
||||
propagate_event: true,
|
||||
prompt_builder: Some(PromptBuilder::Default),
|
||||
|
||||
#[cfg(any(test, feature = "test-support", debug_assertions))]
|
||||
name: None,
|
||||
}),
|
||||
});
|
||||
|
||||
|
@ -988,6 +994,7 @@ impl AppContext {
|
|||
}
|
||||
|
||||
/// Move the global of the given type to the stack.
|
||||
#[track_caller]
|
||||
pub(crate) fn lease_global<G: Global>(&mut self) -> GlobalLease<G> {
|
||||
GlobalLease::new(
|
||||
self.globals_by_type
|
||||
|
@ -1319,6 +1326,12 @@ impl AppContext {
|
|||
|
||||
(task, is_first)
|
||||
}
|
||||
|
||||
/// Get the name for this App.
|
||||
#[cfg(any(test, feature = "test-support", debug_assertions))]
|
||||
pub fn get_name(&self) -> &'static str {
|
||||
self.name.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Context for AppContext {
|
||||
|
|
|
@ -536,6 +536,15 @@ impl AnyWeakModel {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for AnyWeakModel {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct(type_name::<Self>())
|
||||
.field("entity_id", &self.entity_id)
|
||||
.field("entity_type", &self.entity_type)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<WeakModel<T>> for AnyWeakModel {
|
||||
fn from(model: WeakModel<T>) -> Self {
|
||||
model.any_model
|
||||
|
|
|
@ -478,6 +478,12 @@ impl TestAppContext {
|
|||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// Set a name for this App.
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn set_name(&mut self, name: &'static str) {
|
||||
self.update(|cx| cx.name = Some(name))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: 'static> Model<T> {
|
||||
|
|
|
@ -57,6 +57,7 @@ pub trait UpdateGlobal {
|
|||
}
|
||||
|
||||
impl<T: Global> UpdateGlobal for T {
|
||||
#[track_caller]
|
||||
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
|
||||
where
|
||||
C: BorrowAppContext,
|
||||
|
|
|
@ -306,6 +306,7 @@ where
|
|||
self.borrow_mut().set_global(global)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn update_global<G, R>(&mut self, f: impl FnOnce(&mut G, &mut Self) -> R) -> R
|
||||
where
|
||||
G: Global,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue