For clarity to other readers: the actual HG shelve command is not the correct approach for this situation; it does not work on already-committed changes, but nor is it necessary to use in this case.
Here's what you can do:
- In dev, update to the version before the commits you don't want to push to testing.
- Make your desired changes in dev and commit. This will create a new head (which will also be the new tip).
- Push to testing
- In dev, merge the tip with the other head that contains the changes you have avoided pushing, then commit.
Original suggestion (not possible to implement in this case):
- Clone dev into a new repo and update to the version before the commits (or just clone testing instead)
- Make the change you want, commit and push to both testing and dev
- Discard the clone
- Pull the testing from testing into dev and merge the heads at your leisure, establishing a single head once more