|
|
|
@ -22,7 +22,7 @@ impl Repository for GitRepository {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn checkout(&self, name: &str) -> Result<(), Error> {
|
|
|
|
|
fn checkout(&self, name: &str) -> Result<String, Error> {
|
|
|
|
|
let target_ref = self.repo.resolve_reference_from_short_name(name)?;
|
|
|
|
|
let ref_name = target_ref
|
|
|
|
|
.name()
|
|
|
|
@ -31,24 +31,24 @@ impl Repository for GitRepository {
|
|
|
|
|
self.checkout_ref(ref_name)?;
|
|
|
|
|
self.repo.set_head(ref_name)?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
Ok(ref_name.into())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn stash_changes(&mut self, profile_name: &str) -> Result<bool, Error> {
|
|
|
|
|
fn stash_changes(&mut self, name: &str) -> Result<bool, Error> {
|
|
|
|
|
if self.uncommitted_changes()?.is_empty() {
|
|
|
|
|
return Ok(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let repo_signature = self.repo.signature()?;
|
|
|
|
|
let stash_name = self.stash_name(profile_name);
|
|
|
|
|
let stash_name = self.stash_name(name);
|
|
|
|
|
self.repo.stash_save(&repo_signature, &stash_name, None)?;
|
|
|
|
|
|
|
|
|
|
Ok(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn unstash_changes(&mut self, profile_name: &str) -> Result<bool, Error> {
|
|
|
|
|
fn unstash_changes(&mut self, name: &str) -> Result<bool, Error> {
|
|
|
|
|
let mut found_stash = None;
|
|
|
|
|
let stash_name = self.stash_name(profile_name);
|
|
|
|
|
let stash_name = self.stash_name(name);
|
|
|
|
|
|
|
|
|
|
self.repo.stash_foreach(|idx, name, _| {
|
|
|
|
|
if name.contains(&stash_name) {
|
|
|
|
@ -116,8 +116,8 @@ impl GitRepository {
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn stash_name(&mut self, profile_name: &str) -> String {
|
|
|
|
|
format!("cargo-vcs_{}_{}", self.machine_id, profile_name)
|
|
|
|
|
fn stash_name(&mut self, name: &str) -> String {
|
|
|
|
|
format!("cargo-vcs_{}_{}", self.machine_id, name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn match_tag(&self) -> Result<String, Error> {
|
|
|
|
|