@@ -1073,14 +1073,8 @@ fn builtin_commit_methods<'repo>() -> CommitTemplateBuildMethodFnMap<'repo, Comm
10731073 . keyword_cache
10741074 . bookmarks_index ( language. repo )
10751075 . clone ( ) ;
1076- let out_property = self_property. map ( move |commit| {
1077- index
1078- . get ( commit. id ( ) )
1079- . iter ( )
1080- . filter ( |commit_ref| commit_ref. is_local ( ) )
1081- . cloned ( )
1082- . collect_vec ( )
1083- } ) ;
1076+ let out_property =
1077+ self_property. map ( move |commit| collect_local_refs ( index. get ( commit. id ( ) ) ) ) ;
10841078 Ok ( out_property. into_dyn_wrapped ( ) )
10851079 } ,
10861080 ) ;
@@ -1092,14 +1086,8 @@ fn builtin_commit_methods<'repo>() -> CommitTemplateBuildMethodFnMap<'repo, Comm
10921086 . keyword_cache
10931087 . bookmarks_index ( language. repo )
10941088 . clone ( ) ;
1095- let out_property = self_property. map ( move |commit| {
1096- index
1097- . get ( commit. id ( ) )
1098- . iter ( )
1099- . filter ( |commit_ref| commit_ref. is_remote ( ) )
1100- . cloned ( )
1101- . collect_vec ( )
1102- } ) ;
1089+ let out_property =
1090+ self_property. map ( move |commit| collect_remote_refs ( index. get ( commit. id ( ) ) ) ) ;
11031091 Ok ( out_property. into_dyn_wrapped ( ) )
11041092 } ,
11051093 ) ;
@@ -1113,6 +1101,26 @@ fn builtin_commit_methods<'repo>() -> CommitTemplateBuildMethodFnMap<'repo, Comm
11131101 Ok ( out_property. into_dyn_wrapped ( ) )
11141102 } ,
11151103 ) ;
1104+ map. insert (
1105+ "local_tags" ,
1106+ |language, _diagnostics, _build_ctx, self_property, function| {
1107+ function. expect_no_arguments ( ) ?;
1108+ let index = language. keyword_cache . tags_index ( language. repo ) . clone ( ) ;
1109+ let out_property =
1110+ self_property. map ( move |commit| collect_local_refs ( index. get ( commit. id ( ) ) ) ) ;
1111+ Ok ( out_property. into_dyn_wrapped ( ) )
1112+ } ,
1113+ ) ;
1114+ map. insert (
1115+ "remote_tags" ,
1116+ |language, _diagnostics, _build_ctx, self_property, function| {
1117+ function. expect_no_arguments ( ) ?;
1118+ let index = language. keyword_cache . tags_index ( language. repo ) . clone ( ) ;
1119+ let out_property =
1120+ self_property. map ( move |commit| collect_remote_refs ( index. get ( commit. id ( ) ) ) ) ;
1121+ Ok ( out_property. into_dyn_wrapped ( ) )
1122+ } ,
1123+ ) ;
11161124 map. insert (
11171125 "git_refs" ,
11181126 |language, _diagnostics, _build_ctx, self_property, function| {
@@ -1823,6 +1831,22 @@ fn collect_distinct_refs(commit_refs: &[Rc<CommitRef>]) -> Vec<Rc<CommitRef>> {
18231831 . collect ( )
18241832}
18251833
1834+ fn collect_local_refs ( commit_refs : & [ Rc < CommitRef > ] ) -> Vec < Rc < CommitRef > > {
1835+ commit_refs
1836+ . iter ( )
1837+ . filter ( |commit_ref| commit_ref. is_local ( ) )
1838+ . cloned ( )
1839+ . collect ( )
1840+ }
1841+
1842+ fn collect_remote_refs ( commit_refs : & [ Rc < CommitRef > ] ) -> Vec < Rc < CommitRef > > {
1843+ commit_refs
1844+ . iter ( )
1845+ . filter ( |commit_ref| commit_ref. is_remote ( ) )
1846+ . cloned ( )
1847+ . collect ( )
1848+ }
1849+
18261850/// Wrapper to render ref/remote name in revset syntax.
18271851#[ derive( Clone , Debug , Eq , PartialEq , serde:: Serialize ) ]
18281852#[ serde( transparent) ]
0 commit comments