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 <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
sterni 2021-12-18 19:48:46 +01:00 committed by clbot
parent 8fb90b9e5e
commit 4c07a97af3
2 changed files with 12 additions and 0 deletions

View file

@ -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)",
}
];
}

View file

@ -78,6 +78,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(