Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli/patch: Show Commit Ranges of Revisions
✗ CI failure Richard Levitte committed 1 month ago
commit 1e394cc7e49f0fc0978ac62ade04c1b1240a6808
parent d72eafbb54c7740d42735093b448266660d6a316
1 failed (1 total) View logs
1 file changed +9 -6
modified crates/radicle-cli/src/terminal/patch/timeline.rs
@@ -53,7 +53,9 @@ struct RevisionEntry<'a> {
    timestamp: cob::Timestamp,
    /// The id of the [`Revision`].
    id: RevisionId,
-
    /// The commit head of the [`Revision`].
+
    /// The base commit of the [`Revision`].
+
    base: git::Oid,
+
    /// The head commit of the [`Revision`].
    head: git::Oid,
    /// All [`Update`]s that occurred on the [`Revision`].
    updates: Vec<Update<'a>>,
@@ -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(),
        }
@@ -113,7 +116,7 @@ impl<'a> RevisionEntry<'a> {
        use term::{format::*, *};

        let id: Label = if verbose {
-
            self.id.to_string().into()
+
            oid_long(self.id).into()
        } else {
            oid(self.id).into()
        };
@@ -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_long(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")),