diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/vcs.ml | 8 | ||||
| -rw-r--r-- | lib/vcs.mli | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/vcs.ml b/lib/vcs.ml index 6668d07483..e2513b1c1e 100644 --- a/lib/vcs.ml +++ b/lib/vcs.ml @@ -55,10 +55,10 @@ module type S = sig val set_info : ('k,'e,'info) t -> id -> 'info -> ('k,'e,'info) t val get_info : ('k,'e,'info) t -> id -> 'info option - val gc : ('k,'e,'info) t -> ('k,'e,'info) t - module NodeSet : Set.S with type elt = id + val gc : ('k,'e,'info) t -> ('k,'e,'info) t * NodeSet.t + val reachable : ('k,'e,'info) t -> id -> NodeSet.t module Dag : Dag.S with type node = id @@ -187,7 +187,7 @@ let gc vcs = let alive = BranchMap.fold (fun b { pos } s -> closure s vcs.dag pos) vcs.heads Dag.NodeSet.empty in - { vcs with dag = - Dag.del_nodes vcs.dag (Dag.NodeSet.diff (Dag.all_nodes vcs.dag) alive) } + let dead = Dag.NodeSet.diff (Dag.all_nodes vcs.dag) alive in + { vcs with dag = Dag.del_nodes vcs.dag dead }, dead end diff --git a/lib/vcs.mli b/lib/vcs.mli index 72feae5dc4..6c3571a082 100644 --- a/lib/vcs.mli +++ b/lib/vcs.mli @@ -70,16 +70,17 @@ module type S = sig val set_info : ('k,'e,'info) t -> id -> 'info -> ('k,'e,'info) t val get_info : ('k,'e,'info) t -> id -> 'info option - val gc : ('k,'e,'info) t -> ('k,'e,'info) t - module NodeSet : Set.S with type elt = id + + (* Removes all unreachable nodes and returns them *) + val gc : ('k,'e,'info) t -> ('k,'e,'info) t * NodeSet.t val reachable : ('k,'e,'info) t -> id -> NodeSet.t (* read only dag *) module Dag : Dag.S with type node = id val dag : ('kind,'diff,'info) t -> ('diff,'info,id) Dag.t - + val create_cluster : ('k,'e,'i) t -> id list -> id -> ('k,'e,'i) t val cluster_of : ('k,'e,'i) t -> id -> id Dag.Cluster.t option val delete_cluster : ('k,'e,'i) t -> id Dag.Cluster.t -> ('k,'e,'i) t |
