Skip to content

Commit

Permalink
fix: keep up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
chaaz committed Jul 28, 2021
1 parent ba4eb70 commit 50b6858
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,7 @@ fn expand_root(root: Option<&String>, sub: &SubExtent) -> Option<String> {
Some(subdir) => Some(Path::new(root).join(subdir).to_string_lossy().into_owned()),
None => Some(Path::new(root).to_string_lossy().into_owned())
},
None => match sub.dir() {
Some(subdir) => Some(Path::new(subdir).to_string_lossy().into_owned()),
None => None
}
None => sub.dir().as_ref().map(|subdir| Path::new(subdir).to_string_lossy().into_owned())
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use log::trace;
use serde::Deserialize;
use std::cmp::{max, Ordering};
use std::collections::{HashMap, HashSet, VecDeque};
use std::convert::identity;
use std::iter::{empty, once};
use std::path::{Path, PathBuf};

Expand Down Expand Up @@ -48,7 +47,7 @@ impl Mono {

let user_prefs = read_env_prefs()?;

Ok(Mono { user_prefs, current, next, last_commits, repo })
Ok(Mono { current, next, last_commits, repo, user_prefs })
}

pub fn check_branch(&self) -> std::result::Result<(), (String, String)> {
Expand Down Expand Up @@ -644,7 +643,7 @@ fn find_old_tags<'s, I: Iterator<Item = &'s Project>>(projects: I, prev_tag: &st
proj_ids.insert(proj.id().clone());
for fnmatch in tag_fnmatches(proj) {
trace!("Searching tags for proj {} matching \"{}\".", proj.id(), fnmatch);
for tag in repo.tag_names(Some(fnmatch.as_str()))?.iter().filter_map(identity) {
for tag in repo.tag_names(Some(fnmatch.as_str()))?.iter().flatten() {
let oid = repo.revparse_oid(FromTag::new(&format!("{}^{{}}", tag), false))?;
trace!("Found proj {} tag {} at {}.", proj.id(), tag, oid);
let by_id = by_proj_oid.entry(proj.id().clone()).or_insert_with(HashMap::new);
Expand Down
4 changes: 2 additions & 2 deletions src/scan/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<'de> Visitor<'de> for NthElement {
self.trace.lock().unwrap().set_active(false);
r
} else {
let next = pop(std::mem::replace(&mut self.remains, Vec::new()), self.trace.clone());
let next = pop(std::mem::take(&mut self.remains), self.trace.clone());
map.next_value_seed(next)?
};

Expand Down Expand Up @@ -120,7 +120,7 @@ impl<'de> Visitor<'de> for NthElement {
self.trace.lock().unwrap().set_active(false);
r
} else {
let next = pop(std::mem::replace(&mut self.remains, Vec::new()), self.trace.clone());
let next = pop(std::mem::take(&mut self.remains), self.trace.clone());
seq.next_element_seed(next)?.ok_or_else(|| de::Error::invalid_length(n, &self))?
};

Expand Down
4 changes: 2 additions & 2 deletions src/scan/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'de> Visitor<'de> for NthElement {
let nth = if self.remains.is_empty() {
map.next_value()?
} else {
let next = pop(std::mem::replace(&mut self.remains, Vec::new()));
let next = pop(std::mem::take(&mut self.remains));
map.next_value_seed(next)?
};

Expand Down Expand Up @@ -107,7 +107,7 @@ impl<'de> Visitor<'de> for NthElement {
let nth = if self.remains.is_empty() {
seq.next_element()?.ok_or_else(|| de::Error::invalid_length(n, &self))?
} else {
let next = pop(std::mem::replace(&mut self.remains, Vec::new()));
let next = pop(std::mem::take(&mut self.remains));
seq.next_element_seed(next)?.ok_or_else(|| de::Error::invalid_length(n, &self))?
};

Expand Down
3 changes: 1 addition & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ impl CommitState {

if self.advance_prev {
fill_from_old(&self.old_tags, &mut self.write.new_tags);
let msg =
serde_json::to_string(&PrevTagMessage::new(std::mem::replace(&mut self.write.new_tags, HashMap::new())))?;
let msg = serde_json::to_string(&PrevTagMessage::new(std::mem::take(&mut self.write.new_tags)))?;
repo.update_tag_head_anno(&self.prev_tag, &msg)?;
}

Expand Down

0 comments on commit 50b6858

Please sign in to comment.