monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] A small Lua hack to know what branches were affected...


From: Richard Levitte - VMS Whacker
Subject: [Monotone-devel] A small Lua hack to know what branches were affected...
Date: Sun, 23 Apr 2006 18:52:54 +0200 (CEST)

Hi,

there have been numerous times when I've pulled and wanted to know
what branches were affected, if it's worth it to try an updated or
not.  The new note_netsync_* Lua hooks provide exactly the kind of
framework to make it easy, so I did.

A somewhat typical (as typical as Swedish is for you :-)) output is
for example (I go this just a few moments ago):

: ; mtn pull 
mtn-0.26: ansluter till off.net
mtn-0.26: letar efter saker att synkronisera:
mtn-0.26: certifikat | nycklar | revisioner
mtn-0.26:     17 702 |      27 |      5 858
mtn-0.26:    byte in |    byte ut | cert in | rev in
mtn-0.26:    43,1 Ki |    31,6 Ki |   16/16 |    4/4
mtn-0.26: lyckat utbyte med off.net
Affected branches:
  net.venge.monotone.cvsimport-branch-reconstruction
  net.venge.monotone.guitone.qt4

Code attached, enjoy!

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

-- 
Richard Levitte                         address@hidden
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
-- Lua snippet to display what branches were affected by revisions and certs
-- that came into the database.  I integrate it into my ~/.monotone/monotonerc
-- /Richard Levitte
--
-- Released as public domain

netsync_branches = {}
function note_netsync_start(nonce)
   netsync_branches[nonce] = {}
end

function note_netsync_revision_received(new_id,revision,certs,nonce)
   for _, item in pairs(certs)
   do
      note_netsync_cert_received(new_id,item.key,item.name,item.value,nonce)
   end
end

function note_netsync_cert_received(rev_id,key,name,value,nonce)
   if name == "branch" then
      netsync_branches[nonce][value] = 1
   end
end

function note_netsync_end(nonce)
   local first = true
   for item, _ in pairs(netsync_branches[nonce])
   do
      if first then
         io.stderr:write("Affected branches:\n")   
         first = false
      end
      io.stderr:write("  "..item.."\n")   
   end
   netsync_branches[nonce] = nil
end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]