2

Is there a way to undo a specific change in Perforce? i mean not just rolling back to certain revision...

For example, i have the file "test.txt" in revisions #10, #11, #12:

The revision #10 contains:
1
2
3

Revision #11 contains:
1
2
3
3

And Revision #12 contains:
1
2
3
3
4

My file is in revision #12, and i want to 'subtract' the revision #11, which added one more '3'.

From my knowledge, i would need to sync to a previous revision (#10), and then update my file to last revision and resolve it manually, in order to keep the changes made to #10 and #12.

I wonder if there is an automatic way to do that? I know i can integrate a specifc change to a file like:

p4 integrate //depot/v1/test.txt#11,#11 //depot/v2/test.txt
but what i want here is the opposite, i mean, subtract that specifc revision..

In CVS it was possible doing this way:
cvs update -j (upper revision) -j (lower revision)

And in Git:

git.exe revert --no-edit --no-commit e5bf3a2cfc6edb4b7fa34233de458131d87e2d74

2 Answers 2

2

I believe you are looking for this: Backing Out Submitted Changelists

That article is more general, and discusses more cases than yours, but the steps are still the same and work fine for your case.

Look in particular at the subsection entitled: Backing out an old changelist (edits only)

1
  • Thank you very much for the answer. It still does not convince me though, there should be a command that would do these steps automatically, or even a replace (from the bad changes to '')... i dont know.. It just seems too much work for a task that should be simple. But the solution works for now, and that's what matters. Thank you!
    – Bruno Brs
    May 28, 2014 at 14:15
0

With more recent versions of P4D you can use p4 undo, e.g.:

p4 undo test.txt#11

or:

p4 undo @123

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.