@@ -39,7 +39,7 @@ impl crate::Repository {
3939 /// Obtain the best merge-base between commit `one` and `two`, or fail if there is none.
4040 ///
4141 /// # Performance
42- /// For repeated calls, prefer [`merge_base_with_cache()`](crate::Repository::merge_base_with_cache ()).
42+ /// For repeated calls, prefer [`merge_base_with_cache()`](crate::Repository::merge_base_with_graph ()).
4343 /// Also be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
4444 #[ cfg( feature = "revision" ) ]
4545 pub fn merge_base (
@@ -60,47 +60,44 @@ impl crate::Repository {
6060 }
6161
6262 /// Obtain the best merge-base between commit `one` and `two`, or fail if there is none, providing a
63- /// commit-graph `cache ` to potentially greatly accelerate the operation.
63+ /// commit-graph `graph ` to potentially greatly accelerate the operation by reusing graphs from previous runs .
6464 ///
6565 /// # Performance
6666 /// Be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
6767 #[ cfg( feature = "revision" ) ]
68- pub fn merge_base_with_cache (
68+ pub fn merge_base_with_graph (
6969 & self ,
7070 one : impl Into < gix_hash:: ObjectId > ,
7171 two : impl Into < gix_hash:: ObjectId > ,
72- cache : Option < & gix_commitgraph :: Graph > ,
73- ) -> Result < Id < ' _ > , super :: merge_base_with_cache :: Error > {
72+ graph : & mut gix_revwalk :: Graph < ' _ , ' _ , gix_revwalk :: graph :: Commit < gix_revision :: merge_base :: Flags > > ,
73+ ) -> Result < Id < ' _ > , super :: merge_base_with_graph :: Error > {
7474 use crate :: prelude:: ObjectIdExt ;
7575 let one = one. into ( ) ;
7676 let two = two. into ( ) ;
77- let mut graph = self . revision_graph ( cache) ;
78- let bases = gix_revision:: merge_base ( one, & [ two] , & mut graph) ?. ok_or (
79- super :: merge_base_with_cache:: Error :: NotFound {
77+ let bases =
78+ gix_revision:: merge_base ( one, & [ two] , graph) ?. ok_or ( super :: merge_base_with_graph:: Error :: NotFound {
8079 first : one,
8180 second : two,
82- } ,
83- ) ?;
81+ } ) ?;
8482 Ok ( bases[ 0 ] . attach ( self ) )
8583 }
8684
8785 /// Obtain all merge-bases between commit `one` and `others`, or an empty list if there is none, providing a
88- /// commit-graph `cache ` to potentially greatly accelerate the operation.
86+ /// commit-graph `graph ` to potentially greatly accelerate the operation.
8987 ///
9088 /// # Performance
9189 /// Be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
9290 #[ doc( alias = "merge_bases_many" , alias = "git2" ) ]
9391 #[ cfg( feature = "revision" ) ]
94- pub fn merge_bases_many_with_cache (
92+ pub fn merge_bases_many_with_graph (
9593 & self ,
9694 one : impl Into < gix_hash:: ObjectId > ,
9795 others : & [ gix_hash:: ObjectId ] ,
98- cache : Option < & gix_commitgraph :: Graph > ,
96+ graph : & mut gix_revwalk :: Graph < ' _ , ' _ , gix_revwalk :: graph :: Commit < gix_revision :: merge_base :: Flags > > ,
9997 ) -> Result < Vec < Id < ' _ > > , gix_revision:: merge_base:: Error > {
10098 use crate :: prelude:: ObjectIdExt ;
10199 let one = one. into ( ) ;
102- let mut graph = self . revision_graph ( cache) ;
103- Ok ( gix_revision:: merge_base ( one, others, & mut graph) ?
100+ Ok ( gix_revision:: merge_base ( one, others, graph) ?
104101 . unwrap_or_default ( )
105102 . into_iter ( )
106103 . map ( |id| id. attach ( self ) )
0 commit comments