Eddie Parker
Eddie Parker

Reputation: 4888

Perforce: repair broken history

I have a set of files that someone meant to integrate, but accidentally just 'added', which lost all the history.

Unfortunately this happened a long time ago, so things like the timelapse view and history end at that copy.

Is there a way to repair this mistake? Can I somehow tell Perforce "this change was actually an integrate from this file at this changelist"?

Upvotes: 1

Views: 190

Answers (1)

Samwise
Samwise

Reputation: 71454

The only way to do this retroactively is via checkpoint hacking -- you'd need to synthesize "add from" db.integed records.

https://www.perforce.com/perforce/doc.current/schema/#db.integed

As checkpoint hacking goes this is relatively easy since you only need to add to one table (it's fine to hang "add from" records off an existing "add" rev), but you need to be pretty comfortable with Perforce's p4d -j* commands and Perforce's data model. Note that for consistency you want both the "add from" and "add into" records (with one being an inverse of the other).

The easiest way to get familiar with how this works if you're totally new to it is to spin up a test server, create an "add from" record by doing:

echo asdf > foo
p4 add foo
p4 submit -d "add"
p4 integ foo bar
p4 add bar
p4 submit -d "add from"

then take a checkpoint (p4d -jc) and look at the checkpoint file, particularly the relationships between db.rev and db.integed. It's all pretty straightforward and you can apply the same logic to synthesize db.integed records for your added files in your real depot (and then use p4d -jr to apply your hacked journal to the actual database).

Upvotes: 1

Related Questions