{"thread":{"id":"22083","subject":"[PATCH 0/2] git-gui: Add a special diff popup menu for submodules","startedAt":"2010-01-02T16:57:06Z","lastAt":"2010-01-23T22:57:55Z","messageCount":4,"participants":["Jens Lehmann","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"130688","messageId":"4B3F7AE2.10007@web.de","threadId":"22083","inReplyTo":null,"subject":"[PATCH 0/2] git-gui: Add a special diff popup menu for submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-01-02T16:57:06Z","receivedAt":"2010-01-02T16:57:06Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The first patch is a resend (first sent on December 7th 2009) and\nnecessary for the second patch to work properly.\n\nJens Lehmann (2):\n  git-gui: Unstaging a partly staged entry didn't update file_states\n    correctly\n  git-gui: Add a special diff popup menu for submodules\n\n git-gui/git-gui.sh |  130 +++++++++++++++++++++++++++++++++++++++++++++-------\n 1 files changed, 113 insertions(+), 17 deletions(-)\n"},{"id":"130689","messageId":"4B3F7B2F.8020701@web.de","threadId":"22083","inReplyTo":"4B3F7AE2.10007@web.de","subject":"[PATCH 1/2] git-gui: Unstaging a partly staged entry didn't update file_states correctly","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-01-02T16:58:23Z","receivedAt":"2010-01-02T16:58:23Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"When unstaging a partly staged file or submodule, the file_states list\nwas not updated properly (unless unstaged linewise). Its index_info part\ndid not contain the former head_info as it should have.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-gui/git-gui.sh |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 718277a..e0dd5b5 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -1613,6 +1613,9 @@ proc merge_state {path new_state {head_info {}} {index_info {}}} {\n \t} elseif {$s0 ne {_} && [string index $state 0] eq {_}\n \t\t&& $head_info eq {}} {\n \t\tset head_info $index_info\n+\t} elseif {$s0 eq {_} && [string index $state 0] ne {_}} {\n+\t\tset index_info $head_info\n+\t\tset head_info {}\n \t}\n\n \tset file_states($path) [list $s0$s1 $icon \\\n-- \n1.6.6.339.g7cacc\n"},{"id":"130690","messageId":"4B3F7B49.2030100@web.de","threadId":"22083","inReplyTo":"4B3F7AE2.10007@web.de","subject":"[PATCH 2/2] git-gui: Add a special diff popup menu for submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-01-02T16:58:49Z","receivedAt":"2010-01-02T16:58:49Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"To make it easier for users to deal with submodules, a special diff popup\nmenu has been added for submodules. The \"Show Less Context\" and \"Show More\nContext\" entries have been removed, as they don't make any sense for a\nsubmodule summary. Four new entries are added to the top of the popup menu\nto gain access to more detailed information about the changes in a\nsubmodule than the plain summary does offer. These are:\n- \"Visualize These Changes In The Submodule\"\n  starts gitk showing the selected commit range\n- \"Visualize These Changes In The Submodule\"\n  starts gitk showing the whole submodule history of the current branch\n- \"Visualize All Branch History In The Submodule\"\n  starts gitk --all in the submodule\n- \"Start git gui In The Submodule\"\n  guess what :-)\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-gui/git-gui.sh |  127 +++++++++++++++++++++++++++++++++++++++++++++-------\n 1 files changed, 110 insertions(+), 17 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex e0dd5b5..ee80d7d 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -1923,7 +1923,9 @@ proc incr_font_size {font {amt 1}} {\n\n set starting_gitk_msg [mc \"Starting gitk... please wait...\"]\n\n-proc do_gitk {revs} {\n+proc do_gitk {revs {is_submodule false}} {\n+\tglobal current_diff_path file_states current_diff_side ui_index\n+\n \t# -- Always start gitk through whatever we were loaded with.  This\n \t#    lets us bypass using shell process on Windows systems.\n \t#\n@@ -1941,14 +1943,72 @@ proc do_gitk {revs} {\n \t\t}\n\n \t\tset pwd [pwd]\n-\t\tcd [file dirname [gitdir]]\n-\t\tset env(GIT_DIR) [file tail [gitdir]]\n-\n+\t\tif {!$is_submodule} {\n+\t\t\tcd [file dirname [gitdir]]\n+\t\t\tset env(GIT_DIR) [file tail [gitdir]]\n+\t\t} else {\n+\t\t\tcd $current_diff_path\n+\t\t\tif {$revs eq {--}} {\n+\t\t\t\tset s $file_states($current_diff_path)\n+\t\t\t\tset old_sha1 {}\n+\t\t\t\tset new_sha1 {}\n+\t\t\t\tswitch -glob -- [lindex $s 0] {\n+\t\t\t\tM_ { set old_sha1 [lindex [lindex $s 2] 1] }\n+\t\t\t\t_M { set old_sha1 [lindex [lindex $s 3] 1] }\n+\t\t\t\tMM {\n+\t\t\t\t\tif {$current_diff_side eq $ui_index} {\n+\t\t\t\t\t\tset old_sha1 [lindex [lindex $s 2] 1]\n+\t\t\t\t\t\tset new_sha1 [lindex [lindex $s 3] 1]\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tset old_sha1 [lindex [lindex $s 3] 1]\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tset revs $old_sha1...$new_sha1\n+\t\t\t}\n+\t\t\tif {[info exists env(GIT_DIR)]} {\n+\t\t\t\tunset env(GIT_DIR)\n+\t\t\t}\n+\t\t}\n \t\teval exec $cmd $revs &\n\n-\t\tif {$old_GIT_DIR eq {}} {\n+\t\tif {$old_GIT_DIR ne {}} {\n+\t\t\tset env(GIT_DIR) $old_GIT_DIR\n+\t\t}\n+\t\tcd $pwd\n+\n+\t\tui_status $::starting_gitk_msg\n+\t\tafter 10000 {\n+\t\t\tui_ready $starting_gitk_msg\n+\t\t}\n+\t}\n+}\n+\n+proc do_git_gui {} {\n+\tglobal current_diff_path\n+\n+\t# -- Always start git gui through whatever we were loaded with.  This\n+\t#    lets us bypass using shell process on Windows systems.\n+\t#\n+\tset exe [_which git]\n+\tif {$exe eq {}} {\n+\t\terror_popup [mc \"Couldn't find git gui in PATH\"]\n+\t} else {\n+\t\tglobal env\n+\n+\t\tif {[info exists env(GIT_DIR)]} {\n+\t\t\tset old_GIT_DIR $env(GIT_DIR)\n \t\t\tunset env(GIT_DIR)\n \t\t} else {\n+\t\t\tset old_GIT_DIR {}\n+\t\t}\n+\n+\t\tset pwd [pwd]\n+\t\tcd $current_diff_path\n+\n+\t\teval exec $exe gui &\n+\n+\t\tif {$old_GIT_DIR ne {}} {\n \t\t\tset env(GIT_DIR) $old_GIT_DIR\n \t\t}\n \t\tcd $pwd\n@@ -3143,15 +3203,6 @@ $ui_diff tag raise sel\n\n proc create_common_diff_popup {ctxm} {\n \t$ctxm add command \\\n-\t\t-label [mc \"Show Less Context\"] \\\n-\t\t-command show_less_context\n-\tlappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n-\t$ctxm add command \\\n-\t\t-label [mc \"Show More Context\"] \\\n-\t\t-command show_more_context\n-\tlappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n-\t$ctxm add separator\n-\t$ctxm add command \\\n \t\t-label [mc Refresh] \\\n \t\t-command reshow_diff\n \tlappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n@@ -3206,6 +3257,15 @@ $ctxm add command \\\n set ui_diff_applyline [$ctxm index last]\n lappend diff_actions [list $ctxm entryconf $ui_diff_applyline -state]\n $ctxm add separator\n+$ctxm add command \\\n+\t-label [mc \"Show Less Context\"] \\\n+\t-command show_less_context\n+lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n+$ctxm add command \\\n+\t-label [mc \"Show More Context\"] \\\n+\t-command show_more_context\n+lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n+$ctxm add separator\n create_common_diff_popup $ctxm\n\n set ctxmmg .vpane.lower.diff.body.ctxmmg\n@@ -3228,9 +3288,40 @@ $ctxmmg add command \\\n \t-command {merge_resolve_one 1}\n lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]\n $ctxmmg add separator\n+$ctxmmg add command \\\n+\t-label [mc \"Show Less Context\"] \\\n+\t-command show_less_context\n+lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]\n+$ctxmmg add command \\\n+\t-label [mc \"Show More Context\"] \\\n+\t-command show_more_context\n+lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state]\n+$ctxmmg add separator\n create_common_diff_popup $ctxmmg\n\n-proc popup_diff_menu {ctxm ctxmmg x y X Y} {\n+set ctxmsm .vpane.lower.diff.body.ctxmsm\n+menu $ctxmsm -tearoff 0\n+$ctxmsm add command \\\n+\t-label [mc \"Visualize These Changes In The Submodule\"] \\\n+\t-command {do_gitk -- true}\n+lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]\n+$ctxmsm add command \\\n+\t-label [mc \"Visualize Current Branch History In The Submodule\"] \\\n+\t-command {do_gitk {} true}\n+lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]\n+$ctxmsm add command \\\n+\t-label [mc \"Visualize All Branch History In The Submodule\"] \\\n+\t-command {do_gitk --all true}\n+lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]\n+$ctxmsm add separator\n+$ctxmsm add command \\\n+\t-label [mc \"Start git gui In The Submodule\"] \\\n+\t-command {do_git_gui}\n+lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]\n+$ctxmsm add separator\n+create_common_diff_popup $ctxmsm\n+\n+proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {\n \tglobal current_diff_path file_states\n \tset ::cursorX $x\n \tset ::cursorY $y\n@@ -3241,6 +3332,8 @@ proc popup_diff_menu {ctxm ctxmmg x y X Y} {\n \t}\n \tif {[string first {U} $state] >= 0} {\n \t\ttk_popup $ctxmmg $X $Y\n+\t} elseif {$::is_submodule_diff} {\n+\t\ttk_popup $ctxmsm $X $Y\n \t} else {\n \t\tif {$::ui_index eq $::current_diff_side} {\n \t\t\tset l [mc \"Unstage Hunk From Commit\"]\n@@ -3249,7 +3342,7 @@ proc popup_diff_menu {ctxm ctxmmg x y X Y} {\n \t\t\tset l [mc \"Stage Hunk For Commit\"]\n \t\t\tset t [mc \"Stage Line For Commit\"]\n \t\t}\n-\t\tif {$::is_3way_diff || $::is_submodule_diff\n+\t\tif {$::is_3way_diff\n \t\t\t|| $current_diff_path eq {}\n \t\t\t|| {__} eq $state\n \t\t\t|| {_O} eq $state\n@@ -3264,7 +3357,7 @@ proc popup_diff_menu {ctxm ctxmmg x y X Y} {\n \t\ttk_popup $ctxm $X $Y\n \t}\n }\n-bind_button3 $ui_diff [list popup_diff_menu $ctxm $ctxmmg %x %y %X %Y]\n+bind_button3 $ui_diff [list popup_diff_menu $ctxm $ctxmmg $ctxmsm %x %y %X %Y]\n\n # -- Status Bar\n #\n-- \n1.6.6.339.g7cacc\n"},{"id":"132516","messageId":"20100123225755.GF12679@spearce.org","threadId":"22083","inReplyTo":"4B3F7B49.2030100@web.de","subject":"Re: [PATCH 2/2] git-gui: Add a special diff popup menu for submodules","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-01-23T22:57:55Z","receivedAt":"2010-01-23T22:57:55Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> wrote:\n> To make it easier for users to deal with submodules, a special diff popup\n> menu has been added for submodules. The \"Show Less Context\" and \"Show More\n> Context\" entries have been removed, as they don't make any sense for a\n> submodule summary. Four new entries are added to the top of the popup menu\n> to gain access to more detailed information about the changes in a\n> submodule than the plain summary does offer. These are:\n> - \"Visualize These Changes In The Submodule\"\n>   starts gitk showing the selected commit range\n> - \"Visualize These Changes In The Submodule\"\n>   starts gitk showing the whole submodule history of the current branch\n> - \"Visualize All Branch History In The Submodule\"\n>   starts gitk --all in the submodule\n> - \"Start git gui In The Submodule\"\n>   guess what :-)\n> \n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n> ---\n>  git-gui/git-gui.sh |  127 +++++++++++++++++++++++++++++++++++++++++++++-------\n>  1 files changed, 110 insertions(+), 17 deletions(-)\n\nThanks, applied.\n\n-- \nShawn.\n"}]}