[p4] Filetypes and modifiers

Matthew Rice matt at starnix.com
Fri Oct 26 14:29:53 PDT 2001

Robert Duff <rduff at rim.net> writes:
> could I type something like this?
> p4 edit -t default+S /pathname/filename1
> p4 edit -t default+S /pathname/filename2

You're right.  There's been a couple of times where I'd have liked:

        p4 add -t +S xyz

and similar.

> Is there any easy way (without gobs of scripting) to simply add the +S
> modifier when you check it out for edit (or reopen)?

You could do something like:

  p4 add/edit $FILE

  FILETYPE=`p4 opened $FILE | sed -e 's/.*(\(.*\))/\1/'`
  NEWTYPE=`expr ${FILETYPE}$MODIFIER : '\(.*+.*\)' \| "${FILETYPE}+$MODIFIER"`
  p4 reopen -t $NEWTYPE $FILE

This will fail if there's already a +S on it but I'll let you fix for that
case :)

matthew rice <matt at starnix.com>                               starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products

More information about the perforce-user mailing list