[PATCH 3 of 9] update: add error message for dirty non-linear update with no rev
Martin Geisler
martin at geisler.net
Tue Sep 24 02:09:48 CDT 2013
Siddharth Agarwal <sid0 at fb.com> writes:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1379992050 25200
> # Mon Sep 23 20:07:30 2013 -0700
> # Node ID 3c9d933940fabae7052a1bdad0eb9b47e61fb455
> # Parent eddb6f0b067c90910adb968dfb7eb798961e0ab2
> update: add error message for dirty non-linear update with no rev
>
> Previously, the error message for a dirty non-linear update was the
> same (and relatively unhelpful) whether or not a rev was specified.
> This patch and an upcoming one will introduce separate, more helpful
> hints.
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -656,19 +656,21 @@
> -c -C dirty rev | linear same cross
> n n n n | ok (1) x
> n n n y | ok ok ok
> - n n y * | merge (2) (2)
> + n n y n | merge (2) (2)
> + n n y y | merge (3) (3)
> n y * * | --- discard ---
> - y n y * | --- (3) ---
> + y n y * | --- (4) ---
> y n n * | --- ok ---
> - y y * * | --- (4) ---
> + y y * * | --- (5) ---
>
> x = can't happen
> * = don't-care
> 1 = abort: not a linear update (merge or update --check to force update)
> 2 = abort: crosses branches (use 'hg merge' to merge or
> use 'hg update -C' to discard changes)
> - 3 = abort: uncommitted local changes
> - 4 = incompatible options (checked in commands.py)
> + 3 = abort: uncommitted changes (commit or update --clean to discard changes)
I know you didn't introduce this behaviour originally and that you're
just making the existing message more clear. But is this not bad advice?
I almost *never* want to use 'hg update --clean'. It's a bad option
since it throws away data. Suggesting that people use 'hg revert' would
be better IMHO since that gives them backup files by default.
Further: if I say 'hg update X', and Mercurial aborts, then I must go
through the 'hg update "ancestor(., X)"; hg update X' dance. What I
really need in that situation is for Mercurial to help me move (merge)
them into the target revision. It is extremely rare that I want to throw
away my changes with 'hg update --clean'.
--
Martin Geisler
More information about the Mercurial-devel
mailing list