[PATCH 3 of 9] update: add error message for dirty non-linear update with no rev
Matt Mackall
mpm at selenic.com
Tue Sep 24 18:09:47 UTC 2013
On Tue, 2013-09-24 at 09:09 +0200, Martin Geisler wrote:
> 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.
I think this is fine, as it's explicit that it loses changes. I think a
lot of people are confused by revert and/or annoyed by orig files so
it's not clear that suggesting revert would result in a net increase in
happiness.
> 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'.
Yep. The answer to this might be shelve in the near future. There have
been a couple discussions about a --keep-my-changes-across-branch option
for update, but they haven't gone anywhere. Can't be on by default
because hopping branches by default is a known cause of user confusion.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list