[PATCH] conflicts: make spacing consistent in conflict markers

Yuya Nishihara yuya at tcha.org
Sat Nov 19 23:12:52 EST 2016


On Sat, 19 Nov 2016 15:42:54 -0800, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1479598897 28800
> #      Sat Nov 19 15:41:37 2016 -0800
> # Node ID 5f03a63d6def1cf3c34fa7f8979c34151a9ba660
> # Parent  0c3a8b6239db2c0d6a0e9ddea2266445bca2d440
> conflicts: make spacing consistent in conflict markers
> 
> The way default marker template was defined before this patch,
> the spacing before dash in conflict markes was dependent on
> whether changeset is a tip one or not. This is a relevant part
> of template:
>     '{ifeq(tags, "tip", "", "{tags} "}'
> If revision is a tip revision with no other tags, this would
> resolve to an empty string, but for revisions which are not tip
> and don't have any other tags, this would resolve to a single
> space string. In the end this causes weirdnesses like the ones
> you can see in the affected tests.
> 
> This is a not a big deal, but double spacing may be visually
> less pleasant.
> 
> Please note that test changes where commit hashes change are
> the result of marking files as resolved without removing markers.
> 
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -518,7 +518,8 @@ def _formatconflictmarker(repo, ctx, tem
>      return util.ellipsis(mark, 80 - 8)
>  
>  _defaultconflictmarker = ('{node|short} '
> -                          '{ifeq(tags, "tip", "", "{tags} ")}'
> +                          '{ifeq(tags, "tip", "", '
> +                           'ifeq(tags, "", "", "{tags} "))}'
>                            '{if(bookmarks, "{bookmarks} ")}'
>                            '{ifeq(branch, "default", "", "{branch} ")}'
>                            '- {author|user}: {desc|firstline}')

Maybe we can use separate() function.


More information about the Mercurial-devel mailing list