Re: [PATCH 2/2] git-gui: support for diff3 conflict style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 19, 2010 at 12:41, Pat Thoyts
<patthoyts@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> writes:
>
>>This adds highlight support for the diff3 conflict style.
>>
>>The common pre-image will be reversed to --, because it has been removed
>>and either replaced with our or their side.
>>
>>Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>
>>
>>---
>> git-gui/git-gui.sh  |  Â3 +++
>> git-gui/lib/diff.tcl | Â 10 ++++++++++
>> 2 files changed, 13 insertions(+), 0 deletions(-)
>>
>>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
>>index 38362fa..0134438 100755
>>--- a/git-gui/git-gui.sh
>>+++ b/git-gui/git-gui.sh
>>@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \
>> $ui_diff tag conf d< \
>> Â Â Â -foreground orange \
>> Â Â Â -font font_diffbold
>>+$ui_diff tag conf d| \
>>+ Â Â Â-foreground orange \
>>+ Â Â Â-font font_diffbold
>> $ui_diff tag conf d= \
>> Â Â Â -foreground orange \
>> Â Â Â -font font_diffbold
>>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
>>index d4e2ce3..ccd4c70 100644
>>--- a/git-gui/lib/diff.tcl
>>+++ b/git-gui/lib/diff.tcl
>>@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
>> Â Â Â }
>>
>> Â Â Â set ::current_diff_inheader 1
>>+ Â Â Âset ::in_conflict_pre_image 0
>> Â Â Â fconfigure $fd \
>> Â Â Â Â Â Â Â -blocking 0 \
>> Â Â Â Â Â Â Â -encoding [get_path_encoding $path] \
>>@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â set is_conflict_diff 1
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â set line [string replace $line 0 1 { Â}]
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â set tags d$op
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset ::in_conflict_pre_image 0
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â} elseif {[regexp {^\+\+\|{$conflict_size}(?: |$)} $line]} {
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset is_conflict_diff 1
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset line [string replace $line 0 1 { Â}]
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset tags d|
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset ::in_conflict_pre_image 1
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â} elseif ($::in_conflict_pre_image) {
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset line [string replace $line 0 1 {--}]
>>+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âset tags d_--
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } else {
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â set tags d_++
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â }
>
> This has the same issue as the last patch with variable substitution
> into the regexp. Replaced the regexp expression with
> Â [regexp "^\\+\\+\\|{$conflict_size}(?: |\$)" $line]
>
> I configured a test repository with
> 'merge.conflictstyle diff3' and could test this. Looks fine.

Thanks Pat.

By looking over the patch (which by itself is now some month old) I
wondered whether git-gui has some policy to show the diff output as
verbatim as possible. Which I break with this patch, because I replace
the ++ line prefix in the pre-image with -- and in the |||| lines with
"  ". Shawn, does such policy exists?

Bert

> --
> Pat Thoyts              Âhttp://www.patthoyts.tk/
> PGP fingerprint 2C 6E 98 07 2C 59 C8 97 Â10 CE 11 E6 04 E0 B9 DD
>
ÿô.nlj·Ÿ®‰­†+%ŠË±é¥Šwÿº{.nlj· ŠßžØn‡r¡öë¨è&£ûz¹Þúzf£¢·hšˆ§~†­†Ûÿÿïÿ‘ê_èæ+v‰¨þ)ßø

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]