pub struct Workspace { /* private fields */ }Expand description
A place in which changes can be prepared for publication
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn from_url(url: &Url) -> Result<Self, Error>
pub fn from_url(url: &Url) -> Result<Self, Error>
Create a new workspace from a main branch URL
Sourcepub fn builder() -> WorkspaceBuilder
pub fn builder() -> WorkspaceBuilder
Create a new workspace builder
Sourcepub fn main_branch(&self) -> Option<&GenericBranch>
pub fn main_branch(&self) -> Option<&GenericBranch>
Return the main branch
Sourcepub fn set_main_branch(&mut self, branch: GenericBranch) -> Result<(), Error>
pub fn set_main_branch(&mut self, branch: GenericBranch) -> Result<(), Error>
Set the main branch
Sourcepub fn local_tree(&self) -> &GenericWorkingTree
pub fn local_tree(&self) -> &GenericWorkingTree
Return the cached branch
Sourcepub fn refreshed(&self) -> bool
pub fn refreshed(&self) -> bool
Return whether the workspace has been refreshed
In other words, whether the workspace has been reset to the main branch
Sourcepub fn resume_branch(&self) -> Option<&GenericBranch>
pub fn resume_branch(&self) -> Option<&GenericBranch>
Return the resume branch
Sourcepub fn changes_since_main(&self) -> bool
pub fn changes_since_main(&self) -> bool
Return whether there are changes since the main branch
Sourcepub fn changes_since_base(&self) -> bool
pub fn changes_since_base(&self) -> bool
Return whether there are changes since the base revision
Sourcepub fn base_revid(&self) -> Option<&RevisionId>
pub fn base_revid(&self) -> Option<&RevisionId>
Return the base revision id
Sourcepub fn any_branch_changes(&self) -> bool
pub fn any_branch_changes(&self) -> bool
Have any branch changes at all been made?
Includes changes that already existed in the resume branch
Sourcepub fn additional_colocated_branches(&self) -> &HashMap<String, String>
pub fn additional_colocated_branches(&self) -> &HashMap<String, String>
Return the additional colocated branches
Sourcepub fn changed_branches(
&self,
) -> Vec<(String, Option<RevisionId>, Option<RevisionId>)>
pub fn changed_branches( &self, ) -> Vec<(String, Option<RevisionId>, Option<RevisionId>)>
Return the branches that have changed
Sourcepub fn main_colo_revid(&self) -> &HashMap<String, RevisionId>
pub fn main_colo_revid(&self) -> &HashMap<String, RevisionId>
Return the main colocated branch revision ids
Sourcepub fn defer_destroy(&mut self) -> PathBuf
pub fn defer_destroy(&mut self) -> PathBuf
Defer destroying the workspace, even if the Workspace is dropped
Sourcepub fn publish_changes(
&self,
target_branch: Option<&GenericBranch>,
mode: Mode,
name: &str,
get_proposal_description: impl FnOnce(DescriptionFormat, Option<&MergeProposal>) -> String,
get_proposal_commit_message: Option<impl FnOnce(Option<&MergeProposal>) -> Option<String>>,
get_proposal_title: Option<impl FnOnce(Option<&MergeProposal>) -> Option<String>>,
forge: Option<&Forge>,
allow_create_proposal: Option<bool>,
labels: Option<Vec<String>>,
overwrite_existing: Option<bool>,
existing_proposal: Option<MergeProposal>,
reviewers: Option<Vec<String>>,
tags: Option<HashMap<String, RevisionId>>,
derived_owner: Option<&str>,
allow_collaboration: Option<bool>,
stop_revision: Option<&RevisionId>,
auto_merge: Option<bool>,
work_in_progress: Option<bool>,
) -> Result<PublishResult, PublishError>
pub fn publish_changes( &self, target_branch: Option<&GenericBranch>, mode: Mode, name: &str, get_proposal_description: impl FnOnce(DescriptionFormat, Option<&MergeProposal>) -> String, get_proposal_commit_message: Option<impl FnOnce(Option<&MergeProposal>) -> Option<String>>, get_proposal_title: Option<impl FnOnce(Option<&MergeProposal>) -> Option<String>>, forge: Option<&Forge>, allow_create_proposal: Option<bool>, labels: Option<Vec<String>>, overwrite_existing: Option<bool>, existing_proposal: Option<MergeProposal>, reviewers: Option<Vec<String>>, tags: Option<HashMap<String, RevisionId>>, derived_owner: Option<&str>, allow_collaboration: Option<bool>, stop_revision: Option<&RevisionId>, auto_merge: Option<bool>, work_in_progress: Option<bool>, ) -> Result<PublishResult, PublishError>
Publish the changes back to the main branch
Sourcepub fn propose(
&self,
name: &str,
description: &str,
target_branch: Option<&GenericBranch>,
forge: Option<Forge>,
existing_proposal: Option<MergeProposal>,
tags: Option<HashMap<String, RevisionId>>,
labels: Option<Vec<String>>,
overwrite_existing: Option<bool>,
commit_message: Option<&str>,
allow_collaboration: Option<bool>,
title: Option<&str>,
allow_empty: Option<bool>,
reviewers: Option<Vec<String>>,
owner: Option<&str>,
auto_merge: Option<bool>,
work_in_progress: Option<bool>,
) -> Result<(MergeProposal, bool), Error>
pub fn propose( &self, name: &str, description: &str, target_branch: Option<&GenericBranch>, forge: Option<Forge>, existing_proposal: Option<MergeProposal>, tags: Option<HashMap<String, RevisionId>>, labels: Option<Vec<String>>, overwrite_existing: Option<bool>, commit_message: Option<&str>, allow_collaboration: Option<bool>, title: Option<&str>, allow_empty: Option<bool>, reviewers: Option<Vec<String>>, owner: Option<&str>, auto_merge: Option<bool>, work_in_progress: Option<bool>, ) -> Result<(MergeProposal, bool), Error>
Propose the changes against the main branch
Sourcepub fn push_derived(
&self,
name: &str,
target_branch: Option<&GenericBranch>,
forge: Option<Forge>,
tags: Option<HashMap<String, RevisionId>>,
overwrite_existing: Option<bool>,
owner: Option<&str>,
) -> Result<(Box<dyn Branch>, Url), Error>
pub fn push_derived( &self, name: &str, target_branch: Option<&GenericBranch>, forge: Option<Forge>, tags: Option<HashMap<String, RevisionId>>, overwrite_existing: Option<bool>, owner: Option<&str>, ) -> Result<(Box<dyn Branch>, Url), Error>
Push a new derived branch
Push the specified tags to the main branch
Sourcepub fn push(
&self,
tags: Option<HashMap<String, RevisionId>>,
) -> Result<(), Error>
pub fn push( &self, tags: Option<HashMap<String, RevisionId>>, ) -> Result<(), Error>
Push the changes back to the main branch