hg switch

Jordi Gutiérrez Hermoso jordigh at octave.org
Thu Oct 23 11:48:14 CDT 2014


On Thu, 2014-10-23 at 19:28 +0300, anatoly techtonik wrote:
> On Mon, Oct 20, 2014 at 7:55 PM, Jordi Gutiérrez Hermoso
> <jordigh at octave.org> wrote:
> > On Sat, 2014-10-18 at 21:17 +0300, anatoly techtonik wrote:
> >> http://git-legit.org/
> >>
> >> $ git switch <branch>
> >> # Switches to branch. Stashes and restores unstaged changes.
> >
> > I don't quite get this. It seems to me like the real problem is
> >
> >     http://bz.selenic.com/show_bug.cgi?id=4404
> 
> The problem described there is about warning if there is merge danger
> ahead of doing operation.

No, no, read the issue. It's about aborting an update that has already
happened. Right now hg refuses to do that update in some cases, and
people work around that refusal by shelving. I don't think this is the
right way.

The user experience should be, update (or its synonym, switch) to a
different branch, sure, no questions asked. Ah, but there's a merge
conflict. Do you want to resolve this merge conflict or do you want to
just undo the update? Both options should be available.

Right now the shelving and unshelving only gets you the "no questions
asked" part, that is, it allows you to update. I think this should
always be allowed, or perhaps it should become an extra flag to
update, like `hg update --i-am-ready-to-handle-trouble`, but even
then, you should have an option to forget. That flag,
--i-am-ready--..., should not be a contract written in blood.

My point is that `hg update` should already be your `hg switch`
command. That git's legit decided to implement this using stashes is
an implementation detail we need not follow.




More information about the Mercurial-devel mailing list