Pondering revert after merge
Adrian Buehlmann
adrian at cadifra.com
Wed May 14 17:34:54 CDT 2008
On 14.05.2008 22:11, Patrick Mézard wrote:
> Adrian Buehlmann a écrit :
>> 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.
Good point, yes, but this brings up yet another newbie-scaring
message:
$ hg update -C .
warning: working directory has two parents, tag '.' uses the first
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
and the "-C" is Mercurial's ultimate sledgehammer, because it doesn't
care about local modifications and thus leaves no .orig files
>> 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.
I'm not really disputing that. But I'm looking for ways to separate
these problems.
> IMHO, understanding the distinction between the working directory and its location in the revision graph is important when working with DVCS.
It's always good to know what happens. But revert being unable
to "revert" a uncommitted merge is at least non-intuitive.
Anyway, revert --all is already hammered in stone since changing
its semantic would violate CompatibilityRules as written on the wiki.
In fact, "revert --all" really means "all files" and nothing else but the
files.
So what else could we specify and implement?
One of:
(1) "revert -m" aka "revert --merge"
(2) "revert -am" aka "revert --all --merge"
(3) "revert -ap" aka "revert --all --parent"
(4) "revert -t" aka "revert --total"
(5) "revert -m" aka "revert --modifications"
(6) "revert -e" aka "revert --everything"
(7) "revert -l" aka "revert --localmodifications"
(8) "revert -w" aka "revert --workingdir"
The effect of which should be the equivalent of
(a) hg revert --all -r . && hg update -C -r .
which differs to
(b) hg update -C -r .
in that (a) leaves .orig files which (b) doesn't
More information about the Mercurial
mailing list