[p4] Diff of two files in two workspaces.
Arnt Gulbrandsen
arnt at gulbrandsen.priv.no
Thu Jul 13 13:17:45 PDT 2006
Steven W. Orr writes:
> I have two workspaces. One is sync'd from the main branch of the
> depot, the other is sync'd from a branch that was created from a
> somewhat complex branchspec. The workspace are identical in that they
> both contain the same filenames in the same directory structure.
>
> I'm coming from a ClearCase background so please be gentle. I'm
> looking for a P4 operation that will say to me: Take these two files
> and tell me if they are both from the same version in the depot.
>
> For example, I could run a standard diff or cmp operation on two
> files, but all that would tell me is if they are equal in content.
> What I'd like is for some way to see that they both came from the
> same rev. If I look in p4v at the revision graph of the two files I
> can visually see the information I'm looking for.
>
> Is there a way to do this?
Sure. Since you know unix well enough to know about cmp, here's a
three-line shell script to do that. Give it two command-line arguments
and it gives you the answer.
#!/bin/sh
fstat() { ( cd `dirname $*` ; p4 fstat `basename $*` | grep -v clientFile ) }
[ "`fstat $1`" = "`fstat $2`" ] && echo Same file || echo Different file
Arnt
More information about the perforce-user
mailing list