[p4] How do you indicate files in your current dir that arent in depot

Shawn Hladky p4shawn at gmail.com
Tue Oct 17 08:02:35 PDT 2006


There's a small problem w/ this approach.  Files that are deleted at the
head revision will not show up as needing to be added.  It's better to use
p4 add -n.  That will reverse your filter (you need to filter STDERR, and
keep STDOUT).

So, on windows:
dir /s /a-d /b | p4 -x - add -n 2>nul

Here's a one-liner for windows that filters everything but the name (yes,
it's pretty nasty looking).
for /f "tokens=1 delims=#" %i in ('dir /s /a-d /b ^| p4 -x - add -n 2^>nul')
do @echo %i


On 10/17/06, Weintraub, David <david.weintraub at bofasecurities.com> wrote:
>
> It's a bit complicated, but here it is:
>
>     $ find . -type f | p4 -x - files > /dev/null
>
> The find command finds all files, the "p4 -x" says take the arguments
> for the P4 command from the named file. "-" says the file is STDIN. You
> then run the "p4 files" command against each file. If the file is in
> Perforce, the output is sent to STDIN, and thus to /dev/null. If the
> file is not in Perforce, it is sent to STDERR, thus will display the
> name of the file (as well as an error message). A similar command in
> Windows is:
>
>     $ dir /a-d/b/s | p4 -x - files > NUL
>
> One more trick: In Unix, to delete the error message, and to put the
> names of the file in STDOUT. Do this:
>
>     $ (find . -type f | p4 -x - files > /dev/null) 2>&1 | sed 's/ - no
> such file(s)\.$//'
>
> I don't know of a similar trick in Windows.
>
> -----Original Message-----
> From: perforce-user-bounces at perforce.com
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Ken Coveny
> Sent: Monday, October 16, 2006 4:48 PM
> To: perforce-user at perforce.com
> Subject: [p4] How do you indicate files in your current dir that arent
> in depot
>
> Hi,
> In CVS when you do a 'cvs up', files that are not in cvs are indicated
> by having a question mark. Can you find out in perforce the same?
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>


More information about the perforce-user mailing list