[−][src]Struct libquilt::Repo
This is the main interface to a quilt
repository.
Be aware that any modifications made to a repository will not be saved unless Repo::write
is called.
Fields
root_dir: PathBuf
The path to the root directory of the repository.
repo_dir: PathBuf
The path to the directory where all of quilt's data is stored.
db_path: PathBuf
The path to the database containing all the history, and so on.
current_branch: String
The path to the directory where patches are stored. The name of the current branch.
Methods
impl Repo
[src]
pub fn open<P: AsRef<Path>>(dir: P) -> Result<Repo, Error>
[src]
Opens the existing repository with the given root directory.
pub fn init<P: AsRef<Path>>(path: P) -> Result<Repo, Error>
[src]
Creates a repo at the given path (which should point to a directory).
pub fn init_tmp() -> Repo
[src]
Creates a temporary in-memory repo that cannot be stored.
pub fn clear(&mut self, branch: &str) -> Result<(), Error>
[src]
Clears a branch, removing all of its patches.
pub fn write(&self) -> Result<(), Error>
[src]
Persists the repository to disk.
Any modifications that were previously made become permanent.
pub fn graggle<'a>(&'a self, branch: &str) -> Result<Graggle<'a>, Error>
[src]
Returns a read-only view to the data associated with a branch.
pub fn file(&self, branch: &str) -> Result<File, Error>
[src]
Retrieves the data associated with a branch, assuming that it represents a totally ordered file.
pub fn contents(&self, id: &NodeId) -> &[u8]
[src]
Retrieves the contents associated with a node.
pub fn open_patch(&self, id: &PatchId) -> Result<Patch, Error>
[src]
Opens a patch.
The patch must already be known to the repository, either because it was created locally
(i.e. with Repo::create_patch
) or because it was (possibly created elsewhere but)
registered locally with Repo::register_patch
.
pub fn open_patch_data(&self, id: &PatchId) -> Result<&[u8], Error>
[src]
Returns the data associated with a patch.
Currently, this data consists of the patch's contents serialized as YAML, but that isn't
guaranteed. What is guaranteed is that the return value of this function is of the same
format as the argument to Repo::register_patch
.
pub fn register_patch(&mut self, patch_data: &[u8]) -> Result<PatchId, Error>
[src]
Introduces a patch to the repository.
After registering a patch, its data will be stored in the repository and you will be able to access it by its ID.
pub fn apply_patch(
&mut self,
branch: &str,
patch_id: &PatchId
) -> Result<Vec<PatchId>, Error>
[src]
&mut self,
branch: &str,
patch_id: &PatchId
) -> Result<Vec<PatchId>, Error>
Applies a patch (and all its dependencies) to a branch.
Returns a list of all the patches that were applied.
pub fn unapply_patch(
&mut self,
branch: &str,
patch_id: &PatchId
) -> Result<Vec<PatchId>, Error>
[src]
&mut self,
branch: &str,
patch_id: &PatchId
) -> Result<Vec<PatchId>, Error>
Unapplies a patch (and everything that depends on it) to a branch.
Returns a list of all the patches that were unapplied.
pub fn all_patches(
&self
) -> impl Iterator<Item = &PatchId>
[src]
&self
) -> impl Iterator<Item = &PatchId>
Returns an iterator over all known patches, applied or otherwise.
pub fn patches(
&self,
branch: &str
) -> impl Iterator<Item = &PatchId>
[src]
&self,
branch: &str
) -> impl Iterator<Item = &PatchId>
Returns an iterator over all of the patches being used in a branch.
pub fn patch_deps(
&self,
patch: &PatchId
) -> impl Iterator<Item = &PatchId>
[src]
&self,
patch: &PatchId
) -> impl Iterator<Item = &PatchId>
Returns an iterator over all direct dependencies of the given patch.
pub fn patch_rev_deps(
&self,
patch: &PatchId
) -> impl Iterator<Item = &PatchId>
[src]
&self,
patch: &PatchId
) -> impl Iterator<Item = &PatchId>
Returns an iterator over all direct dependents of the given patch.
pub fn create_patch(
&mut self,
author: &str,
msg: &str,
changes: Changes
) -> Result<PatchId, Error>
[src]
&mut self,
author: &str,
msg: &str,
changes: Changes
) -> Result<PatchId, Error>
Creates a new patch with the given changes and metadata and returns its ID.
The newly created patch will be automatically registered in the current repository, so
there is no need to call Repo::register_patch
on it.
pub fn branches(
&self
) -> impl Iterator<Item = &str>
[src]
&self
) -> impl Iterator<Item = &str>
Returns an iterator over the names of all branches.
pub fn create_branch(&mut self, branch: &str) -> Result<(), Error>
[src]
Creates a new, empty branch.
pub fn clone_branch(&mut self, from: &str, to: &str) -> Result<(), Error>
[src]
Copies data to a new branch (which must not already exist).
pub fn delete_branch(&mut self, branch: &str) -> Result<(), Error>
[src]
Deletes the branch named branch
.
pub fn switch_branch(&mut self, branch: &str) -> Result<(), Error>
[src]
Changes the current branch to the one named branch
(which must already exist).
pub fn diff(&self, branch: &str, file: &[u8]) -> Result<Diff, Error>
[src]
If the given branch represents a totally ordered file (i.e. if Repo::file
returns
something), returns the result of diffing the given branch against file
.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self