Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Have 'rad patch show {git-oid}' show the oid range of each revision
✗ CI failure Richard Levitte committed 1 month ago
commit 99f76542bc7a54c40d708d4d7e8d26291209ddea
parent 9fda8c6d8f8a00102a7983d9dfa9bc624c91daab
1 failed (1 total) View logs
2 files changed +22 -4
modified crates/radicle-cli/src/terminal/format.rs
@@ -32,11 +32,26 @@ pub fn node_id_human(node: &NodeId) -> Paint<String> {
    Paint::new(node.to_human())
}

+
/// Format a full git Oid.
+
pub fn oid_full(oid: impl Into<radicle::git::Oid>) -> Paint<String> {
+
    Paint::new(format!("{}", oid.into()))
+
}
+

/// Format a git Oid.
pub fn oid(oid: impl Into<radicle::git::Oid>) -> Paint<String> {
    Paint::new(format!("{:.7}", oid.into()))
}

+
/// Format a full git Oid range.
+
pub fn range_full(base: impl Into<radicle::git::Oid>, head: impl Into<radicle::git::Oid>) -> Paint<String> {
+
    Paint::new(format!("{}..{}", base.into(), head.into()))
+
}
+

+
/// Format a git Oid range.
+
pub fn range(base: impl Into<radicle::git::Oid>, head: impl Into<radicle::git::Oid>) -> Paint<String> {
+
    Paint::new(format!("{:.7}..{:.7}", base.into(), head.into()))
+
}
+

/// Wrap parenthesis around styled input, eg. `"input"` -> `"(input)"`.
pub fn parens<D: fmt::Display>(input: Paint<D>) -> Paint<String> {
    Paint::new(format!("({})", input.item)).with_style(input.style)
modified crates/radicle-cli/src/terminal/patch/timeline.rs
@@ -53,6 +53,8 @@ struct RevisionEntry<'a> {
    timestamp: cob::Timestamp,
    /// The id of the [`Revision`].
    id: RevisionId,
+
    /// The commit base of the [`Revision`].
+
    base: git::Oid,
    /// The commit head of the [`Revision`].
    head: git::Oid,
    /// All [`Update`]s that occurred on the [`Revision`].
@@ -100,6 +102,7 @@ impl<'a> RevisionEntry<'a> {
            author: Author::new(&revision.author().id, profile, verbose),
            timestamp: revision.timestamp(),
            id,
+
            base: *revision.base(),
            head: revision.head(),
            updates: updates.into_iter().map(|(_, up)| up).collect(),
        }
@@ -127,13 +130,13 @@ impl<'a> RevisionEntry<'a> {
        let line = Line::spaced([icon.into(), dim("Revision").into(), id]).space();

        let line = line
-
            .item(dim(if verbose { "with head" } else { "@" }))
+
            .item(dim(if verbose { "with range" } else { "@" }))
            .space();

        let line = line.item(secondary(if verbose {
-
            Paint::new(self.head.to_string())
+
            range_full(self.base, self.head)
        } else {
-
            oid(self.head)
+
            range(self.base, self.head)
        }));

        iter::once(
@@ -169,7 +172,7 @@ impl Update<'_> {

        match self {
            Update::Reviewed { review } => {
-
                let by = " ".repeat(if verbose { 0 } else { 13 }) + "by";
+
                let by = " ".repeat(if verbose { 0 } else { 22 }) + "by";

                let (symbol, verb) = match review.verdict() {
                    Some(Verdict::Accept) => (PREFIX_SUCCESS, positive("accepted")),