Arnaud
Arnaud

Reputation: 5122

Undo last diff in Phabricator

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?

Upvotes: 18

Views: 28170

Answers (3)

seato
seato

Reputation: 2131

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.

Upvotes: 12

Evan Priestley
Evan Priestley

Reputation: 3297

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)

Upvotes: 4

altendky
altendky

Reputation: 4354

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.

Upvotes: 6

Related Questions