hg update without -C to switch branches

Florent Guillaume fg at nuxeo.com
Sat Mar 22 13:12:32 CDT 2008


On 22 Mar 2008, at 19:03, Matt Mackall wrote:
>
> On Sat, 2008-03-22 at 17:41 +0100, Florent Guillaume wrote:
>> Hi,
>>
>> Would there be opposition to not having the
>>   update spans branches, use 'hg merge' or 'hg update -C' to lose  
>> changes
>> message when you update to a different branch but there are no local
>> changes?
>>
>
> Something like this?
>
> diff -r 351da911f739 mercurial/merge.py
> --- a/mercurial/merge.py	Fri Mar 21 17:22:47 2008 -0500
> +++ b/mercurial/merge.py	Sat Mar 22 13:01:38 2008 -0500
> @@ -364,8 +364,11 @@
>                     raise util.Abort(_("there is nothing to merge,  
> just use "
>                                        "'hg update' or look at 'hg  
> heads'"))
>         elif not (overwrite or branchmerge):
> -            raise util.Abort(_("update spans branches, use 'hg  
> merge' "
> -                               "or 'hg update -C' to lose changes"))
> +            if wc.files() or wc.deleted():
> +                raise util.Abort(_("update spans branches, use 'hg  
> merge' "
> +                                   "or 'hg update -C' to lose  
> changes"))
> +            # Allow jumping branches if there are no changes
> +            overwrite = True
>         if branchmerge and not forcemerge:
>             if wc.files() or wc.deleted():
>                 raise util.Abort(_("outstanding uncommitted changes"))
>
> Seems reasonable.

Yes, exactly like this. Thanks!

Florent

-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87





More information about the Mercurial-devel mailing list