Pondering revert after merge

Patrick Mézard pmezard at gmail.com
Wed May 14 15:11:52 CDT 2008


Adrian Buehlmann a écrit :
> After having expanded TutorialMerge on the wiki,
> I asked myself again why doing a "hg revert -all"
> after a "hg merge" shouldn't also change the parents
> of the working dir back to the single parent 1 like
> before the merge (instead of leaving the two parents
> as caused by the "hg merge").
> 
> Stupidly committing such a failed "undoing the merge"
> creates quite a messy merge in the repo.
> 
> To undo a "hg merge" before committing, we currently
> must use "hg update -C -r <id>" because revert doesn't
> change parents.

Or the shorter "hg update -C ." to get back to the first parent.
 
> While this is usually fine (revert not changing parent),
> and can be used for tricks like ConcatenatingChangesets,
> it feels a bit odd, since revert is such a common knee jerk
> reaction if any fishy feeling comes up after tweaking
> the working dir.

Right, but reverting the working directory to a given revision content while preserving its parent(s) is useful to cancel a recent changeset, or to ignore changes brought by a merged parent. IMHO, understanding the distinction between the working directory and its location in the revision graph is important when working with DVCS.

--
Patrick Mézard


More information about the Mercurial mailing list