[p4] Patching files checked out from Perforce with no questionsasked

Geir A. Myrestrand geir.myrestrand at falconstor.com
Wed Nov 1 15:00:42 PST 2006

Yes, I run into this on SLES10 which is indeed very new (not RHELAS4U2 
as I reported earlier --sorry, but I have 6 operating systems on this 
box, and I thought it was booted into RHELAS4U2 for some reason).

# which patch

# rpm -qf /usr/bin/patch

Anyway, I want to use the "-g 0" or "--get=0" option all the time, so I 
export PATCH_GET as 0 (zero) in my ~/.bashrc and that takes care of the 
issue for me.

Thanks to everyone who contributed to answer my question!

Jeff Grills wrote:
> It looks like patch(1) understands something about version control software
> now.  I don't ever remember seeing this before, so it might be a relatively
> new enhancement.  Here's an excerpt from a patch(1) man page:
>        -g num  or  --get=num
>           This  option  controls  patch's  actions when a file is under RCS
> or
>           SCCS control, and does not exist or is  read-only  and  matches
> the
>           default  version, or when a file is under ClearCase or Perforce
> control
>           and does not exist.  If num is positive, patch gets (or  checks
>           out)  the  file  from  the  revision  control system; if zero,
> patch
>           ignores RCS, ClearCase, Perforce, and SCCS  and  does  not  get
> the
>           file;  and if negative, patch asks the user whether to get the
> file.
>           The default value of this option  is  given  by  the  value  of
> the
>           PATCH_GET  environment  variable  if  it is set; if not, the
> default
>           value is zero if patch is conforming to POSIX, negative otherwise.
> So, you might just need to specify "-g 0" to patch to make it stop harassing
> you.
> j
>> -----Original Message-----
>> From: perforce-user-bounces at perforce.com 
>> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Geir 
>> A. Myrestrand
>> Sent: Wednesday, November 01, 2006 10:57 AM
>> To: perforce-user at perforce.com
>> Subject: [p4] Patching files checked out from Perforce with 
>> no questionsasked
>> Upon applying a rather large patch set on files checked out 
>> from Perforce, I am presented with this question for every 
>> file modified by the patch set:
>> Get file <filename_modified_by_patch_set> from Perforce with lock? [y]
>> The desired behavior is no, but I don't want to answer this 
>> question for each file in the patch set --I want no for all, 
>> without the interactive portion.
>> How can I achieve this?
>> I mean, is there an environment variable or Perforce setting 
>> I can use to change this behavior?
>> P4CLIENT, P4USER, and P4PORT are set, and I am using the p4 
>> command line client on RHELAS4. The Perforce server is 2004.2/72935.
>> -- 
>> Geir A. Myrestrand


Geir A. Myrestrand

More information about the perforce-user mailing list