Jkh2
Jkh2

Reputation: 1030

Restore revision history of a copied file using Perforce

I copied a bunch of java classes into another java package outside of perforce by accident and made a bunch of changes to them. I now realised that the revision history of those files has been lost as I didn't use perforce to copy the files over.

Example:
original file - dir1/Class1.java 
copied file - dir2/Class1.java

The original file still exists.

If I want to restore the revision history of the files what would be the appropriate command to run in order to do this?

Upvotes: 1

Views: 298

Answers (1)

raven
raven

Reputation: 18135

You should have branched the file in Perforce rather than copied it outside of Perforce, but that can be remedied.

  1. Copy dir2/Class1.java to another location then delete the original
  2. Branch dir1/Class1.java to dir2/Class1.java
  3. Check out dir2/Class1.java
  4. Copy the backup of the file you made in step 1. to dir2/Class1.java
  5. Check in dir2/Class1.java

You will then have your recent modifications to the file dir2/Class1.java in version control and the file will be linked to its original via the branch history.

Upvotes: 2

Related Questions