git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: git@vger.kernel.org, Bert Wesarg <bert.wesarg@googlemail.com>
Subject: [PATCH 2/2] git-gui: support for diff3 conflict style
Date: Wed, 30 Mar 2011 08:44:46 +0200	[thread overview]
Message-ID: <56c38bdfd71d8af5633bea00cb130256d6981af5.1301467146.git.bert.wesarg@googlemail.com> (raw)
In-Reply-To: <AANLkTin4-1_bNuH2kQ0m6wpevnO5uCJUmLvy=gP4mLfH@mail.gmail.com>

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@googlemail.com>
---

Maybe it's not too late for the next release.

 git-gui.sh   |    3 +++
 lib/diff.tcl |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index d5c1535..6adcda6 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3388,6 +3388,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/lib/diff.tcl b/lib/diff.tcl
index 39e4d90..11f9e16 100644
--- a/lib/diff.tcl
+++ b/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] \
@@ -439,10 +440,21 @@ proc read_diff {fd conflict_size cont_info} {
 			{++} {
 				set regexp [string map [list %conflict_size $conflict_size]\
 								{^\+\+([<>=]){%conflict_size}(?: |$)}]
+				set regexp_pre_image [string map [list %conflict_size $conflict_size]\
+								{^\+\+\|{%conflict_size}(?: |$)]
 				if {[regexp $regexp $line _g op]} {
 					set is_conflict_diff 1
 					set line [string replace $line 0 1 {  }]
 					set tags d$op
+					set ::in_conflict_pre_image 0
+				} elseif {[regexp $regexp_pre_image $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_++
 				}
-- 
1.7.4.1.1319.ga04f7.dirty

  reply	other threads:[~2011-03-30  6:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16  7:49 [PATCH] git-gui: respect conflict marker size Bert Wesarg
2010-11-16  9:21 ` [PATCHv2 1/2] " Bert Wesarg
2010-11-16  9:26   ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2010-11-19 11:41     ` Pat Thoyts
2010-11-19 12:05       ` Bert Wesarg
2011-02-27 20:15       ` Bert Wesarg
2011-03-30  6:44         ` Bert Wesarg [this message]
2011-03-30  7:18           ` [PATCH 2v2/2] " Bert Wesarg
2011-10-20 19:35             ` Bert Wesarg
2010-11-19 11:20   ` [PATCHv2 1/2] git-gui: respect conflict marker size Pat Thoyts
2010-11-19 11:48     ` Bert Wesarg
  -- strict thread matches above, loose matches on Subject: below --
2019-09-25 20:38 [PATCH 1/2] git-gui: use existing interface to query a path's attribute Bert Wesarg
2019-09-25 20:38 ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2019-09-29 15:04   ` Pratyush Yadav
2019-09-30 12:17     ` Bert Wesarg
2019-10-03 20:02       ` Philip Oakley
2019-10-03 20:54         ` Pratyush Yadav
2019-10-03 21:40           ` Philip Oakley
     [not found]             ` <CAKPyHN0_AUqLpPVDNJUZqNV8zRQzaDOMXJV4AbnK969AdtGpNg@mail.gmail.com>
2019-10-04 16:09               ` Philip Oakley
2010-11-15 10:04 [PATCH] git-gui: support for underline styles Bert Wesarg
2010-11-19 10:00 ` Pat Thoyts
2010-11-19 10:55   ` Bert Wesarg
2011-02-27 20:04   ` Bert Wesarg
2011-03-30  6:44     ` [PATCH 1/2] " Bert Wesarg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56c38bdfd71d8af5633bea00cb130256d6981af5.1301467146.git.bert.wesarg@googlemail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=patthoyts@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).