@matheusbsbs / matheus-bagliano / commits / c539449b2d
Fork 0

git-gui: Support merge.summary, merge.verbosity.

Changed our private merge summary config option to be the same as the merge.summary option supported by core Git. This means setting the "Show Merge Summary" flag in git-gui will have the same effect on the command line. In the same vein I've also added merge.verbosity to the gui options, allowing the user to adjust the verbosity level of the recursive merge strategy. I happen to like level 1 and suggest that other users use that, but level 2 is the core Git default right now so we'll use the same default in git-gui. Unfortunately it appears as though core Git has broken support for the merge.summary option, even though its still in the documentation For the time being we should pass along --no-summary to git-merge if merge.summary is false. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 26, 2007 at 04:43 UTC c539449b2df0381de1d34c70b093b68370e89a4e
1 file changed +50 -27
git-gui.sh
+50 -27
@@ -60,6 +60,17 @@ proc is_many_config {name} {
60 }
61 }
62
63 +proc is_config_true {name} {
64 + global repo_config
65 + if {[catch {set v $repo_config($name)}]} {
66 + return 0
67 + } elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {
68 + return 1
69 + } else {
70 + return 0
71 + }
72 +}
73 +
74 proc load_config {include_global} {
75 global repo_config global_config default_config
76
@@ -2682,6 +2693,10 @@ proc start_local_merge_action {w} {
2693 global HEAD ui_status_value current_branch
2694
2695 set cmd [list git merge]
2696 + if {![is_config_true merge.summary]} {
2697 + lappend cmd --no-summary
2698 + }
2699 +
2700 set names {}
2701 set revcnt 0
2702 foreach i [$w.source.l curselection] {
@@ -3755,52 +3770,59 @@ proc do_options {} {
3770 pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5
3771 pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5
3772
3773 + set optid 0
3774 foreach option {
3759 - {b pullsummary {Show Pull Summary}}
3760 - {b trustmtime {Trust File Modification Timestamps}}
3761 - {i diffcontext {Number of Diff Context Lines}}
3762 - {t newbranchtemplate {New Branch Name Template}}
3775 + {b merge.summary {Show Merge Summary}}
3776 + {i-1..5 merge.verbosity {Merge Verbosity}}
3777 +
3778 + {b gui.trustmtime {Trust File Modification Timestamps}}
3779 + {i-1..99 gui.diffcontext {Number of Diff Context Lines}}
3780 + {t gui.newbranchtemplate {New Branch Name Template}}
3781 } {
3782 set type [lindex $option 0]
3783 set name [lindex $option 1]
3784 set text [lindex $option 2]
3785 + incr optid
3786 foreach f {repo global} {
3768 - switch $type {
3787 + switch -glob -- $type {
3788 b {
3770 - checkbutton $w.$f.$name -text $text \
3771 - -variable ${f}_config_new(gui.$name) \
3789 + checkbutton $w.$f.$optid -text $text \
3790 + -variable ${f}_config_new($name) \
3791 -onvalue true \
3792 -offvalue false \
3793 -font font_ui
3775 - pack $w.$f.$name -side top -anchor w
3794 + pack $w.$f.$optid -side top -anchor w
3795 }
3777 - i {
3778 - frame $w.$f.$name
3779 - label $w.$f.$name.l -text "$text:" -font font_ui
3780 - pack $w.$f.$name.l -side left -anchor w -fill x
3781 - spinbox $w.$f.$name.v \
3782 - -textvariable ${f}_config_new(gui.$name) \
3783 - -from 1 -to 99 -increment 1 \
3784 - -width 3 \
3796 + i-* {
3797 + regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max
3798 + frame $w.$f.$optid
3799 + label $w.$f.$optid.l -text "$text:" -font font_ui
3800 + pack $w.$f.$optid.l -side left -anchor w -fill x
3801 + spinbox $w.$f.$optid.v \
3802 + -textvariable ${f}_config_new($name) \
3803 + -from $min \
3804 + -to $max \
3805 + -increment 1 \
3806 + -width [expr {1 + [string length $max]}] \
3807 -font font_ui
3786 - bind $w.$f.$name.v <FocusIn> {%W selection range 0 end}
3787 - pack $w.$f.$name.v -side right -anchor e -padx 5
3788 - pack $w.$f.$name -side top -anchor w -fill x
3808 + bind $w.$f.$optid.v <FocusIn> {%W selection range 0 end}
3809 + pack $w.$f.$optid.v -side right -anchor e -padx 5
3810 + pack $w.$f.$optid -side top -anchor w -fill x
3811 }
3812 t {
3791 - frame $w.$f.$name
3792 - label $w.$f.$name.l -text "$text:" -font font_ui
3793 - entry $w.$f.$name.v \
3813 + frame $w.$f.$optid
3814 + label $w.$f.$optid.l -text "$text:" -font font_ui
3815 + entry $w.$f.$optid.v \
3816 -borderwidth 1 \
3817 -relief sunken \
3818 -width 20 \
3797 - -textvariable ${f}_config_new(gui.$name) \
3819 + -textvariable ${f}_config_new($name) \
3820 -font font_ui
3799 - pack $w.$f.$name.l -side left -anchor w
3800 - pack $w.$f.$name.v -side left -anchor w \
3821 + pack $w.$f.$optid.l -side left -anchor w
3822 + pack $w.$f.$optid.v -side left -anchor w \
3823 -fill x -expand 1 \
3824 -padx 5
3803 - pack $w.$f.$name -side top -anchor w -fill x
3825 + pack $w.$f.$optid -side top -anchor w -fill x
3826 }
3827 }
3828 }
@@ -4131,8 +4153,9 @@ proc apply_config {} {
4153 }
4154 }
4155
4156 +set default_config(merge.summary) true
4157 +set default_config(merge.verbosity) 2
4158 set default_config(gui.trustmtime) false
4135 -set default_config(gui.pullsummary) true
4159 set default_config(gui.diffcontext) 5
4160 set default_config(gui.newbranchtemplate) {}
4161 set default_config(gui.fontui) [font configure font_ui]