Permalink
Browse files

[feature] opages: added a comment on revisions build

  • Loading branch information...
1 parent 3737294 commit d7e149d3d80571e5ad64ab2b33e72ec17d1fcb23 @Aqua-Ye Aqua-Ye committed Jul 12, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 OPAges/src/page.opa
View
@@ -773,18 +773,23 @@ Page = {{
- its parent revision
- its sons revision
+ /!\ Note that the keys in DB starts at 1 and not 0 /!\
+ -- Those who do not have parents have the -1 parent, aka root --
+
@TODO: should be cached maybe? */
//do Log.info("history", "{hist}")
make_map(i, (author, date, parent), acc) =
- i = i+1
+ i = i+1 // Use the same key as in DB
//do jlog("map {i} - {parent}")
acc = IntMap.add(i, (author, date, parent, []), acc)
match IntMap.get(parent, acc)
{some=(author, date, par, sons)} -> IntMap.add(parent, (author, date, par, [i|sons]), acc)
_ -> IntMap.add(parent, (author, date, -1, [i]), acc)
map = List.foldi(make_map, hist, IntMap.empty)
+ do Log.info("map", "-- begin revision map")
do IntMap.iter(k, v -> Log.info("map", "{k} -> {v}"), map)
+ do Log.info("map", "-- end revision map")
/* Build one revision of the file for the select input */
build_rev(key, (author, date, parent, sons), (acc, pad)) =

0 comments on commit d7e149d

Please sign in to comment.