Jump to content


Question about restricting submits from specific folders using wildcards

P4V Perforce p4 protect wildcard exclude

  • Please log in to reply
2 replies to this topic

#1 mister_wilson

mister_wilson

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts
  • LocationMontreal, Quebec

Posted 03 December 2018 - 07:42 PM

Hi,

I would like to restrict submits to 2 particular folders using p4 protect.

The folders are:

//mydepot/mybranch/data/generated/...
//mydepot/mybranch/data/Worlds/myworld/generated/...

In this example I would just do

=write group * * -//mydepot/mybranch/data/generated/...
=write group * * -//mydepot/mybranch/data/Worlds/myworld/generated/...

Now I would like to apply this restriction for any *branch* under mydepot and any *world* under Worlds, could someone tell me the best way to do it?
I was thinking of using the following syntax:

=write group * * -//mydepot/.../data/generated/...
=write group * * -//mydepot/.../data/Worlds/.../generated/...

or even to have it applicable to any depot

=write group * * -//.../data/generated/...
=write group * * -//.../data/Worlds/.../generated/...

Would this be the proper syntax?

Thanks,

-Jonathan Wilson

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 665 posts

Posted 03 December 2018 - 07:52 PM

Yup, that syntax will work, but be advised that it might cause problems down the line with mapping joins (you'll know this has happened if you start getting errors about "too many wildcards" that are caused by hitting the map.joinmax limits -- or, if you increase those limits past their defaults, you might find out by having your server crash instead).

If this does happen, or if you want to avoid it, a couple of alternative approaches are:
1) Use a pre-submit trigger to block submits to these paths.
2) Use an automatically generated protection table that avoids embedded wildcards (see https://swarm.worksh...main/protexp.pl)
# The $dirs variable can be used to expand lists of directories.
# For example:
#	write group * $dirs(//depot/*)/bin/...
# becomes:
#	write group * //depot/main/bin/...
#	write group * //depot/r011/bin/...
#	write group * //depot/r012/bin/...
# This can serve as a replacement for double wildcards.


#3 mister_wilson

mister_wilson

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts
  • LocationMontreal, Quebec

Posted 03 December 2018 - 08:34 PM

Thanks for the helpful info Sam, I think I will test out these alternatives =)





Also tagged with one or more of these keywords: P4V, Perforce, p4 protect, wildcard, exclude

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users