diff options
author | sterni <sternenseemann@systemli.org> | 2021-12-18T18·48+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2021-12-18T19·16+0000 |
commit | 4c07a97af31ad9707ab82115228fd888dde6284e (patch) | |
tree | a5938363d16a0680becfe56adcc1c88fbca126f7 /tools/cheddar | |
parent | 8fb90b9e5eb58bc8e1820f4c8c8fd65bcc0031dd (diff) |
feat(tools/cheddar): shortlink depot revisions r/3293
r/3000 will now be shortlinked to show the commit in cgit. Going via atward probably doesn't make sense at this point, since the depot refs are not available in sourcegraph at all (for reasons I can't repeat). Switching to atward might be interesting when/if we introduce support for shortlinking // paths. Fixes: b/163 Change-Id: I57c1a7d02d881e4f8b3ee1f71755dd7930925dc4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4402 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'tools/cheddar')
-rw-r--r-- | tools/cheddar/src/lib.rs | 4 | ||||
-rw-r--r-- | tools/cheddar/src/tests.rs | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/cheddar/src/lib.rs b/tools/cheddar/src/lib.rs index e5d7aad1e62c..da0eace17556 100644 --- a/tools/cheddar/src/lib.rs +++ b/tools/cheddar/src/lib.rs @@ -78,6 +78,10 @@ lazy_static! { Shortlink { pattern: Regex::new(r#"\b(?P<type>b|cl)/(?P<dest>\d+)\b"#).unwrap(), replacement: "[$type/$dest](https://$type.tvl.fyi/$dest)", + }, + Shortlink { + pattern: Regex::new(r#"\br/(?P<dest>\d+)\b"#).unwrap(), + replacement: "[r/$dest](https://code.tvl.fyi/commit/?id=refs/r/$dest)", } ]; } diff --git a/tools/cheddar/src/tests.rs b/tools/cheddar/src/tests.rs index 5b7b1cc52a95..c82bba676746 100644 --- a/tools/cheddar/src/tests.rs +++ b/tools/cheddar/src/tests.rs @@ -79,6 +79,14 @@ fn highlights_cl_link() { } #[test] +fn highlights_r_link() { + expect_markdown( + "Fixed in r/3268.", + "<p>Fixed in <a href=\"https://code.tvl.fyi/commit/?id=refs/r/3268\">r/3268</a>.</p>", + ); +} + +#[test] fn highlights_multiple_shortlinks() { expect_markdown( "Please look at cl/420, b/123.", |