[RFC][PATCH]: Add 'switch' command

Kevin Smith yarcs at qualitycode.com
Wed Jun 22 20:21:19 UTC 2005


Matt Mackall wrote:
> On Wed, Jun 22, 2005 at 08:21:41AM -0400, Kevin Smith wrote:
> 
>>I would expect to be able to do something simple like:
>>
>>   hg co 1.0.2
>>   ...work...
>>   hg commit
>>   hg co 3.6
>>   ...work...
>>   hg commit
> 
> 
> This won't work at present. It's unclear to Mercurial if your intent
> is to merge 3.6 into your working directory, or switch over to it
> wholesale. For the former, you'll need -m, for the latter you'll need
> -C.

Hm. Seems to me that checkout, by definition, means to clobber what I 
have. If I wanted to do some kind of merge, I would have used the merge 
command instead.

Checkout in a populated directory should fail if there is any 
uncommitted work, but otherwise I would like to see it go ahead and just 
do what I asked.

I'm going by the 0.5 manpage that's up on the web site, by the way, 
which doesn't mention the -C and -m switches, so I'm not even sure which 
command they apply to.

> But it's theoretically possible to want to move your working dir
> changes over to the other branch without doing a merge. That could be
> done perhaps by backing up to the common ancestor and then jumping
> forward to the requested version. All a little strange, yes, but
> potentially useful.

Sure. But that case shouldn't be the default, and doesn't have to be as 
obvious as the "normal" case of simply switching to a different branch.

At least, that's my perspective.

Kevin



More information about the Mercurial mailing list