Jump to content


Questions on p4 branch spec syntax

branch spec specification syntax

  • Please log in to reply
1 reply to this topic

#1 engr.vns

engr.vns

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 17 June 2020 - 06:03 PM

A few clarifictions on the file syntax of spec file created using p4 branch...

1) How can a user user add comment lines in the branch spec (Other then the description field)

I tried adding a few comments to a branch spec using a leading "#" character.
When you save it the branch spec and open it back the user comments had been removed by the tool.
I had assumed that any leading "#" would be a user comment. But looks like it is not..

2) Any shorthand notation for mapping
The branch spec seems to have the following donor-to-receiver mapping syntax

Example:
View:
//projects/proj1/dir1/dir2/... //projects/proj2/dir1/dir2/...

If you notice in the example above, the LHS which is the donor project path is necessary
But the RHS side can be inferred (when not specified)
But the tool requires you to specify both mandatorily...

Is there a shorthand notation to avoid writing receiver side map (assuming that the directory structure is the same...)

I could not easily locate the syntax of the "specification file" in the document...
Hence these questions...

Thanks for the help

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1146 posts

Posted 17 June 2020 - 07:04 PM

View Postengr.vns, on 17 June 2020 - 06:03 PM, said:

1) How can a user user add comment lines in the branch spec (Other then the description field)

I tried adding a few comments to a branch spec using a leading "#" character.
When you save it the branch spec and open it back the user comments had been removed by the tool.
I had assumed that any leading "#" would be a user comment. But looks like it is not..

Comments will be completely ignored by the server, which means that they aren't stored anywhere and will be gone the next time you edit the branch spec.  The protection table has a special exception for this, where you can make comments prefixed with "##" that will be stored as part of the spec, but as far as I know this doesn't work for other spec types.

The cheesy workaround is to use dummy view lines (i.e. fake depot paths where the path serves as the comment).

Quote

2) Any shorthand notation for mapping
The branch spec seems to have the following donor-to-receiver mapping syntax

Example:
View:
//projects/proj1/dir1/dir2/... //projects/proj2/dir1/dir2/...

If you notice in the example above, the LHS which is the donor project path is necessary
But the RHS side can be inferred (when not specified)
But the tool requires you to specify both mandatorily...

Is there a shorthand notation to avoid writing receiver side map (assuming that the directory structure is the same...)

Yes; use streams.  :)  Stream paths are specified relative to a fixed namespace and are a lot more "shorthand"-y.  Classic branch views can map anything to anything, so each mapping line needs to be fully qualified.

The other option is to write form-in triggers that will expand your shorthand syntax into fully qualified branch views, but at that point you're on your way to just implementing your own version of streams...





Also tagged with one or more of these keywords: branch, spec, specification, syntax

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users