Bowser
Bowser

Reputation: 397

Perforce - "rebase" a previous submission

So, a while back, I p4 submitted some changes. Then I realized that it wasn't the right time to do that yet. So I immediately made another submission which is the inverse of Change 1. I used the method described under "Backing out an old changelist with adds and deletes as well as edits" in http://answers.perforce.com/articles/KB/3474/

Now it's the right time for Change 1, and it should be essentially "rebased" on top of all the changes that have been made since then, as if it's a new submission.

$ p4 changes -m 5 ...
Change 5 on 2015/02/16 by person1 'message'
Change 4 on 2015/02/16 by person2 'message'
Change 3 on 2015/02/16 by person3 'message'
Change 2 on 2015/02/12 by me 'Undo the previous submission'
Change 1 on 2015/02/12 by me 'submission'

Looking at the documentation, it's not clear to me how to do this. I tried to do:

$ p4 submit -c 1
Change 1 is already committed.

Any advice?

Upvotes: 2

Views: 3454

Answers (2)

jamesdlin
jamesdlin

Reputation: 89965

Perforce does not have a special notion of backing out a change. When you back out change N, you're actually just submitting a new change that is the inverse of N. (That is, it removes lines that change N added, adds back lines that change N removed, etc.)

Suppose that you submit change B that backs out change N. If you later want to reapply change N, you therefore should back out change B: you're applying the inverse change of the inverse change to get back the original.

Upvotes: 0

Samwise
Samwise

Reputation: 71454

Follow the same "back out" steps, but this time back out change 2:

  1. sync to change 1
  2. open
  3. sync to change 2
  4. ignore
  5. sync subsequent changes
  6. merge

The merge result will contain the changes from 1 on top of subsequent changes, and you're ready to submit.

Upvotes: 2

Related Questions