{"thread":{"id":"25758","subject":"[PATCH] git-gui: respect conflict marker size","startedAt":"2010-11-16T07:49:22Z","lastAt":"2011-10-20T19:35:25Z","messageCount":11,"participants":["Bert Wesarg","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"155982","messageId":"1289893762-28567-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25758","inReplyTo":null,"subject":"[PATCH] git-gui: respect conflict marker size","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-16T07:49:22Z","receivedAt":"2010-11-16T07:49:22Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Respect the conflict-marker-size attribute on paths when detecting merge\nconflicts.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n git-gui/lib/diff.tcl |   22 ++++++++++++++++++----\n 1 files changed, 18 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex dcf0711..a753737 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {\n \t}\n }\n \n+proc get_conflict_marker_size {path} {\n+\tset size 7\n+\tcatch {\n+\t\tset fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n+\t\tset ret [gets $fd_rc line]\n+\t\tclose $fd_rc\n+\t\tif {$ret > 0} {\n+\t\t\tregexp {.*: conflict-marker-size: (\\d+)$} $line line size\n+\t\t}\n+\t}\n+\treturn $size\n+}\n+\n proc start_show_diff {cont_info {add_opts {}}} {\n \tglobal file_states file_lists\n \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \tset is_submodule_diff 0\n \tset diff_active 1\n \tset current_diff_header {}\n+\tset conflict_size [get_conflict_marker_size $path]\n \n \tset cmd [list]\n \tif {$w eq $ui_index} {\n@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n \t\t-translation lf\n-\tfileevent $fd readable [list read_diff $fd $cont_info]\n+\tfileevent $fd readable [list read_diff $fd $conflict_size $cont_info]\n }\n \n proc parse_color_line {line} {\n@@ -349,7 +363,7 @@ proc parse_color_line {line} {\n \treturn [list $result $markup]\n }\n \n-proc read_diff {fd cont_info} {\n+proc read_diff {fd conflict_size cont_info} {\n \tglobal ui_diff diff_active is_submodule_diff\n \tglobal is_3way_diff is_conflict_diff current_diff_header\n \tglobal current_diff_queue\n@@ -402,7 +416,7 @@ proc read_diff {fd cont_info} {\n \t\t\t{- } {set tags d_-s}\n \t\t\t{--} {set tags d_--}\n \t\t\t{++} {\n-\t\t\t\tif {[regexp {^\\+\\+([<>]{7} |={7})} $line _g op]} {\n+\t\t\t\tif {[regexp {^\\+\\+([<>]{$conflict_size} |={$conflict_size})} $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n@@ -441,7 +455,7 @@ proc read_diff {fd cont_info} {\n \t\t\t{@} {set tags d_@}\n \t\t\t{-} {set tags d_-}\n \t\t\t{+} {\n-\t\t\t\tif {[regexp {^\\+([<>]{7} |={7})} $line _g op]} {\n+\t\t\t\tif {[regexp {^\\+([<>]{$conflict_size} |={$conflict_size})} $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset tags d$op\n \t\t\t\t} else {\n-- \ntg: (6f10c41..) bw/git-gui/respect-conflict-marker-size (depends on: master)\n"},{"id":"155985","messageId":"1289899312-2732-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25758","inReplyTo":"1289893762-28567-1-git-send-email-bert.wesarg@googlemail.com","subject":"[PATCHv2 1/2] git-gui: respect conflict marker size","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-16T09:21:52Z","receivedAt":"2010-11-16T09:21:52Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Respect the conflict-marker-size attribute on paths when detecting merge\nconflicts.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\nv2 fixes the tags selection and also the regexp to match always exactly the\ndesired number of markers.\n\nBert\n\n git-gui/git-gui.sh   |    6 +++---\n git-gui/lib/diff.tcl |   22 ++++++++++++++++++----\n 2 files changed, 21 insertions(+), 7 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex d3acf0d..38362fa 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -3351,13 +3351,13 @@ $ui_diff tag conf d_s- \\\n \t-foreground red \\\n \t-background ivory1\n \n-$ui_diff tag conf d<<<<<<< \\\n+$ui_diff tag conf d< \\\n \t-foreground orange \\\n \t-font font_diffbold\n-$ui_diff tag conf d======= \\\n+$ui_diff tag conf d= \\\n \t-foreground orange \\\n \t-font font_diffbold\n-$ui_diff tag conf d>>>>>>> \\\n+$ui_diff tag conf d> \\\n \t-foreground orange \\\n \t-font font_diffbold\n \ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex dcf0711..d4e2ce3 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {\n \t}\n }\n \n+proc get_conflict_marker_size {path} {\n+\tset size 7\n+\tcatch {\n+\t\tset fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n+\t\tset ret [gets $fd_rc line]\n+\t\tclose $fd_rc\n+\t\tif {$ret > 0} {\n+\t\t\tregexp {.*: conflict-marker-size: (\\d+)$} $line line size\n+\t\t}\n+\t}\n+\treturn $size\n+}\n+\n proc start_show_diff {cont_info {add_opts {}}} {\n \tglobal file_states file_lists\n \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \tset is_submodule_diff 0\n \tset diff_active 1\n \tset current_diff_header {}\n+\tset conflict_size [get_conflict_marker_size $path]\n \n \tset cmd [list]\n \tif {$w eq $ui_index} {\n@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n \t\t-translation lf\n-\tfileevent $fd readable [list read_diff $fd $cont_info]\n+\tfileevent $fd readable [list read_diff $fd $conflict_size $cont_info]\n }\n \n proc parse_color_line {line} {\n@@ -349,7 +363,7 @@ proc parse_color_line {line} {\n \treturn [list $result $markup]\n }\n \n-proc read_diff {fd cont_info} {\n+proc read_diff {fd conflict_size cont_info} {\n \tglobal ui_diff diff_active is_submodule_diff\n \tglobal is_3way_diff is_conflict_diff current_diff_header\n \tglobal current_diff_queue\n@@ -402,7 +416,7 @@ proc read_diff {fd cont_info} {\n \t\t\t{- } {set tags d_-s}\n \t\t\t{--} {set tags d_--}\n \t\t\t{++} {\n-\t\t\t\tif {[regexp {^\\+\\+([<>]{7} |={7})} $line _g op]} {\n+\t\t\t\tif {[regexp {^\\+\\+([<>=]){$conflict_size}(?: |$)} $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n@@ -441,7 +455,7 @@ proc read_diff {fd cont_info} {\n \t\t\t{@} {set tags d_@}\n \t\t\t{-} {set tags d_-}\n \t\t\t{+} {\n-\t\t\t\tif {[regexp {^\\+([<>]{7} |={7})} $line _g op]} {\n+\t\t\t\tif {[regexp {^\\+([<>=]){$conflict_size}(?: |$)} $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset tags d$op\n \t\t\t\t} else {\n-- \ntg: (6f10c41..) bw/git-gui/respect-conflict-marker-size (depends on: master)\n"},{"id":"155986","messageId":"1289899618-2845-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25758","inReplyTo":"1289899312-2732-1-git-send-email-bert.wesarg@googlemail.com","subject":"[PATCH 2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-16T09:26:58Z","receivedAt":"2010-11-16T09:26:58Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This adds highlight support for the diff3 conflict style.\n\nThe common pre-image will be reversed to --, because it has been removed\nand either replaced with our or their side.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n git-gui/git-gui.sh   |    3 +++\n git-gui/lib/diff.tcl |   10 ++++++++++\n 2 files changed, 13 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 38362fa..0134438 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \\\n $ui_diff tag conf d< \\\n \t-foreground orange \\\n \t-font font_diffbold\n+$ui_diff tag conf d| \\\n+\t-foreground orange \\\n+\t-font font_diffbold\n $ui_diff tag conf d= \\\n \t-foreground orange \\\n \t-font font_diffbold\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex d4e2ce3..ccd4c70 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t}\n \n \tset ::current_diff_inheader 1\n+\tset ::in_conflict_pre_image 0\n \tfconfigure $fd \\\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n+\t\t\t\t\tset ::in_conflict_pre_image 0\n+\t\t\t\t} elseif {[regexp {^\\+\\+\\|{$conflict_size}(?: |$)} $line]} {\n+\t\t\t\t\tset is_conflict_diff 1\n+\t\t\t\t\tset line [string replace $line 0 1 {  }]\n+\t\t\t\t\tset tags d|\n+\t\t\t\t\tset ::in_conflict_pre_image 1\n+\t\t\t\t} elseif ($::in_conflict_pre_image) {\n+\t\t\t\t\tset line [string replace $line 0 1 {--}]\n+\t\t\t\t\tset tags d_--\n \t\t\t\t} else {\n \t\t\t\t\tset tags d_++\n \t\t\t\t}\n-- \ntg: (fba7c96..) bw/git-gui/support-diff3 (depends on: master bw/git-gui/respect-conflict-marker-size)\n"},{"id":"156163","messageId":"87k4k9h858.fsf@fox.patthoyts.tk","threadId":"25758","inReplyTo":"1289899312-2732-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [PATCHv2 1/2] git-gui: respect conflict marker size","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-11-19T11:20:35Z","receivedAt":"2010-11-19T11:20:35Z","isPatch":false,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n>Respect the conflict-marker-size attribute on paths when detecting merge\n>conflicts.\n>\n>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n>---\n>\n>v2 fixes the tags selection and also the regexp to match always exactly the\n>desired number of markers.\n>\n>Bert\n>\n> git-gui/git-gui.sh   |    6 +++---\n> git-gui/lib/diff.tcl |   22 ++++++++++++++++++----\n> 2 files changed, 21 insertions(+), 7 deletions(-)\n>\n>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\n>index d3acf0d..38362fa 100755\n>--- a/git-gui/git-gui.sh\n>+++ b/git-gui/git-gui.sh\n>@@ -3351,13 +3351,13 @@ $ui_diff tag conf d_s- \\\n> \t-foreground red \\\n> \t-background ivory1\n> \n>-$ui_diff tag conf d<<<<<<< \\\n>+$ui_diff tag conf d< \\\n> \t-foreground orange \\\n> \t-font font_diffbold\n>-$ui_diff tag conf d======= \\\n>+$ui_diff tag conf d= \\\n> \t-foreground orange \\\n> \t-font font_diffbold\n>-$ui_diff tag conf d>>>>>>> \\\n>+$ui_diff tag conf d> \\\n> \t-foreground orange \\\n> \t-font font_diffbold\n> \n>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\n>index dcf0711..d4e2ce3 100644\n>--- a/git-gui/lib/diff.tcl\n>+++ b/git-gui/lib/diff.tcl\n>@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {\n> \t}\n> }\n> \n>+proc get_conflict_marker_size {path} {\n>+\tset size 7\n>+\tcatch {\n>+\t\tset fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n>+\t\tset ret [gets $fd_rc line]\n>+\t\tclose $fd_rc\n>+\t\tif {$ret > 0} {\n>+\t\t\tregexp {.*: conflict-marker-size: (\\d+)$} $line line size\n>+\t\t}\n>+\t}\n>+\treturn $size\n>+}\n>+\n> proc start_show_diff {cont_info {add_opts {}}} {\n> \tglobal file_states file_lists\n> \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n>@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n> \tset is_submodule_diff 0\n> \tset diff_active 1\n> \tset current_diff_header {}\n>+\tset conflict_size [get_conflict_marker_size $path]\n> \n> \tset cmd [list]\n> \tif {$w eq $ui_index} {\n>@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n> \t\t-blocking 0 \\\n> \t\t-encoding [get_path_encoding $path] \\\n> \t\t-translation lf\n>-\tfileevent $fd readable [list read_diff $fd $cont_info]\n>+\tfileevent $fd readable [list read_diff $fd $conflict_size $cont_info]\n> }\n> \n> proc parse_color_line {line} {\n>@@ -349,7 +363,7 @@ proc parse_color_line {line} {\n> \treturn [list $result $markup]\n> }\n> \n>-proc read_diff {fd cont_info} {\n>+proc read_diff {fd conflict_size cont_info} {\n> \tglobal ui_diff diff_active is_submodule_diff\n> \tglobal is_3way_diff is_conflict_diff current_diff_header\n> \tglobal current_diff_queue\n>@@ -402,7 +416,7 @@ proc read_diff {fd cont_info} {\n> \t\t\t{- } {set tags d_-s}\n> \t\t\t{--} {set tags d_--}\n> \t\t\t{++} {\n>-\t\t\t\tif {[regexp {^\\+\\+([<>]{7} |={7})} $line _g op]} {\n>+\t\t\t\tif {[regexp {^\\+\\+([<>=]){$conflict_size}(?: |$)} $line _g op]} {\n> \t\t\t\t\tset is_conflict_diff 1\n> \t\t\t\t\tset line [string replace $line 0 1 {  }]\n> \t\t\t\t\tset tags d$op\n>@@ -441,7 +455,7 @@ proc read_diff {fd cont_info} {\n> \t\t\t{@} {set tags d_@}\n> \t\t\t{-} {set tags d_-}\n> \t\t\t{+} {\n>-\t\t\t\tif {[regexp {^\\+([<>]{7} |={7})} $line _g op]} {\n>+\t\t\t\tif {[regexp {^\\+([<>=]){$conflict_size}(?: |$)} $line _g op]} {\n> \t\t\t\t\tset is_conflict_diff 1\n> \t\t\t\t\tset tags d$op\n> \t\t\t\t} else {\n\nTcl doesn't expand variables in curly-braced expressions so the\n$conflict_size is left in there verbatim.\n\nEither \n  set regexp [string map [list %conflict_size $conflict_size]\\\n      {^\\+([<>=]){%conflict_size}(?: |$)}]\nwhich substitutes in the expanded value or double-quotes with care to\nprotect anything that Tcl would expand in the regexp. The string map\nstyle is often easier to read.\n  regexp \"^\\\\+(\\[<>=\\]){$conflict_size}(?: |\\$)\" $line _g op\n\nI've squashed in a fix using string map on this one. With that it\nappears to work fine. I never noticed this attribute before.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"156166","messageId":"87fwuxh75m.fsf@fox.patthoyts.tk","threadId":"25758","inReplyTo":"1289899618-2845-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [PATCH 2/2] git-gui: support for diff3 conflict style","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-11-19T11:41:57Z","receivedAt":"2010-11-19T11:41:57Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n>This adds highlight support for the diff3 conflict style.\n>\n>The common pre-image will be reversed to --, because it has been removed\n>and either replaced with our or their side.\n>\n>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n>---\n> git-gui/git-gui.sh   |    3 +++\n> git-gui/lib/diff.tcl |   10 ++++++++++\n> 2 files changed, 13 insertions(+), 0 deletions(-)\n>\n>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\n>index 38362fa..0134438 100755\n>--- a/git-gui/git-gui.sh\n>+++ b/git-gui/git-gui.sh\n>@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \\\n> $ui_diff tag conf d< \\\n> \t-foreground orange \\\n> \t-font font_diffbold\n>+$ui_diff tag conf d| \\\n>+\t-foreground orange \\\n>+\t-font font_diffbold\n> $ui_diff tag conf d= \\\n> \t-foreground orange \\\n> \t-font font_diffbold\n>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\n>index d4e2ce3..ccd4c70 100644\n>--- a/git-gui/lib/diff.tcl\n>+++ b/git-gui/lib/diff.tcl\n>@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n> \t}\n> \n> \tset ::current_diff_inheader 1\n>+\tset ::in_conflict_pre_image 0\n> \tfconfigure $fd \\\n> \t\t-blocking 0 \\\n> \t\t-encoding [get_path_encoding $path] \\\n>@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {\n> \t\t\t\t\tset is_conflict_diff 1\n> \t\t\t\t\tset line [string replace $line 0 1 {  }]\n> \t\t\t\t\tset tags d$op\n>+\t\t\t\t\tset ::in_conflict_pre_image 0\n>+\t\t\t\t} elseif {[regexp {^\\+\\+\\|{$conflict_size}(?: |$)} $line]} {\n>+\t\t\t\t\tset is_conflict_diff 1\n>+\t\t\t\t\tset line [string replace $line 0 1 {  }]\n>+\t\t\t\t\tset tags d|\n>+\t\t\t\t\tset ::in_conflict_pre_image 1\n>+\t\t\t\t} elseif ($::in_conflict_pre_image) {\n>+\t\t\t\t\tset line [string replace $line 0 1 {--}]\n>+\t\t\t\t\tset tags d_--\n> \t\t\t\t} else {\n> \t\t\t\t\tset tags d_++\n> \t\t\t\t}\n\nThis has the same issue as the last patch with variable substitution\ninto the regexp. Replaced the regexp expression with\n   [regexp \"^\\\\+\\\\+\\\\|{$conflict_size}(?: |\\$)\" $line]\n\nI configured a test repository with\n'merge.conflictstyle diff3' and could test this. Looks fine.\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"156165","messageId":"AANLkTimSU9RfFNpXi3u7BN+eFGBSOaPXS4OOfDmwYaDB@mail.gmail.com","threadId":"25758","inReplyTo":"87k4k9h858.fsf@fox.patthoyts.tk","subject":"Re: [PATCHv2 1/2] git-gui: respect conflict marker size","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-19T11:48:17Z","receivedAt":"2010-11-19T11:48:17Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Nov 19, 2010 at 12:20, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n> Tcl doesn't expand variables in curly-braced expressions so the\n> $conflict_size is left in there verbatim.\n\nI should have noticed it either by testing or by wondering why i\ndidn't need to escape the '$', which I have tested but with a verbatim\n7 as the conflict_size in the regex.\n\nThanks for fixing.\n\nBert\n"},{"id":"156168","messageId":"AANLkTi=Ccc3AWQaFQdkCA=2Y5RJY7dE-6JFJ0vnpnjvf@mail.gmail.com","threadId":"25758","inReplyTo":"87fwuxh75m.fsf@fox.patthoyts.tk","subject":"Re: [PATCH 2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-19T12:05:08Z","receivedAt":"2010-11-19T12:05:08Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Nov 19, 2010 at 12:41, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>>This adds highlight support for the diff3 conflict style.\n>>\n>>The common pre-image will be reversed to --, because it has been removed\n>>and either replaced with our or their side.\n>>\n>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>>---\n>> git-gui/git-gui.sh   |    3 +++\n>> git-gui/lib/diff.tcl |   10 ++++++++++\n>> 2 files changed, 13 insertions(+), 0 deletions(-)\n>>\n>>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\n>>index 38362fa..0134438 100755\n>>--- a/git-gui/git-gui.sh\n>>+++ b/git-gui/git-gui.sh\n>>@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \\\n>> $ui_diff tag conf d< \\\n>>       -foreground orange \\\n>>       -font font_diffbold\n>>+$ui_diff tag conf d| \\\n>>+      -foreground orange \\\n>>+      -font font_diffbold\n>> $ui_diff tag conf d= \\\n>>       -foreground orange \\\n>>       -font font_diffbold\n>>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\n>>index d4e2ce3..ccd4c70 100644\n>>--- a/git-gui/lib/diff.tcl\n>>+++ b/git-gui/lib/diff.tcl\n>>@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n>>       }\n>>\n>>       set ::current_diff_inheader 1\n>>+      set ::in_conflict_pre_image 0\n>>       fconfigure $fd \\\n>>               -blocking 0 \\\n>>               -encoding [get_path_encoding $path] \\\n>>@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {\n>>                                       set is_conflict_diff 1\n>>                                       set line [string replace $line 0 1 {  }]\n>>                                       set tags d$op\n>>+                                      set ::in_conflict_pre_image 0\n>>+                              } elseif {[regexp {^\\+\\+\\|{$conflict_size}(?: |$)} $line]} {\n>>+                                      set is_conflict_diff 1\n>>+                                      set line [string replace $line 0 1 {  }]\n>>+                                      set tags d|\n>>+                                      set ::in_conflict_pre_image 1\n>>+                              } elseif ($::in_conflict_pre_image) {\n>>+                                      set line [string replace $line 0 1 {--}]\n>>+                                      set tags d_--\n>>                               } else {\n>>                                       set tags d_++\n>>                               }\n>\n> This has the same issue as the last patch with variable substitution\n> into the regexp. Replaced the regexp expression with\n>   [regexp \"^\\\\+\\\\+\\\\|{$conflict_size}(?: |\\$)\" $line]\n>\n> I configured a test repository with\n> 'merge.conflictstyle diff3' and could test this. Looks fine.\n\nThanks Pat.\n\nBy looking over the patch (which by itself is now some month old) I\nwondered whether git-gui has some policy to show the diff output as\nverbatim as possible. Which I break with this patch, because I replace\nthe ++ line prefix in the pre-image with -- and in the |||| lines with\n\"  \". Shawn, does such policy exists?\n\nBert\n\n> --\n> Pat Thoyts                            http://www.patthoyts.tk/\n> PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n>\n"},{"id":"162382","messageId":"AANLkTin4-1_bNuH2kQ0m6wpevnO5uCJUmLvy=gP4mLfH@mail.gmail.com","threadId":"25758","inReplyTo":"87fwuxh75m.fsf@fox.patthoyts.tk","subject":"Re: [PATCH 2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-02-27T20:15:18Z","receivedAt":"2011-02-27T20:15:18Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Nov 19, 2010 at 12:41, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>>This adds highlight support for the diff3 conflict style.\n>>\n>>The common pre-image will be reversed to --, because it has been removed\n>>and either replaced with our or their side.\n>>\n>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>>---\n>> git-gui/git-gui.sh   |    3 +++\n>> git-gui/lib/diff.tcl |   10 ++++++++++\n>> 2 files changed, 13 insertions(+), 0 deletions(-)\n>>\n>>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\n>>index 38362fa..0134438 100755\n>>--- a/git-gui/git-gui.sh\n>>+++ b/git-gui/git-gui.sh\n>>@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \\\n>> $ui_diff tag conf d< \\\n>>       -foreground orange \\\n>>       -font font_diffbold\n>>+$ui_diff tag conf d| \\\n>>+      -foreground orange \\\n>>+      -font font_diffbold\n>> $ui_diff tag conf d= \\\n>>       -foreground orange \\\n>>       -font font_diffbold\n>>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\n>>index d4e2ce3..ccd4c70 100644\n>>--- a/git-gui/lib/diff.tcl\n>>+++ b/git-gui/lib/diff.tcl\n>>@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n>>       }\n>>\n>>       set ::current_diff_inheader 1\n>>+      set ::in_conflict_pre_image 0\n>>       fconfigure $fd \\\n>>               -blocking 0 \\\n>>               -encoding [get_path_encoding $path] \\\n>>@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {\n>>                                       set is_conflict_diff 1\n>>                                       set line [string replace $line 0 1 {  }]\n>>                                       set tags d$op\n>>+                                      set ::in_conflict_pre_image 0\n>>+                              } elseif {[regexp {^\\+\\+\\|{$conflict_size}(?: |$)} $line]} {\n>>+                                      set is_conflict_diff 1\n>>+                                      set line [string replace $line 0 1 {  }]\n>>+                                      set tags d|\n>>+                                      set ::in_conflict_pre_image 1\n>>+                              } elseif ($::in_conflict_pre_image) {\n>>+                                      set line [string replace $line 0 1 {--}]\n>>+                                      set tags d_--\n>>                               } else {\n>>                                       set tags d_++\n>>                               }\n>\n> This has the same issue as the last patch with variable substitution\n> into the regexp. Replaced the regexp expression with\n>   [regexp \"^\\\\+\\\\+\\\\|{$conflict_size}(?: |\\$)\" $line]\n>\n> I configured a test repository with\n> 'merge.conflictstyle diff3' and could test this. Looks fine.\n\nI miss this one in git-gui.git\n\nThanks,\nBert\n\n> --\n> Pat Thoyts                            http://www.patthoyts.tk/\n> PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n>\n"},{"id":"164662","messageId":"56c38bdfd71d8af5633bea00cb130256d6981af5.1301467146.git.bert.wesarg@googlemail.com","threadId":"25758","inReplyTo":"AANLkTin4-1_bNuH2kQ0m6wpevnO5uCJUmLvy=gP4mLfH@mail.gmail.com","subject":"[PATCH 2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-03-30T06:44:46Z","receivedAt":"2011-03-30T06:44:46Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This adds highlight support for the diff3 conflict style.\n\nThe common pre-image will be reversed to --, because it has been removed\nand either replaced with our or their side.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n\nMaybe it's not too late for the next release.\n\n git-gui.sh   |    3 +++\n lib/diff.tcl |   12 ++++++++++++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex d5c1535..6adcda6 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3388,6 +3388,9 @@ $ui_diff tag conf d_s- \\\n $ui_diff tag conf d< \\\n \t-foreground orange \\\n \t-font font_diffbold\n+$ui_diff tag conf d| \\\n+\t-foreground orange \\\n+\t-font font_diffbold\n $ui_diff tag conf d= \\\n \t-foreground orange \\\n \t-font font_diffbold\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 39e4d90..11f9e16 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t}\n \n \tset ::current_diff_inheader 1\n+\tset ::in_conflict_pre_image 0\n \tfconfigure $fd \\\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n@@ -439,10 +440,21 @@ proc read_diff {fd conflict_size cont_info} {\n \t\t\t{++} {\n \t\t\t\tset regexp [string map [list %conflict_size $conflict_size]\\\n \t\t\t\t\t\t\t\t{^\\+\\+([<>=]){%conflict_size}(?: |$)}]\n+\t\t\t\tset regexp_pre_image [string map [list %conflict_size $conflict_size]\\\n+\t\t\t\t\t\t\t\t{^\\+\\+\\|{%conflict_size}(?: |$)]\n \t\t\t\tif {[regexp $regexp $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n+\t\t\t\t\tset ::in_conflict_pre_image 0\n+\t\t\t\t} elseif {[regexp $regexp_pre_image $line]} {\n+\t\t\t\t\tset is_conflict_diff 1\n+\t\t\t\t\tset line [string replace $line 0 1 {  }]\n+\t\t\t\t\tset tags d|\n+\t\t\t\t\tset ::in_conflict_pre_image 1\n+\t\t\t\t} elseif ($::in_conflict_pre_image) {\n+\t\t\t\t\tset line [string replace $line 0 1 {--}]\n+\t\t\t\t\tset tags d_--\n \t\t\t\t} else {\n \t\t\t\t\tset tags d_++\n \t\t\t\t}\n-- \n1.7.4.1.1319.ga04f7.dirty\n"},{"id":"164665","messageId":"c761e522cce009a70d9131f0a5a1a2fc6aa6d9ac.1301469420.git.bert.wesarg@googlemail.com","threadId":"25758","inReplyTo":"56c38bdfd71d8af5633bea00cb130256d6981af5.1301467146.git.bert.wesarg@googlemail.com","subject":"[PATCH 2v2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-03-30T07:18:27Z","receivedAt":"2011-03-30T07:18:27Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This adds highlight support for the diff3 conflict style.\n\nThe common pre-image will be reversed to --, because it has been removed\nand either replaced with our or their side.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n\nSorry, I had an syntax error in the last version.\n\n git-gui.sh   |    3 +++\n lib/diff.tcl |   12 ++++++++++++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex d5c1535..6adcda6 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3388,6 +3388,9 @@ $ui_diff tag conf d_s- \\\n $ui_diff tag conf d< \\\n \t-foreground orange \\\n \t-font font_diffbold\n+$ui_diff tag conf d| \\\n+\t-foreground orange \\\n+\t-font font_diffbold\n $ui_diff tag conf d= \\\n \t-foreground orange \\\n \t-font font_diffbold\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 39e4d90..caa4be7 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t}\n \n \tset ::current_diff_inheader 1\n+\tset ::in_conflict_pre_image 0\n \tfconfigure $fd \\\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n@@ -439,10 +440,21 @@ proc read_diff {fd conflict_size cont_info} {\n \t\t\t{++} {\n \t\t\t\tset regexp [string map [list %conflict_size $conflict_size]\\\n \t\t\t\t\t\t\t\t{^\\+\\+([<>=]){%conflict_size}(?: |$)}]\n+\t\t\t\tset regexp_pre_image [string map [list %conflict_size $conflict_size]\\\n+\t\t\t\t\t\t\t\t{^\\+\\+\\|{%conflict_size}(?: |$)}]\n \t\t\t\tif {[regexp $regexp $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n+\t\t\t\t\tset ::in_conflict_pre_image 0\n+\t\t\t\t} elseif {[regexp $regexp_pre_image $line]} {\n+\t\t\t\t\tset is_conflict_diff 1\n+\t\t\t\t\tset line [string replace $line 0 1 {  }]\n+\t\t\t\t\tset tags d|\n+\t\t\t\t\tset ::in_conflict_pre_image 1\n+\t\t\t\t} elseif ($::in_conflict_pre_image) {\n+\t\t\t\t\tset line [string replace $line 0 1 {--}]\n+\t\t\t\t\tset tags d_--\n \t\t\t\t} else {\n \t\t\t\t\tset tags d_++\n \t\t\t\t}\n-- \n1.7.4.2.743.g539ab\n"},{"id":"178103","messageId":"CAKPyHN2pOJfm=Ys+giv-4ERjzzje1VigxfEKKY-yPsE03A0NNA@mail.gmail.com","threadId":"25758","inReplyTo":"c761e522cce009a70d9131f0a5a1a2fc6aa6d9ac.1301469420.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 2v2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-20T19:35:25Z","receivedAt":"2011-10-20T19:35:25Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Ping.\n\nOn Wed, Mar 30, 2011 at 09:18, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> This adds highlight support for the diff3 conflict style.\n>\n> The common pre-image will be reversed to --, because it has been removed\n> and either replaced with our or their side.\n>\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>\n> Sorry, I had an syntax error in the last version.\n>\n>  git-gui.sh   |    3 +++\n>  lib/diff.tcl |   12 ++++++++++++\n>  2 files changed, 15 insertions(+), 0 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index d5c1535..6adcda6 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -3388,6 +3388,9 @@ $ui_diff tag conf d_s- \\\n>  $ui_diff tag conf d< \\\n>        -foreground orange \\\n>        -font font_diffbold\n> +$ui_diff tag conf d| \\\n> +       -foreground orange \\\n> +       -font font_diffbold\n>  $ui_diff tag conf d= \\\n>        -foreground orange \\\n>        -font font_diffbold\n> diff --git a/lib/diff.tcl b/lib/diff.tcl\n> index 39e4d90..caa4be7 100644\n> --- a/lib/diff.tcl\n> +++ b/lib/diff.tcl\n> @@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n>        }\n>\n>        set ::current_diff_inheader 1\n> +       set ::in_conflict_pre_image 0\n>        fconfigure $fd \\\n>                -blocking 0 \\\n>                -encoding [get_path_encoding $path] \\\n> @@ -439,10 +440,21 @@ proc read_diff {fd conflict_size cont_info} {\n>                        {++} {\n>                                set regexp [string map [list %conflict_size $conflict_size]\\\n>                                                                {^\\+\\+([<>=]){%conflict_size}(?: |$)}]\n> +                               set regexp_pre_image [string map [list %conflict_size $conflict_size]\\\n> +                                                               {^\\+\\+\\|{%conflict_size}(?: |$)}]\n>                                if {[regexp $regexp $line _g op]} {\n>                                        set is_conflict_diff 1\n>                                        set line [string replace $line 0 1 {  }]\n>                                        set tags d$op\n> +                                       set ::in_conflict_pre_image 0\n> +                               } elseif {[regexp $regexp_pre_image $line]} {\n> +                                       set is_conflict_diff 1\n> +                                       set line [string replace $line 0 1 {  }]\n> +                                       set tags d|\n> +                                       set ::in_conflict_pre_image 1\n> +                               } elseif ($::in_conflict_pre_image) {\n> +                                       set line [string replace $line 0 1 {--}]\n> +                                       set tags d_--\n>                                } else {\n>                                        set tags d_++\n>                                }\n> --\n> 1.7.4.2.743.g539ab\n>\n>\n"}]}