There are many scenarios here where you can do this, I will make each script a heading so that you can find a script that suits your case. Please note that I am still learning Mercurial, and I would like pointers, if what I say, is wrong, using the wrong terminology, could do better, etc.
No additional changes, the union is not divided (no taps / pulls)
The programmer merged, but did nothing, and does not have (and) that he shared the changes with anyone, in any way
In this case, just drop the local clone and get a new clone from safe storage.
Local changes on top of the merge, not general
The programmer merged and continued working on the basis of this merger. The changes that follow the merge must be saved, but the merge itself must be deleted. Changes (merge + next changes) were not transferred to anyone
In this case, I would do one of four:
- Try using the REBASE extension, this will move the change sets from one place to another. If the changes are based on code changes that were entered with the merge, you must do manual work to reconcile the differences.
- Try using the MQ extension to pull out the set of changes that should be stored in the patch queue, and then discard them elsewhere. This, however, will have the same problem as the REBASE extension in terms of merge-based changes
- Try using the TRANSPLANT extension to “copy” changes from one place to another. However, the same problem exists as in the first two.
- Repeat this work, perhaps with a sophisticated tool, to make changes to the change sets that I want to reset and repeat them in the right place.
To get rid of the merge changeset + of all the following changesets, there are several options:
Use the strip command in the MQ extension
hg strip <hash of merge changeset>
Clone and pull, and also specify the hash of the change sets that precede, but not include, the merge. In essence, create a new clone by pulling from a damaged clone into a new one and avoid pulling in a merge that you don't want.
hg clone damaged -r <hash of first parent> . hg pull damaged -r <hash of second parent>
Merging with others, clone control
The programmer clicked on the master repository or someone else, or someone pulled the programmers out of the repository. However, you (as in the development team) manage all the repositories, as you can chat and talk with everyone before you do more work.
In this case, I would see if it is possible to do step 1 or 2, but it can be done in many places, so it can require a lot of work.
If no one did the work based on a set of merge changes, I would use steps 1 or 2 to clear, then click on the master repository and ask everyone to get a new clone from the main repository.
Compression pressed, you have no clone control
The programmer clicked the merge, and you do not know who will have the set of merge changes. In other words, if you manage to eradicate it from your repositories , a wandering push from someone who still has it will return it.
Ignore the merge change set and work on the two branches as if that didn't happen. This will leave a drooping head. You can later later, when you merge the two branches, do a zero merge for this head to get rid of it.
M <-- this is the one you want to disregard / \ * * | | * * | |
Just keep working in two branches:
| | * * | M | <-- this is the one you want to disregard |/ \| * * | | * * | |
Then you combine the two, the real merge you want:
m / \ * * | | * * | M | <-- this is the one you want to disregard |/ \| * * | | * * | |
You can then perform a zero merge to get rid of a saggy head. Unfortunately, I do not know how to do this, except through TortoiseHg. It has a checkbox where I can discard changes from one of the branches.
With TortoiseHg, I upgrade to the merge that I want to save (upper, lowercase m), then select and right-click on the ragged merge head below, and then check the "Discard all changes from the merge target (other) edition": 