Syncing missing/modified files to a specific version in Perforce

I think this is the 5th time I’ve had to figure this out in the past few years, so this time I’m going to preserve it here for posterity :)

The problem is usually one or more of:

  • You have files missing from your workspace that need replaced.
  • You have locally modified (i.e. not opened for edit) files that need replaced.
  • These files are large in either size or number, and on a slow or remote server, so a complete force-sync is not an appealing option.

Normally this could easily be solved with something like p4 diff -sd/-se //depot/path/.. | p4 -x – sync -f, which finds all the missing/outdated files and then force-syncs them.

The problem with this approach comes when you need the files from a specific revision or label. While you can pass in a label/revision to ‘p4 diff’, the sync part will always retrieve the latest version of a file. To fix this we need to save the list of files we need to a temporary location, then postfix each line with the version we want, then feed that new list back to p4 sync.

But there’s one final catch. If your filenames are local paths instead of Perforce paths, you cannot specify a label, only revisions. E.g. c:\temp\foo.dat@SOME_LABEL will not work, but c:\temp\foo.dat#999 will. Fortunately we can use the pseudo revision ‘have’ for our purposes.

@echo off

REM Could optionally pass these as %1 and %2 from the cmd line
set LABEL=@SOME_LABEL
set BASE_DIR=//depot/path/…

del p4sync.txt

echo Setting ‘have’ to %LABEL% for %BASE_DIR%
REM do a nop sync that sets our ‘have’ version to the label we want
p4 sync -k %BASE_DIR%%LABEL%

echo Finding modified files..
p4 diff -se %BASE_DIR%%LABEL% > p4diff.txt

echo Finding missing files..
p4 diff -sd %BASE_DIR%%LABEL% >> p4diff.txt

echo Building sync commands
REM Append #have to each filename and put them all in a list of files to sync
for /f %%i in (p4diff.txt) Do echo %%i#have>> p4sync.txt

REM Now sync everything
if exist p4sync.txt (
echo Syncing..
p4 -x p4sync.txt sync -f
)else (
echo It seems no files need updated!
)

Voila!

Tagged : / / / / / /

Remove Control ^M from files

tpatil created the topic: Remove Control ^M from files

Single file method

perl -pi -e "s/\r//" filename.txt

Multiple File Method

find . -type f -exec perl -pi -e "s/\r//" {} \;

rajeshkumar replied the topic: Re:Remove Control ^M from files
I used to do in shell using following command

> 1,$s/^M//g

Correct me if I am wrong
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

tpatil replied the topic: Re:Remove Control ^M from files

Yes, this is also correct command if you want to remove ^M from single file in VI edit mode.

Tagged :

RADIA – HPCAE – log files grown enormously

installanywhereExpert created the topic: RADIA – HPCAE – log files grown enormously
During installation of the agent, log files grow very large. Maintenance connect increased up to 7Gb. When radskman.exe was killed the log file stoped its increment but PatchDiscovery.log grows enourmously and it never stop up to 10Gb.

I’ve already read on other forums that many people implemented Radia before already experienced the huge number of logs file generated, size also are Giga bites. But I’ve read no explanation why this happens.

Can someone explains to be how this log files grow really large and how to resolve this incident. Thanks everyone in advance.

msiexpert replied the topic: Re: RADIA – HPCAE – log files grown enormously
Hi,

Can you check if trace level is increased? check the ZMASTER obejct for trace value

Regards
Vinod

installanywhereExpert replied the topic: Re: RADIA – HPCAE – log files grown enormously
Hi,

i’ve already looked on the zmaster object and no changes takes place. all parameters stays the same. Thanks.

msiexpert replied the topic: Re: RADIA – HPCAE – log files grown enormously
Hi ,

you can edit the log files behaviour from the edmprof.dat file related to RCS server.
open the file and go to the log section.

hope this helps you

installanywhereExpert replied the topic: Re: RADIA – HPCAE – log files grown enormously
Hi,

While installing the client you can specify the log size in “install.ini” file. I think it helps you.

Tagged :