GitCentric Regular Expressions

Note: This section is for system administrators only.

One of the powers of AccuRev is to associate all of the files affected by a particular change to an issue number tracking that change. This grouping of affected files is called a change package. (See the AccuRev documentation for information about change packages.) If you have change packages enabled on your AccuRev Server, either through AccuWork or through a third-party issue tracking system, you may need to enforce the practice of including the issue number in the comment related to Git commits. That is the purpose of the Regular Expression field: to specify a commit message format that users must follow when pushing a change in Git that will be synchronized to AccuRev. The default example provided in the UI (Resolves\s+([\d,]+):) forces users to start their commit messages with Resolves <issue number>:.

If this is not found, the push will be rejected.

A discussion of Java regular expressions is beyond the scope of this document, but here are examples of what comments would be valid for some of these predefined expressions:

(?:Resolves|Resolved|Fixes|Fixed)\s*((?:(?:US|DE)[\d, ]*)*)

This format would be useful for the Rally issue tracking system, which makes use of user stories (US) and defects (DE): The comments can start with Resolves, Resolved, Fixes, or Fixed, followed by white space, and then any number of issue numbers prefixed with US or DE:

Resolves US302, DE1405, US27
Fixed DE12849

Resolved\s+([\d,]+)

This format would be adequate for simple environments where the comment always starts with Resolved, followed by white space, followed by any number of issues, separated by commas:

Resolved 12576
Resolved 34, 149, 11057, 686

Use a search engine and search for Java regular expressions for more information about these formats.