monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] new branch expansion hook


From: Derek Scherger
Subject: [Monotone-devel] new branch expansion hook
Date: Tue, 04 Sep 2007 22:51:37 -0600
User-agent: Thunderbird 2.0.0.6 (X11/20070805)

I've just pushed a new branch
net.venge.monotone.experiment.branch-expansion which adds support for a
lua expand_branch hook. There's some work left to do on this (docs and
tests) but I'm curious whether people are interested in it or not first.

There are also a few things that could be changed:

1. At the moment the hook takes a branch "pattern" (that is just a
partial branch name to be expanded) and a set of existing branches
(honoring the suspended certs) and returns a set of matching branches.
Returning a set may seem a bit odd but it seemed like it would be better
to report errors in monotone proper than from the hook. This allows for
"no branches matched" and "multiple branches matched" conditions to be
reported slightly better (IHMO). I'm not married to this interface so if
anyone has better ideas or objections I'm happy to change it.

2. The "pattern" is not a glob at the moment because I expect that some
people will want to put their own pet names into the hook (nvm -->
net.venge.monotone, etc.) rather than just match against existing
branches. Again, I'm happy to change this if there's some consensus that
a glob would be better.

My test implementation of the hook just tries to match the given pattern
as a suffix on existing branches which works reasonably well. Here it is:

function expand_branch(name, branches)
   local expanded = {}

   for _,b in ipairs(branches)
   do
      if (string.find(b, name .. "$")) then
        table.insert(expanded, b);
      end
   end

   return expanded
end

Cheers,
Derek




reply via email to

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