Jump to content


protect table: regex capture strings?


  • Please log in to reply
2 replies to this topic

#1 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 111 posts

Posted 14 December 2018 - 10:15 PM

A good bit of our protects table is of the form:

read  group read-fred  * //fred/...
write group fred       * //fred/...

. We create these two groups (<depotname> and read-<depotname>) for every project.

Is there a way to do something like perl's capture strings? If so, we could reduce over a thousand lines to two:

read  group read-(.*)  * //$1/...
write group (.*)       * //$1/...

Thanks,
Miles

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 819 posts

Posted 14 December 2018 - 11:54 PM

I wrote a cheesy script some years back to do this sort of thing:

https://swarm.worksh...main/protexp.pl

When you install it as a trigger, it enables syntax of the form:

write user $user * //dev/$user/...

It sounds like you want similar functionality but for each $depot instead of each $user -- if you're comfortable with Perl that'd be a pretty easy addition to the script.  :)

#3 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 111 posts

Posted 04 January 2019 - 03:57 PM

We can easily do that if we need to; I was just hoping there was something native. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users