17

I have an open revision in Phabricator (with Git), and I submitted a diff to this revision, with the arc diff command.

The problem is that this diff is bad, and so I would like to undo it and to come back to the previous diff.

Do you know how can I do please?

3 Answers 3

11

I often make the mistake of diff'ing against the wrong branch.

The first step is to undo the diff. We can't kill the diff from the revision history, but we can revert it.

$ arc patch --diff <diff_id> # last good diff, creates <arcpatch-branch>
$ arc diff --update <revision_id> <arcpatch-branch> # "reverts" the offending diffs to the current state

At this point your revision is back to its original state. If you want to perform the diff again then do what you normally do. Checkout the branch with the changes intended for the diff and then perform the diff.

$ git checkout <new_branch>
$ arc diff <source_branch> # new_branch has changes that is intended to be merged into source_branch

Credit to altendky who listed most of these steps. However, the revision flag he referenced no longer exists and I also wanted the steps to be listed a bit more clearly.

2
  • 3
    Could someone clarify a bit what the different arguments are in this example? What's the difference between a revision_id and a diff_id? Jul 30, 2020 at 23:29
  • diff_id can be seen in "History" tab of Revision Contents section. Revision ID is the ID in the URL to reach that diff. https://<phab>/D12345
    – Naveen
    Nov 18, 2020 at 16:23
6

Disclaimer: I have limited Git experience and I am using Phabricator with SVN presently.

Assuming that you have no other local changes you could revert your working copy then arc patch --diff <diff_id> where the diff ID is shown in the ID column of the Revision Update History table. Then just arc diff --revision <rev_id> as usual to update. I suppose it's not technically a delete but so it goes with pseudo-revision-control. The mistake and correction will be tracked.

4

This is not currently supported. You can replace the bad diff with a new, good diff by following the process altendky recommends or any similar process (i.e., just run arc diff again with your working copy in the correct state).

This is a feature we intend to add eventually. You can follow the progress in the upstream here:

https://secure.phabricator.com/T1081 (Closed as won't fix)

1
  • 3
    For posterity, "This is a feature we intend to add eventually" is no longer true since the task linked was closed as "Won't Fix" with the comment "I believe this error should essentially never occur."
    – seato
    Jun 8, 2017 at 16:33

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.