# # # patch "ChangeLog" # from [ef2f8665b8252bb10ff0a39ff3c12f13cd225c62] # to [04a1fe45e8f7a8eddfe8a9f7542acc5f0500d963] # # patch "examples/display_branches.lua" # from [f3f80b5d575e8709b7d9e6d9503b7e48c1d2b12c] # to [99b58337ac06bbe9d5211b4d68907d9f47e3137a] # ============================================================ --- ChangeLog ef2f8665b8252bb10ff0a39ff3c12f13cd225c62 +++ ChangeLog 04a1fe45e8f7a8eddfe8a9f7542acc5f0500d963 @@ -1,3 +1,8 @@ +2006-06-16 Richard Levitte + + * examples/display_branches.lua: Enhanced to display how many + times each branch cert appeared. + 2006-06-12 Derek Scherger * cmd_merging.cc (get_roster): allow no arguments and default to ============================================================ --- examples/display_branches.lua f3f80b5d575e8709b7d9e6d9503b7e48c1d2b12c +++ examples/display_branches.lua 99b58337ac06bbe9d5211b4d68907d9f47e3137a @@ -1,5 +1,7 @@ -- Lua snippet to display what branches were affected by revisions and certs --- that came into the database. I integrate it into my ~/.monotone/monotonerc +-- that came into the database. It will display each branch name and the +-- amount of times they each appeared. +-- I integrate it into my ~/.monotone/monotonerc -- /Richard Levitte -- -- Released as public domain @@ -18,19 +20,23 @@ function note_netsync_cert_received(rev_id,key,name,value,nonce) if name == "branch" then - netsync_branches[nonce][value] = 1 + if netsync_branches[nonce][value] == nil then + netsync_branches[nonce][value] = 1 + else + netsync_branches[nonce][value] = netsync_branches[nonce][value] + 1 + end end end function note_netsync_end(nonce) local first = true - for item, _ in pairs(netsync_branches[nonce]) + for item, amount in pairs(netsync_branches[nonce]) do if first then io.stderr:write("Affected branches:\n") first = false end - io.stderr:write(" "..item.."\n") + io.stderr:write(" ",item," (",amount,")\n") end netsync_branches[nonce] = nil end