{"id":28561077,"url":"https://github.com/perfectslayer/svn-hook-tools","last_synced_at":"2025-10-09T17:42:03.495Z","repository":{"id":21242845,"uuid":"24558258","full_name":"PerfectSlayer/SVN-Hook-Tools","owner":"PerfectSlayer","description":"A Subversion hook engine and rules for task automatisation.","archived":false,"fork":false,"pushed_at":"2014-10-08T15:12:52.000Z","size":280,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T10:14:05.567Z","etag":null,"topics":["hook","java","subversion"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerfectSlayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-28T11:48:24.000Z","updated_at":"2018-08-15T05:41:18.000Z","dependencies_parsed_at":"2022-08-05T11:15:26.990Z","dependency_job_id":null,"html_url":"https://github.com/PerfectSlayer/SVN-Hook-Tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PerfectSlayer/SVN-Hook-Tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectSlayer%2FSVN-Hook-Tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectSlayer%2FSVN-Hook-Tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectSlayer%2FSVN-Hook-Tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectSlayer%2FSVN-Hook-Tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectSlayer","download_url":"https://codeload.github.com/PerfectSlayer/SVN-Hook-Tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectSlayer%2FSVN-Hook-Tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001868,"owners_count":26083197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hook","java","subversion"],"created_at":"2025-06-10T10:14:03.907Z","updated_at":"2025-10-09T17:42:03.475Z","avatar_url":"https://github.com/PerfectSlayer.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVN Hook Tools\n\n## Presentation\nThe SVN Hook Tools is a rule engine designed to quickly and easily add task on Subversion repository hooks.\nFor each hook is associated a rule-set where each rule contains a condition and a list of actions to perform. For example, you may block a commit without a comment, allow log message edition from some users only, or even execute programs or Web requests after creating a tag.\n\n## Installation\n\n### Prerequisites\nThe SVN Hook Tools requires a 1.7 JVM.\n\n### Deployement\nTo deploy the tool, you will need to copy the `svn-hook-tools.jar` and its `config` directory at the same location, for example the `hook` directory of the repository.\n\n### Call the tool\nTo call the tool, edit the respository hook shell scripts you want to create tasks and add a the following call to the SVN Hook Tools for Linux:\n```bash\njava -jar svn-hook-tools.jar $(basename $0) $@\n```\nor for Windows:\n```bash\njava -jar svn-hook-tools.jar %~n0 %*\n```\nThe arguments needed to call the tool are the hook name and the hook script arguments.\n\n## Setup\n\n### Logging setup\nThe SVN Hook Tools uses a  `java.util.logging` logger. You may configure the logging feature using the configuration file available in `config/logging.properties`. The log will be really useful during the rule definition process to retrieve configuration errors. By default, the tool writes a human readable `svn-hook-tools.log` file in the user home directory.\n\n### Condition and action binding\nThe tool comes with built-in conditions and actions. Nevertheless, you may also develop and add you own condition or action and use it throw dynamic class loading. The configuration file responsive for loading and binding classes could be found in `config/bindings.properties`.\n\n### Built-in conditions\nThe tool comes with some built-in conditions. Here is a summary table of conditions.\n\n| Name | Description | Parameters |\n| ---- | ----------- | ---------- |\n| _all_ | An operator condition valid if all nested conditions are valid. | |\n| _any_ | An operator condition valid if at least one of nested condition is valid. | |\n| _author_ | A condition that test the Subversion user name. | _name_: mandatory, the name to check,\u003cbr\u003e _nameComparison_: _IS_ by default, the name comparison method. |\n| _emptyCommitLog_ | A condition valid if the commit log message is empty. | |\n| _minLengthCommitLog_ | A condition valid if the commit log message length is greater than the requested length. | _length_: mandatory, the minimum length of the commit log message. |\n| _patternCommitLog_ | A condition valid if the commit log message valid the given pattern. | _pattern_: mandatory, the pattern of the commit log message. |\n| _resource_ | A condition valid if any resource operation valid all related resource filters. | See resource filters description below. |\n| _not_ | An operator condition valid if the nested condition is not valid. | |\n\nThe resource condition must include resource filters to be validated. Here is a summary table of resource filters.\n\n| Name | Description | Parameters |\n|------|-------------|------------|\n| _FileExtension_ | A resource filter based on file extension. | _fileExtension_: mandatory, the file extension to check,\u003cbr\u003e _fileExtensionComparison_: _IS_ by default, the file extension comparison method. |\n| _FileName_ | A resource filter based on file name. | _fileName_: mandatory, the file name to check. |\n| _FileLocation_ | A resource filter based on resource location. | _type_: no check by default, the location type to check (_ROOT_LOCATION_, _TRUNK_LOCATION_, _BRANCHES_LOCATION_, TAGS_LOCATION_, A_BRANCH_LOCATION_, _A_TAG_LOCATION_, _IN_TRUNK_LOCATION_, _IN_A_BRANCH_LOCATION_, _IN_A_TAG_LOCATION_, _IN_ROOT_LOCATION_),\u003cbr\u003e _projectName_: no check by default, the project name to check,\u003cbr\u003e _projectNameComparison_: _IS_ by default, the project name comparison method,\u003cbr\u003e _branchName_: no check by default, the branch name to check,\u003cbr\u003e _branchNameComparison_: _IS_ by default, the branch name comparison method,\u003cbr\u003e _tagName_: no check by default, the tag name to check,\u003cbr\u003e _tagNameComparison_: _IS_ by default, the tag name comparison method,\u003cbr\u003e _path_: no check by default, the path to check,\u003cbr\u003e _pathComparison_: _CONTAINS_ by default, the path comparison method. |\n| _Operation_ | A resource filter based on the operation done on the resource. | _operation_: mandatory, the operation to check (_ADDED_, _COPIED_, _DELETED_, _UPDATED_, _PROPERTY_CHANGED_, _LOCK_, _UNLOCK_). |\n| PropertyChange | A resource filter based on resource property change. | _name_: mandatory, the name of the property to check,\u003cbr\u003e _oldValue_: no check by default, the old value of the property to check,\u003cbr\u003e _oldValueComparison_: _IS_ by default, the old value of the property comparison method,\u003cbr\u003e _newValue_: no check by default, the new value of the property to check,\u003cbr\u003e _newValueComparison_: _IS_ by default, the new value of the property comparison method. |\n| FileType | A resource filter based on resource type. | _type_: mandatory, the type of the resource to check (_DIRECTORY_ or _FILE_). |\n\n\n### Built-in actions\nThe tool comes with some built-in actions. Here is a summary table of actions.\n\n| Name | Description | Parameters |\n| ---- | ----------- | ---------- |\n| _error_ | An action that raise an error to the Subversion client. | _code_: mandatory, the error code to return,\u003cbr\u003e _message_: the error message to send. |\n| _exec_ | An action that execute a program. | _command_: mandatory, the program command to execute,\u003cbr\u003e _parameters_: empty by default, the program parameters to pass,\u003cbr \u003e_waitFor_: _FALSE_ by default, the flag to define if the engine should wait for the terminaison of the executed program. |\n| _log_ | An action that write a log entry. | _message_: mandatory, the log message,\u003cbr\u003e _level_: _INFO_ by default, the log level (_FINEST_, _FINER_, _FINE_, _CONFIG_, _INFO_, WARNING_ or _SEVERE_). |\n| _request_ | An action that make a HTTP request. | _url_: mandatory, the URL to request,\u003cbr\u003e _type_: _GET_ by default, the request type (_POST_ or _GET_),\u003cbr\u003e _headers_: the request headers,\u003cbr \u003e_data_: the request data to send. |\n\n\n### Rules declaration\nA rule-set for a hook is described in a XML file. The name of the file  must be the same of the hook script suffixed by `-rules.xml` and be located in the `config` directory, `config/pre-commit-rules.xml` for example.\nThe root node should be a `ruleset` node containing one `rule` node for each task you want to make. A `rule` node must have a `name` attribute to describe it.\n\n```xml\n\u003crule-set\u003e\n\t\u003crule name=\"Empty commit log\"\u003e\n\t\u003c/rule\u003e\n\t\u003crule name=\"Block in trunk modification\"\u003e\n\t\u003c/rule\u003e\n\u003c/rule-set\u003e\n```\n\nThe `rule` node may contains a `condition` node. If the `condition` node is missing, the rule actions will always be triggered with the hook. The `condition` node must have a `type` attribute to define the kind of condition. All available condition types are defined in the `config/bindings.properties` configuration file.\n```xml\n\u003crule-set\u003e\n\t\u003crule name=\"Empty commit log\"\u003e\n\t\t\u003ccondition type=\"emptyCommitLog\" /\u003e\n\t\u003c/rule\u003e\n\t\u003crule name=\"Block in trunk modification\"\u003e\n\t\t\u003ccondition type=\"resource\"\u003e\n\t\t\t\u003cfilter type=\"location\"\u003e\n\t\t\t\t\u003cparameter name=\"type\"\u003eIN_TRUNK_LOCATION\u003c/parameter\u003e\n\t\t\t\u003c/filter\u003e\n\t\t\u003c/condition\u003e\n\t\u003c/rule\u003e\n\u003c/rule-set\u003e\n```\n\nIf you want to add more than one condition, you may imbricate `condition` nodes in operator typed condition (`all`, `any`, `not`). For example, if you want to block in trunk modification for all user except admin, you will have the following condition imbrication.\n```xml\n\u003crule-set\u003e\n\t\u003crule name=\"Empty commit log\"\u003e\n\t\t\u003ccondition type=\"emptyCommitLog\" /\u003e\n\t\u003c/rule\u003e\n\t\u003crule name=\"Block non admin in trunk modification\"\u003e\n\t\t\u003ccondition type=\"all\"\u003e\n\t\t\t\u003ccondition type=\"not\"\u003e\n\t\t\t\t\u003ccondition type=\"author\"\u003e\n\t\t\t\t\t\u003cparameter name=\"name\" value=\"admin\" /\u003e\n\t\t\t\t\u003c/condition\u003e\n\t\t\t\u003c/condition\u003e\n\t\t\t\u003ccondition type=\"resource\"\u003e\n\t\t\t\t\u003cfilter type=\"location\"\u003e\n\t\t\t\t\t\u003cparameter name=\"type\"\u003eIN_TRUNK_LOCATION\u003c/parameter\u003e\n\t\t\t\t\u003c/filter\u003e\n\t\t\t\u003c/condition\u003e\n\t\t\u003c/condition\u003e\n\t\u003c/rule\u003e\n\u003c/rule-set\u003e\n```\n\nAfter defining your condition, add any `action` node for each task you want to perform if the condition is met. The `action` node must have a `type` parameter. All available action types are defined in the `config/bindings.properties` configuration file.\n```xml\n\u003crule-set\u003e\n\t\u003crule name=\"Empty commit log\"\u003e\n\t\t\u003ccondition type=\"emptyCommitLog\" /\u003e\n\t\t\u003caction type=\"error\"\u003e\n\t\t\t\u003cparameter name=\"code\"\u003e-10\u003c/parameter\u003e\n\t\t\t\u003cparameter name=\"message\"\u003eThe commit message could not be empty.\u003c/parameter\u003e\n\t\t\u003c/action\u003e\n\t\u003c/rule\u003e\n\t\u003crule name=\"Block in trunk modification\"\u003e\n\t\t\u003ccondition type=\"resource\"\u003e\n\t\t\t\u003cfilter type=\"location\"\u003e\n\t\t\t\t\u003cparameter name=\"type\"\u003eIN_TRUNK_LOCATION\u003c/parameter\u003e\n\t\t\t\u003c/filter\u003e\n\t\t\u003c/condition\u003e\n\t\t\u003caction type=\"error\"\u003e\n\t\t\t\u003cparameter name=\"code\"\u003e-11\u003c/parameter\u003e\n\t\t\t\u003cparameter name=\"message\"\u003eForbidden to touch trunk.\u003c/parameter\u003e\n\t\t\u003c/action\u003e\n\t\u003c/rule\u003e\n\u003c/rule-set\u003e\n```\n\nDoing so, you will define your entire hook rule-set. Each rule performs independently in the sequential order.\n\n## Extending the tool\n\nThe SVN Hook Tools may be extended by developping conditions and actions. Create a Java project with svn-hook-tools.jar dependency and extend the following classes:\n\n| Class | Purpose |\n|-------|---------|\n| _action.AbstractAction_ | Create a new action. |\n| _condition.AbstractCondition_ | Create a new condition. |\n| _condition.operator.AbstractGroupCondition_ | Create a new operator condition. |\n| _condition.resource.filter.AbstractResourceFilter_ | Create a new resource filter (for resource condition). |\n\nEach child of those classes may have parameters. Add them public member annoted with `@ConfigurationParameter` to dynamically load and set parameter value on rule-set parsing. The class field name must match the `name` attribute value of the related `parameter` node. Once the child classes done, export you project as jar and add it to the callpath when you call the tool. To be able to use your new conditions and actions, you must declare theirs types in the `config/bindings.properties` (a mapping between type names and fully qualified class names).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectslayer%2Fsvn-hook-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfectslayer%2Fsvn-hook-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectslayer%2Fsvn-hook-tools/lists"}