Jump to content

Sanity check on obliterating bad changes behind good ones.

integrate shelve obliterate best practices

  • Please log in to reply
1 reply to this topic

#1 hanoixan



  • Members
  • Pip
  • 2 posts

Posted 18 July 2017 - 02:16 PM

Over the last couple days there had been a number of bad commits to our depot. File type settings on two separate branches, integrations between them, and bad resolves (all our fault) left our depot in a state that couldn't be easily integrated between these two branches.

Considering the two branches A and B as two stacks of changelists, we had something like the following:
  A: A0, A1, A2, A3(badTypeChanges), A4(badIntegrateBtoA), A5(rollbackToA2), A6, A7
  B: B0, B1, B2, B3(badTypeChanges), B4(rollbackToB2)

A little more complex than this, but you get the idea. Trying to integrate from B back to A became impossible because it seemed like some history had been lost and even a force integrate would have been a very involved resolve. I would have thought the rollbacks would have solved this, though.

So, I locked the depot and took a few hours to clean things up with obliterate and shelve.

1. I knew I wanted A6 and A7, but there was no direct way to say to perforce "convert this committed changelist into a shelf to be applied later". So, in reverse commit order, I ended up doing a double backout of each one, and then shelving the backed out backouts, as A8(sh7) and A9(sh6). This was effectively the shelf of the changelist.

My two branches now looked like this:
  A: A0, A1, A2, A3(badTypeChanges), A4(badIntegrateBtoA), A5(rollbackToA2), A6, A7, A8(sh7), A9(sh6)
  B: B0, B1, B2, B3(badTypeChanges), B4(rollbackToB2)

2. I obliterated -y A9...A3, and B4..B3.

3. I then unshelved A6sh and A7sh using an identity branch mapping, effectively a baseless unshelve, since some of the files' source revisions were now obliterated.

Everything appears to be fine now. Was there a better way?

#update 2017/07/19:

So it appears I could have just followed the advice here: http://answers.perfo...rticles/KB/3474 without obliterating?

#2 p4rfong


    Advanced Member

  • Staff Moderators
  • 343 posts

Posted 19 July 2017 - 06:09 PM

The very best way to undo an integration is to use obliterate starting with the most recent and working backwards.  So your way was the best way.
See "How to Rollback An Integration"


Also tagged with one or more of these keywords: integrate, shelve, obliterate, best practices

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users