Labeling Subversion Paths

Whilst Subversion does not have a specific label entity may users follow the 'tags' convention. If a 'tag' path is pure (in that it has not had subsequent changes to the content) it can be converted to a Perforce label.

  1. To enable labeling of Subversion tags, set the com.p4convert.svn.labels to true and define maps: exclude.map and include.map.

    com.p4convert.svn.labels=true
    
  2. The maps are designed with resect to branches. The default behaviour is for all Subversion tag operations to be imported as Perforce branches. In order to change the behaviour and attempt to import the Subversion tag as a Perforce label the path must be in the exclude map.

    For example; to import all Subversion tags in the folder 'tags/' as Perforce labels, create an exclusion map file exclude.map:

    # exclude Subversion tags:
    ^tags/.*
    
  3. A Perforce label will need a unique name space derived from the 'tags' path. The conversion tool provides a depth and regular expression configuration option to assist.

    com.p4convert.svn.labelFormat=svn_label:{depth}
    
    com.p4convert.svn.labelDepth=2
    

    The depth determins how much of the path to use for the unique label name. Typically a value of '2' for convertional Subversion usage. With a depth of '2' the first two elements of the 'tags' path are then held in an array and used by a regular expression to generate the label name.

    For example, given a Subversion tag located tags/1.0.0/ the following regular expressions provide the coresponding label names:

    com.p4convert.svn.labelFormat=label:{2}         label:1.0.0
    com.p4convert.svn.labelFormat={1}-{2}           tags-1.0.0
    

    Note

    An empty expression will use the original path.

    com.p4convert.svn.labelFormat=                  tags/1.0.0/
    

    Note

    If a keyword of {depth} is used it will be substituted with it's value.

    com.p4convert.svn.labelFormat=label_{depth}     label_1.0.0