FaqSubversionCustomizeAnnotation

How Do I Customize the Subversion Annotations?

Annotations are additional information that are displayed in for each source file in the IDE. For example, if you turn on Subversion Status Labels annotations, you can see the branch and tag names for your files in the Projects and Files windows.

Netbeans >= 7.1

More variables added:

  • {revision} - stands for Revision
  • {status} - stands for Status
  • {lock} - stands for Locked or Locked By Other
  • {folder} - stands for Branch or Tag Name
  • {mime_type} - stands for the svn:mime_type Property
  • {commit_revision} - stands for Last Commit Revision
  • {date} - stands for Last Commit Date
  • {author} - stands for Last Commit Author
Identifying Tags and Branches Folders

By modifying the regular expression under "Tools > Options > Miscellaneous > Versioning > Subversion > Define {folder}...", you can prevent the NetBeans Subversion UI from falsely identifying "tags" folders under "/src" folders as being tagged branches.

Example:
.*?/(?<!/src/.{1,200})(branches|tags)/(.+?)(/.*)?

This regular expression uses a negative look-behind to test whether the "branches" or "tags" directory is preceded by a "src" directory. This corrects issues where JSP tags under WEB-INF/tags show up in the Subversion "Show Changes" window as belonging to a branch or tag. It also prevents files in packages having the name "tags" in them from experiencing the same problem.

Netbeans 6.x

Customizing of the annotations is available from within "Tools | Options | Miscellaneous | Versioning | Subversion | Subversion Status Labels".

The Status Label Format textfield specifies how will be the files in the project explorer annotated. The following variables may be used as a reference to a specific value:

  • {status} - stays for the files svn status
  • {mime_type} - stays for the files svn:mime_type property
  • {revision} - stays for the files svn revision
  • {folder} - this one is useful when working with copies representing branches or tags. It stays for a repository folders symbolic name which has to be specified via the "Define {folder}"button.

e.g. if the value specified in the 'Status Label Format' field is

[{status};{revision}]

then the all files in the Project Explorer will be annotated with a text like

"New; 142"


Netbeans 6.0 uses by default the same logic like NetBeans 5.5 to retrieve the branch/tag name. Additionally it is possible to specify rules how a file from a specific has to be annotated.

By clicking on the "Define {folder"button you get the "Repository Folder Name" table, which specifies a set of generic rules how a file in the Project Explorer should be annotated depending on the Repository Folder it comes from.

  • "Repository URL RegExp Pattern" - a regex pattern to match a URL (Repository Folder)
  • "{folder} variable" - may be one of the following values
  • a simple string - e.g. "mybranch"
  • a reference to a group from the regular expression in the 'Repository URL Pattern' column - e.g "\2" gives the value represented by the second group in the regular expression from the 'Repository URL Pattern' column
  • a combination from the previous two (references and simple strings) - e.g. "mybranch - \2"


e.g. if there are the following values in the table

Repository URL RegExp Pattern {folder} variable
.*/(branches
| tags)/(.+?)/.*
{My branch - \2}


and the value specified in the 'Status Label Format' field is

[{status};{folder}]

then all files from the URL 'http://svn.server.org/svn/branches/JavaApplication28_b1' will be annotated like

"[New;MyBranchJavaApplication28_b1]"

Netbeans 5.5

You may customize the annotation label by setting up the -J-Dnetbeans.experimental.svn.ui.statusLabelFormat switch.

the Current default is:
-J-Dnetbeans.experimental.cvs.ui.statusLabelFormat="[{1};{2}]"

you may change it to e.g.:
-J-Dnetbeans.experimental.cvs.ui.statusLabelFormat=" {0} {2} {3}"
  
where 
{0} stays for revision
{1} stays for status
{2} stays for branch or tag
{3} stays for binary flag

The annotation for the branch/tag name comes from the first directory under the "branches" or "tags" folder. The project root is not annotated. If you use the following recommended repository layout for branches and tags:

/
trunk/
project/
branches/
<name_for_branch>/
project/
...
tags/
<name_for_tag>/
project/
...

or

/
branches/
<name_for_branch>/
project/
...
tags/
<name_for_tag>/
project/
...

then <name_for_branch> (<name_for_tag>) will be used to annotate the branch/tag name for all sources.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo