[PATCH] merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'

Brodie Rao brodie at bitheap.org
Thu Sep 2 11:09:11 CDT 2010


On Sep 2, 2010, at 11:26 AM, Martin Geisler wrote:

> Brodie Rao <brodie at bitheap.org> writes:
>
>> # HG changeset patch
>> # User Brodie Rao <brodie at bitheap.org>
>> # Date 1283371843 14400
>> # Node ID 950086b9dff8c05fbc454f7c95da23792e33c71f
>> # Parent  a55e3c50868fc2e827f44187c7fd3f6c4e2f3f31
>> merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'
>>
>> Without specifying the parent revision of the working copy, users  
>> will
>> update to tip, which is most likely the other head they were trying  
>> to
>> merge, not the revision they were at before the merge.
>>
>> diff -r a55e3c50868f -r 950086b9dff8 mercurial/merge.py
>> --- a/mercurial/merge.py	Wed Sep 01 15:23:21 2010 +0200
>> +++ b/mercurial/merge.py	Wed Sep 01 16:10:43 2010 -0400
>> @@ -448,7 +448,7 @@ def update(repo, node, branchmerge, forc
>>     * = don't-care
>>     1 = abort: crosses branches (use 'hg merge' or 'hg update -c')
>>     2 = abort: crosses branches (use 'hg merge' to merge or
>> -                 use 'hg update -C' to discard changes)
>> +                 use 'hg update -C .' to discard changes)
>>     3 = abort: uncommitted local changes
>>     4 = incompatible options (checked in commands.py)
>>     """
>> @@ -494,7 +494,8 @@ def update(repo, node, branchmerge, forc
>>                 pass # all good
>>             elif wc.files() or wc.deleted():
>>                 raise util.Abort(_("crosses branches (use 'hg  
>> merge' to merge "
>> -                                 "or use 'hg update -C' to discard  
>> changes)"))
>> +                                   "or use 'hg update -C .' to  
>> discard "
>> +                                   "changes)"))
>
> I don't think these two hunks should change -- that warning is for the
> case where a user does 'hg update X' with a dirty working copy.

Whoops. I'll remove that from the patch.

> The text is actually a bit too short, it should really say:
>
>  crosses branches (use 'hg merge %s' to merge or use 'hg update -C %s'
>  to discard changes
>
> where %s is replaced with the revision the user is trying to update  
> to.
>
> In a similar way, I always liked how old versions of Mercurial would
> tell me exactly what I needed to do in order to abandon a merge and  
> get
> back to where I were or restart it -- the messages like this one:
>
>  There are unresolved merges, you can redo the full merge using:
>    hg update -C 123
>    hg merge 234
>
> It make Mercurial look very helpful and aware of what is going on.

I'll take a look at adding the revision to the message in a separate  
patch.

> -- 
> Martin Geisler
>
> Mercurial links: http://mercurial.ch/



More information about the Mercurial-devel mailing list