From 4c07a97af31ad9707ab82115228fd888dde6284e Mon Sep 17 00:00:00 2001 From: sterni Date: Sat, 18 Dec 2021 19:48:46 +0100 Subject: feat(tools/cheddar): shortlink depot revisions 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 Reviewed-by: tazjin --- tools/cheddar/src/lib.rs | 4 ++++ tools/cheddar/src/tests.rs | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'tools/cheddar/src') 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(?Pb|cl)/(?P\d+)\b"#).unwrap(), replacement: "[$type/$dest](https://$type.tvl.fyi/$dest)", + }, + Shortlink { + pattern: Regex::new(r#"\br/(?P\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 @@ -78,6 +78,14 @@ fn highlights_cl_link() { ); } +#[test] +fn highlights_r_link() { + expect_markdown( + "Fixed in r/3268.", + "

Fixed in r/3268.

", + ); +} + #[test] fn highlights_multiple_shortlinks() { expect_markdown( -- cgit 1.4.1