Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: List patches by last update
Slack Coder committed 3 years ago
commit 3e2cf83f9b3cc5753e75c44fc58d293d011e1d59
parent 091154faed43debcc159e7e74120e43ef43f0144
3 files changed +17 -9
modified radicle-cli/examples/rad-patch.md
@@ -42,7 +42,7 @@ It will now be listed as one of the project's open patches.
```
$ rad patch
╭──────────────────────────────────────────────────────────────────────────────────────────────╮
-
│ ●  ID       Title                      Author                  Head     +   -   Opened       │
+
│ ●  ID       Title                      Author                  Head     +   -   Updated      │
├──────────────────────────────────────────────────────────────────────────────────────────────┤
│ ●  de3096d  Define power requirements  z6MknSL…StBU8Vi  (you)  3e674d1  +0  -0  4 months ago │
╰──────────────────────────────────────────────────────────────────────────────────────────────╯
modified radicle-cli/examples/workflow/4-patching-contributor.md
@@ -42,7 +42,7 @@ It will now be listed as one of the project's open patches.
```
$ rad patch
╭──────────────────────────────────────────────────────────────────────────────────────────────╮
-
│ ●  ID       Title                      Author                  Head     +   -   Opened       │
+
│ ●  ID       Title                      Author                  Head     +   -   Updated      │
├──────────────────────────────────────────────────────────────────────────────────────────────┤
│ ●  5f0a547  Define power requirements  z6Mkt67…v4N1tRk  (you)  3e674d1  +0  -0  4 months ago │
╰──────────────────────────────────────────────────────────────────────────────────────────────╯
modified radicle-cli/src/commands/patch/list.rs
@@ -52,17 +52,20 @@ pub fn run(
        term::format::bold(String::from("Head")).into(),
        term::format::bold(String::from("+")).into(),
        term::format::bold(String::from("-")).into(),
-
        term::format::bold(String::from("Opened")).into(),
+
        term::format::bold(String::from("Updated")).into(),
    ]);
    table.divider();

    let me = *profile.id();
    all.sort_by(|(id1, p1), (id2, p2)| {
        let is_me = (p2.author().id().as_key() == &me).cmp(&(p1.author().id().as_key() == &me));
-
        let by_timestamp = p2.timestamp().cmp(&p1.timestamp());
        let by_id = id1.cmp(id2);
+
        let by_rev_time = p2
+
            .latest()
+
            .map(|(_, r)| r.timestamp())
+
            .cmp(&p1.latest().map(|(_, r)| r.timestamp()));

-
        is_me.then(by_timestamp).then(by_id)
+
        is_me.then(by_rev_time).then(by_id)
    });

    let mut errors = Vec::new();
@@ -118,10 +121,15 @@ pub fn row(
        term::format::secondary(term::format::oid(revision.head())).into(),
        term::format::positive(format!("+{}", stats.insertions())).into(),
        term::format::negative(format!("-{}", stats.deletions())).into(),
-
        term::format::timestamp(&patch.timestamp())
-
            .dim()
-
            .italic()
-
            .into(),
+
        term::format::timestamp(
+
            &patch
+
                .latest()
+
                .map(|(_, r)| r.timestamp())
+
                .unwrap_or_default(),
+
        )
+
        .dim()
+
        .italic()
+
        .into(),
    ])
}