From e2b056eff9be5d8c5a1947dc354f36ae5dd28886 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 18 Jan 2018 01:25:58 +0100 Subject: [PATCH] Rewrite ++dedupe to roll instead of skim, and fix issue where it wasn't accounting for different cases correctly. ie, it wasn't making sure that the found case was *actually* before the new request's case. --- sys/vane/clay.hoon | 66 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/sys/vane/clay.hoon b/sys/vane/clay.hoon index 8f7c09d9e..18bf3d127 100644 --- a/sys/vane/clay.hoon +++ b/sys/vane/clay.hoon @@ -696,35 +696,61 @@ :: ++ dedupe :: find existing alias |= rov/rove ^- rove - =; ros/(list rove) ?+(ros rov {^ $~} i.ros) + =; ron/(unit rove) (fall ron rov) ?- -.rov $sing ~ $next - ?~ (case-to-aeon:ze q.p.rov) ~ - %+ skim ~(tap in ~(key by qyx)) - |= a=rove ^- ? - ?& ?=($next -.a) - =(p.a p.rov(q q.p.a)) - ?=(^ (case-to-aeon:ze q.p.a)) + =+ aey=(case-to-aeon:ze q.p.rov) + ?~ aey ~ + %+ roll ~(tap in ~(key by qyx)) + |= {hav/rove res/(unit rove)} + ?^ res res + =- ?:(- `hav ~) + ?& ?=($next -.hav) + =(p.hav p.rov(q q.p.hav)) + :: + :: only a match if this request is before + :: or at our starting case. + =+ hay=(case-to-aeon:ze q.p.hav) + ?~(hay | (lte u.hay u.aey)) == :: $mult - ?~ (case-to-aeon:ze q.p.rov) ~ - %+ skim ~(tap in ~(key by qyx)) - |= a=rove ^- ? - ?& ?=($mult -.a) - =(p.a p.rov(q q.p.a)) - ?=(^ (case-to-aeon:ze q.p.a)) + =+ aey=(case-to-aeon:ze q.p.rov) + ?~ aey ~ + %+ roll ~(tap in ~(key by qyx)) + |= {hav/rove res/(unit rove)} + ?^ res res + =- ?:(- `hav ~) + ?& ?=($mult -.hav) + =(p.hav p.rov(q q.p.hav)) + :: + :: only a match if this request is before + :: or at our starting case, and it has been + :: tested at least that far. + =+ hay=(case-to-aeon:ze q.p.hav) + ?& ?=(^ hay) + (lte u.hay u.aey) + ?=(^ q.hav) + (gte u.q.hav u.aey) + == == :: $many - ?~ (case-to-aeon:ze p.q.rov) ~ - %+ skim ~(tap in ~(key by qyx)) - |= a=rove ^- ? - ?& ?=($many -.a) - =(a rov(p.q p.q.a)) - ?=(^ (case-to-aeon:ze p.q.a)) - == + =+ aey=(case-to-aeon:ze p.q.rov) + ?~ aey ~ + %+ roll ~(tap in ~(key by qyx)) + |= {hav/rove res/(unit rove)} + ?^ res res + =- ?:(- `hav ~) + ?& ?=($many -.hav) + =(hav rov(p.q p.q.hav)) + :: + :: only a match if this request is before + :: or at our starting case. + =+ hay=(case-to-aeon:ze p.q.hav) + ?~(hay | (lte u.hay u.aey)) + == == :: :: Takes a list of changed paths and finds those paths that are inside a