By | fr33domlover |
At | 2016-04-18 |
Title | Fix minimalCommitSet cod to work by the algorithm |
Description |
Edit file src/Network/Git/Fetch/Packfile.hs 0 → 0
- 80 - 81 --TODO FIX CODE ACCORDING TO THE STEPS ABOVE, CURRENTLY THE CODE IS WRONG
- 81 :: [ObjId]
- 82 -> [ObjId]
- 83 -> [ObjId]
- 84 -> CommitGraph g -- graph of ALL commits, i.e. made of /all/ branches
+ 79 :: CommitGraph g -- graph of ALL commits, i.e. made of /all/ branches
+ 78 -> Maybe (Depth, HashMap Node Depth)
+ 79 -> [Node]
+ 80 -> [ObjId]
+ 81 -> [ObjId]
- 88 minimalCommitSet wants shallows haves graph objmap =
+ 87 minimalCommitSet graph objmap mdepths wants shallows haves =
… … … … - 118 -- TODO CONTINUE use DFS to make a list of these labeled nodes, and
- 119 -- then pick just the Missing ones. Try to do the
- 120 -- filter-by-depth in the DFS itself, otherwise do
- 121 -- another pass later to filter using the depth map
- 122 - 123 - 124 in [(n, (r, c)) | (n, (r, c, Missing)) <- labNodes graph'']
+ 117 included dmap thresh n =
+ 118 case M.lookup n dmap of
+ 119 Nothing -> True
+ 120 Just d -> d <= thresh
+ 121 next = case mdepths of
+ 122 Nothing -> suc'
+ 123 Just (thresh, dmap) -> filter (included dmap thresh) . suc'
+ 124 wantsWithInclDeps = xdfsWith next node' wants graph''
+ 125 subGraph = subgraph wantsWithInclDeps graph''
+ 126 -- (5) List the Missing nodes in the subgraph
+ 127 in [(n, (r, c)) | (n, (r, c, Missing)) <- labNodes subGraph]
… … … …