This script undoes side effects of "Fixes Txxx" (and similar) if a lot of commits from some other source are pushed to a tracked + autoclose repository in a way that doesn't trigger import mode.
- Put this script in phabricator/.
- Give it chmod +x.
- At the top of the script:
- Configure $repository_ids to be a list of repository IDs where problem commits were pushed.
- Set $epoch_start to the beginning of the incident (default: 24 hours ago).
- Set $epoch_end to the end of the incident (default: now).
The script is safe (performs no writes) as long as you do not pass --write. The --write flag is dangerous and permanently destroys data.
To begin with, identify one affected task. Run this to see how it would be repaired:
phabricator/ $ ./undo_transactions.php T123
If that looks good, repair the task:
phabricator/ $ ./undo_transactions.php T123 --write
If that looks good too, do it a few more times on other tasks, then preview the effects of repairing everything like this:
phabricator/ $ ./undo_transactions.php --all
Finally, repair everything:
phabricator/ $ ./undo_transactions.php --all --write
Here's an example of the output: