6CDBBU3Z2KQRMC4KUE4HU7ST2RYXD5Y7GC24JFLYPDDIKNXHTJ4AC
let (rev, rev_stop) = if rev.contains("..") {
let mut split = rev.split("..");
let low = split.next().unwrap_or("");
let hi = split
.next()
.map(|s| if s == "" { "HEAD" } else { s })
.unwrap_or("HEAD");
// FIXME hi and low are supposed to be a version tag.
(hi, low)
} else {
(rev, "")
};
let iter: Vec<Rev<'_>> = Some(from_rev)
.into_iter()
.chain(helper.versions_from(&v).into_iter().rev().map(|v| v.into()))
.chain(Some(Rev("", None)))
.collect();
// TODO refactor this logic a bit to be less complicated.
// if we have HEAD!=version tag - version tag - ...
// or HEAD==version tag - version tag - ...
// we have to use different logic here, or in the `GitHelper::versions_from` method.
let is_head = from_rev.0 == "HEAD";
let iter = Some(from_rev).into_iter();
let iter = if is_head {
iter.chain(
Some(Rev(last_version.tag.as_str(), Some(&last_version.version)))
.into_iter(),
)
} else {
iter.chain(None)
};
let iter = iter
.chain(
helper
.versions_from(&last_version)
.into_iter()
.rev()
.take_while(|v| v.tag != rev_stop)
.map(|v| v.into()),
)
.chain(Some(Rev("", None)));
let iter: Vec<Rev<'_>> = iter.collect();
pub(crate) commit_url_format: String,
pub(crate) issue_url_format: String,
pub(crate) release_commit_message_format: String,
pub(crate) user_url_format: String,
/// `true` if `previousTag` and `currentTag` are truthy.
pub(crate) link_compare: bool,
handlebars
.register_template_string("commit_url_format", config.commit_url_format.as_str())?;
handlebars
.register_template_string("issue_url_format", config.issue_url_format.as_str())?;
handlebars.register_template_string(
"release_commit_message_format",
config.release_commit_message_format.as_str(),
)?;
handlebars.register_template_string("user_url_format", config.user_url_format.as_str())?;
let commit_url_format = self.handlebars.render("commit_url_format", &self.context)?;
let issue_url_format = self.handlebars.render("issue_url_format", &self.context)?;
let release_commit_message_format = self
.handlebars
.render("release_commit_message_format", &self.context)?;
let user_url_format = self.handlebars.render("user_url_format", &self.context)?;
let link_compare = self.context.current_tag != "" && self.context.previous_tag != "";
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Self::Git(ref e) => write!(f, "{}", e),
Self::Io(ref e) => write!(f, "{}", e),
Self::Template(ref e) => write!(f, "{}", e),
Self::Render(ref e) => write!(f, "{}", e),
Self::Check => write!(f, "check error"),
}
}