This page is intended for administrators of this site, not repository administrators or regular users. Repository admins probably just want to create new instances of existing script types, which they can do through the administrative page of each repository.

  1. Specify your script type.

    Determine where to place it. You can refer to it by an absolute path name, or relative to /var/forge/static/svn-hooks/.

    Determine its hook point. Choose one from the Subversion Repository Hook Reference.

    Determine its arguments. These will be:

    • the hook point, e.g., pre-commit;
    • the path within the repository to which the script applies, e.g., /;
    • user-supplied arguments;
    • the hook-point arguments, as specified by the hook point.
  2. Register your script type.

    Go to the table svn_script_types, and add a new entry there. Choose a name for your type of script, indicate its hook point, choose its flags, and identify the script file.

    The field token identifies the script type to the generated web content. Choose a unique name not already in the column.

    Use ROOT_ONLY if the script should only be applied to a whole repository; it will then not be available for subdirectories. Use SINGLETON if the script should only be applied once to any given directory; this is common if the script takes no user-supplied arguments, or it operates on a one-per-directory resource.

    The path to the script goes in the column script. You can specify one relative to /var/forge/static/svn-hooks/, or absolute.

    After creating the script type, note its id in the table.

  3. Ensure database fields.

    Check in the table svn_scripts that there are sufficient user-supplied arguments (labelled argN) of sufficient size for your script.

  4. Map configuration fields to arguments.

    Go to the table svn_script_type_args. For each user-supplied argument that your script needs, you must add a row. type will be the same in each case; it's the script id from the new row in svn_script_types. position should be 0, 1, 2…, indicating the order the arguments should be provided to the script. column identifies a column argN from the table svn_scripts.

  5. Specify the user interface.

    You must edit src/www/xslt/svn-hooks.m5.

    Add a new entry to the macro SCRIPT_TYPE to match the token field of svn_script_types, and provide a short description for the user.

    For each argument, match its label in svn_script_type_args to an entry in the macro ARGUMENT_PLACEHOLDER, to define the placeholder text to display when the argument is empty. Either add a new entry, or change the label in the database to match an existing entry.

    Similarly, match the argument's label to an entry in the macro ARGUMENT_WIDTH, or add an entry.

    You should then commit, and merge trunk into branches/stable, which is the branch used on the server. In the server's working directory (~forge/works/docsrc/):

    svn up

Lancaster University
© School of Computing and Communications, Lancaster University – Disclaimer & copyright
Some images from PixelMixer