You are not logged in Log in Join
You are here: Home » DevHome » Subversion » traffic_table.py » wikipage_view

Log in
Name

Password

 
 
FrontPage » CVSAddons »

traffic_table.py

"""Table dictating what goes where for the traffic_cop module.

The global var 'table' contains a list of entries identifying where
change-notifications for particular sections of the repository are sent.

Each 'table' entry is a dictionary containing some mandatory and some
optional fields (optional fields have default values described)

 - 'addrs' - a list of email addresses for checkin notice delivery. 

 - 'path' - to the repository dir, relative to the CVSROOT.  If the
   leading path of the files being checked in (re) match the value of this
   attribute, then this entry is invoked.

   NOTE that the comparison mechanism takes into account the repository
   symlinks (as dictated by the repolinks file).  This means that all entries
   for directories that contain checked-in files by virtue of symlinks, as
   well as by direct containment, will qualify - the system takes care of
   unravelling the symlinks for you.
"""

internal = ["[email protected]", "[email protected]"]

_TABLE = []

def add_to_table(entries, prepend=0):
    global _TABLE
    if type(entries) not in [type([]), type(())]:
        entries = [entries]
    if prepend:
        _TABLE = entries + _TABLE
    else:
        _TABLE = _TABLE + entries

def add_multipath(paths, addrs):
    """Add entries with different paths but the same addrs and remote"""
    for path in paths:
        add_to_table({'path': path,
                      'addrs': addrs})

def get_table():
    return _TABLE[:]

def init_table():
    add_to_table([
        # CVSROOT entry is crucial:
        {'path': "CVSROOT",
         'addrs': internal,
         'specials': [("repolinks", "adjustlinks.py")],
         'verbose': 1},

        {'path': "PrjChat",
         'addrs': ["[email protected]",
                   "[email protected]"]},

        # Catchall for when *no* other entry matches:
        {'path': None,
         'addrs': internal},
    ])

init_table()