If you would want a complete changeset being undone, it could be done without manual work by using hg backout
. From its help:
hg backout [OPTION]... [-r] REV
reverse effect of earlier changeset
Prepare a new changeset with the effect of REV undone in the current
working directory. If no conflicts were encountered, it will be committed
immediately.
If REV is the parent of the working directory, then this new changeset is
committed automatically (unless --no-commit is specified).
Note:
'hg backout' cannot be used to fix either an unwanted or incorrect
merge.
However as you only want a single hunk reverted, you can use hg backout
and then you need to use the --interactive
flag for the commit so that you can pick the right hunk(s) to be committed:
hg commit --message "Revert some stuff" --interactive
Last, revert the working dir to a now unmodified state - you don't want to change back the remaining hunks