Perforce: How to checkout file same file from different version?

287 views Asked by At

For example, I have 100s of files checked out in a changelist:

//Development/MyProject/Version1.0/Coord/File1.cs
//Development/MyProject/Version1.0/Coord/File2.cs
...
//Development/MyProject/Version1.0/Coord/Filen.cs
//Development/MyProject/Version1.0/Common/File1.cs
...
//Development/MyProject/Version1.0/Common/Filen.cs

Similarly in some more directories. Now I want to checkout similar files in Version2.0

//Development/MyProject/Version2.0/Coord/File1.cs
//Development/MyProject/Version2.0/Coord/File2.cs
...
//Development/MyProject/Version2.0/Coord/Filen.cs
//Development/MyProject/Version2.0/Common/File1.cs
...
//Development/MyProject/Version2.0/Common/Filen.cs

I can do this by looking at what files have been checked out in Version1.0 and go to each directory in Version2.0 and checkout those files. This is tedious job.

Any aboveboard way of doing this?

1

There are 1 answers

0
Br.Bill On

From the linux/Unix/macOS shell, I suggest the following method. It would be significantly different in Windows unless you had unix tools installed there.

  1. Check out all your Version1.0 files.
  2. cd to your Version1.0 directory
  3. Run the following command line:

p4 opened ... | sed 's/\#[1-9].*$//' | sed 's/\/Version1.0\//\/Version2.0\//' | p4 -x - edit

Note: this would need some tweaking if any of your files have '#' symbols in their names. It's a quick-and-dirty fix. And credit to Bryan Pendleton above, who basically said the same thing much more briefly.