[p4] Filetypes and modifiers
dlewis at vignette.com
Fri Oct 26 14:32:21 PDT 2001
> I have a bit of a dilemma... In a nightly build script, files are
> submitted. However, only one revision of some of these files need to be
> kept -- no problem, I just have to use the +S filetype modifier. However,
> we're not always sure if these are going to be text files or binary files,
> nor if they are going to have any other modifiers already applied to them.
> My question is, how can I script this? Is there something like a 'default'
> filetype or anything like that? For example, instead of typing
> p4 edit -t binary+S /pathname/filename1
> p4 edit -t text+S /pathname/filename2
> could I type something like this?
> p4 edit -t default+S /pathname/filename1
> p4 edit -t default+S /pathname/filename2
> Is there any easy way (without gobs of scripting) to simply add the +S
> modifier when you check it out for edit (or reopen)?
Well, it wasn't a lot of scripting, but what I did was get
a list from p4 opened and then use the filetype that is
specified for each one to do the correct reopen with +S
added. generally, you only have to do it for adds.
it looked something like this in perl:
# we will match against lines like:
#//depot/users/dlewis/scripts/perl#1 - add default change (xbinary)
($filetype=$file) =~ s:^//.*#\d+\s-\sadd\s.*\(([^\)]+)\)$:$1:;
$file =~ s:^(.*)#\d+.*:$1:; # need actual name of file, depot path will do!
More information about the perforce-user