{"thread":{"id":"21016","subject":"[RFC PATCH 3/8] git gui: add checkbox to launch remote branch delete after push","startedAt":"2009-09-21T13:06:47Z","lastAt":"2009-09-21T13:06:55Z","messageCount":9,"participants":["Heiko Voigt"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"123570","messageId":"cover.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":null,"subject":"[RFC PATCH 0/8] Extend git gui for better \"centralized\" workflow integration","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:47Z","receivedAt":"2009-09-21T13:06:47Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This series is adding some more support for a centralized workflow with\ncode review based on feature branches. Most of it is plugging existing\nfunctionality together so the most typical steps can be done at once.\n\nIn our team at $dayjob we use a workflow were each developer creates\nfeature branches and once he is satified with his change he sends out a\nreview request to another developer (the reviewer) which is most\nfamiliar with the code parts involved in the change. If the reviewer\nlikes the change he merges it into the upstream branch (master). He then\npublishes the new master and deletes the feature branch. Thats a quick\ndescription of the workflow I am trying to add more support for with\nthis series.\n\nThere are still some TODO markers in there and if someone can help me\nwith those I would be very glad. This is the first time I am doing some\nmore extensive programming in tcl/tk and git gui so I hope you do not\ntear everything apart ;)\n\nThe last patch is not really about the same topic but since it currently\nrelies on the changes of this series I included it nevertheless.\n\ncheers Heiko\n\n\nHeiko Voigt (8):\n  git gui: add a \"compose review email\" checkbox to push dialog\n  git gui: teach delete dialog to open with a default remote\n  git gui: add checkbox to launch remote branch delete after push\n  git gui: teach fetch operation to close dialog on successful\n    completion\n  git gui: do fetch from a default remote on startup\n  git gui: add \"review topic\" menuitem which supports feature branch\n    workflow\n  Add documentation for git gui variables for email and delete after\n    push\n  git gui: make gc hint and fetch on startup sequential\n\n Documentation/config.txt             |   30 ++++++++++\n git-gui/git-gui.sh                   |   29 ++++++++-\n git-gui/lib/console.tcl              |    6 ++\n git-gui/lib/merge.tcl                |   83 ++++++++++++++++++++++++--\n git-gui/lib/option.tcl               |    5 ++\n git-gui/lib/remote_branch_delete.tcl |    6 +-\n git-gui/lib/transport.tcl            |  107 ++++++++++++++++++++++++++++++++-\n 7 files changed, 250 insertions(+), 16 deletions(-)\n"},{"id":"123574","messageId":"f52bb968bf977dbbed78ce48856cd41d0add708f.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"cover.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 1/8] git gui: add a \"compose review email\" checkbox to push dialog","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:48Z","receivedAt":"2009-09-21T13:06:48Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful when working with a central server. If a developer wants\nto send his changes to a reviewer we can help him fill out the necessary\ninformation about the branch he has pushed and launch his default email\ncomposer.\n\nComposition of such an email is currently only allowed for pushing one\nbranch because the subject line size is limited.\n---\n git-gui/git-gui.sh        |    2 +\n git-gui/lib/option.tcl    |    2 +\n git-gui/lib/transport.tcl |   75 +++++++++++++++++++++++++++++++++++++++++++-\n 3 files changed, 77 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 3c0ce26..dfc1652 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -737,6 +737,8 @@ set default_config(gui.matchtrackingbranch) false\n set default_config(gui.pruneduringfetch) false\n set default_config(gui.trustmtime) false\n set default_config(gui.fastcopyblame) false\n+set default_config(gui.emailafterpush) false\n+set default_config(gui.upstreambranch) {master}\n set default_config(gui.copyblamethreshold) 40\n set default_config(gui.blamehistoryctx) 7\n set default_config(gui.diffcontext) 5\ndiff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl\nindex 1d55b49..55ecfe6 100644\n--- a/git-gui/lib/option.tcl\n+++ b/git-gui/lib/option.tcl\n@@ -147,6 +147,8 @@ proc do_options {} {\n \t\t{b gui.pruneduringfetch {mc \"Prune Tracking Branches During Fetch\"}}\n \t\t{b gui.matchtrackingbranch {mc \"Match Tracking Branches\"}}\n \t\t{b gui.fastcopyblame {mc \"Blame Copy Only On Changed Files\"}}\n+\t\t{b gui.emailafterpush {mc \"Open Email Composer after Push of Feature Branch\"}}\n+\t\t{t gui.upstreambranch {mc \"Upstream branch\"}}\n \t\t{i-20..200 gui.copyblamethreshold {mc \"Minimum Letters To Blame Copy On\"}}\n \t\t{i-0..300 gui.blamehistoryctx {mc \"Blame History Context Radius (days)\"}}\n \t\t{i-1..99 gui.diffcontext {mc \"Number of Diff Context Lines\"}}\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex b18d9c7..77a2f46 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -30,10 +30,63 @@ proc push_to {remote} {\n \tconsole::exec $w $cmd\n }\n \n+proc compose_email {to subject} {\n+\tset mail_link mailto:\n+\tappend mail_link $to \"?subject=\" $subject\n+\tstart_browser $mail_link\n+}\n+\n+proc after_push_anywhere_action {cons ok} {\n+\tglobal push_email r_url branches\n+\n+\tconsole::done $cons $ok\n+\n+\tif {$ok} {\n+\t\tif {$push_email} {\n+\t\t\tset rconfig_var \"remote.$r_url.url\"\n+\t\t\tset remote_url [exec git config $rconfig_var]\n+\t\t\tset remote_short_name [lindex [split $remote_url / ] end ]\n+\t\t\tset remote_short_name [lindex [split $remote_short_name . ] 0 ]\n+\t\t\t# TODO: create a configuration variable for the\n+\t\t\t# subject\n+\t\t\tset email_subject \"Review%20request:%20$remote_short_name:$branches\"\n+\t\t\tcompose_email {} $email_subject\n+\t\t}\n+\t}\n+}\n+\n+proc do_push_on_change_branch {w} {\n+\tglobal upstream_branch\n+\n+\t$w.options.email select\n+\n+\tset cnt 0\n+\tset b {}\n+\tforeach i [$w.source.l curselection] {\n+\t\tset b [$w.source.l get $i]\n+\t\tincr cnt\n+\t}\n+\n+\tif {$cnt != 1} {\n+\t\t$w.options.email deselect\n+\t\t$w.options.email configure -state disabled\n+\t\treturn\n+\t}\n+\n+\t$w.options.email configure -state normal\n+\n+\tif { $b eq $upstream_branch } {\n+\t\tif {[is_config_true gui.emailafterpush]} {\n+\t\t\t$w.options.email deselect\n+\t\t}\n+\t}\n+}\n+\n proc start_push_anywhere_action {w} {\n \tglobal push_urltype push_remote push_url push_thin push_tags\n \tglobal push_force\n \tglobal repo_config\n+\tglobal r_url branches\n \n \tset is_mirror 0\n \tset r_url {}\n@@ -64,9 +117,11 @@ proc start_push_anywhere_action {w} {\n \t\t\t[mc \"Mirroring to %s\" $r_url]]\n \t} else {\n \t\tset cnt 0\n+\t\tset branches {}\n \t\tforeach i [$w.source.l curselection] {\n \t\t\tset b [$w.source.l get $i]\n \t\t\tlappend cmd \"refs/heads/$b:refs/heads/$b\"\n+\t\t\tlappend branches $b\n \t\t\tincr cnt\n \t\t}\n \t\tif {$cnt == 0} {\n@@ -81,7 +136,7 @@ proc start_push_anywhere_action {w} {\n \t\t\t[mc \"push %s\" $r_url] \\\n \t\t\t[mc \"Pushing %s %s to %s\" $cnt $unit $r_url]]\n \t}\n-\tconsole::exec $cons $cmd\n+\tconsole::exec $cons $cmd \"after_push_anywhere_action $cons\"\n \tdestroy $w\n }\n \n@@ -91,7 +146,8 @@ trace add variable push_remote write \\\n proc do_push_anywhere {} {\n \tglobal all_remotes current_branch\n \tglobal push_urltype push_remote push_url push_thin push_tags\n-\tglobal push_force\n+\tglobal push_force push_email upstream_branch\n+\tglobal repo_config\n \n \tset w .push_setup\n \ttoplevel $w\n@@ -117,6 +173,9 @@ proc do_push_anywhere {} {\n \t\t-width 70 \\\n \t\t-selectmode extended \\\n \t\t-yscrollcommand [list $w.source.sby set]\n+\tif {[is_config_true gui.emailafterpush]} {\n+\t\tbind $w.source.l <ButtonRelease-1> [list do_push_on_change_branch $w]\n+\t}\n \tforeach h [load_all_heads] {\n \t\t$w.source.l insert end $h\n \t\tif {$h eq $current_branch} {\n@@ -179,6 +238,11 @@ proc do_push_anywhere {} {\n \t\t-text [mc \"Include tags\"] \\\n \t\t-variable push_tags\n \tgrid $w.options.tags -columnspan 2 -sticky w\n+\tcheckbutton $w.options.email \\\n+\t\t-text [mc \"Compose email with review request\"] \\\n+\t\t-variable push_email\n+\tgrid $w.options.email -columnspan 2 -sticky w\n+\t$w.options.email deselect\n \tgrid columnconfigure $w.options 1 -weight 1\n \tpack $w.options -anchor nw -fill x -pady 5 -padx 5\n \n@@ -186,6 +250,13 @@ proc do_push_anywhere {} {\n \tset push_force 0\n \tset push_thin 0\n \tset push_tags 0\n+\tset push_email 0\n+\n+\tset upstream_branch $repo_config(gui.upstreambranch)\n+\n+\tif {[is_config_true gui.emailafterpush]} {\n+\t\tdo_push_on_change_branch $w\n+\t}\n \n \tbind $w <Visibility> \"grab $w; focus $w.buttons.create\"\n \tbind $w <Key-Escape> \"destroy $w\"\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123571","messageId":"711bc3257266372b0a0f01ac335fa95be7def077.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"f52bb968bf977dbbed78ce48856cd41d0add708f.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 2/8] git gui: teach delete dialog to open with a default remote","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:49Z","receivedAt":"2009-09-21T13:06:49Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful if you want to open the delete dialog with a preselected\nremote. We use this in the next patch from this series.\n---\n git-gui/lib/remote_branch_delete.tcl |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl\nindex 2416420..e0dbc25 100644\n--- a/git-gui/lib/remote_branch_delete.tcl\n+++ b/git-gui/lib/remote_branch_delete.tcl\n@@ -22,7 +22,7 @@ field head_cache\n field full_cache\n field cached\n \n-constructor dialog {} {\n+constructor dialog {{initial_remote origin}} {\n \tglobal all_remotes M1B\n \n \tmake_toplevel top w\n@@ -52,8 +52,8 @@ constructor dialog {} {\n \t\t\t-variable @urltype\n \t\teval tk_optionMenu $w.dest.remote_m @remote $all_remotes\n \t\tgrid $w.dest.remote_r $w.dest.remote_m -sticky w\n-\t\tif {[lsearch -sorted -exact $all_remotes origin] != -1} {\n-\t\t\tset remote origin\n+\t\tif {[lsearch -sorted -exact $all_remotes $initial_remote] != -1} {\n+\t\t\tset remote $initial_remote\n \t\t} else {\n \t\t\tset remote [lindex $all_remotes 0]\n \t\t}\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123569","messageId":"3ee2f1d36ed3c4b716f9bdb2a8f7fcde9a5f9357.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"711bc3257266372b0a0f01ac335fa95be7def077.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 3/8] git gui: add checkbox to launch remote branch delete after push","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:50Z","receivedAt":"2009-09-21T13:06:50Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful when working with a central server and feature branches.\nAfter a reviewer merged a feature branch into the upstream branch he\nusually wants to delete this branch on the server after pushing the\nupstream branch.\n\nSave some clicks and open the delete dialog after pushing the upstream\nbranch.\n---\n git-gui/git-gui.sh        |    1 +\n git-gui/lib/option.tcl    |    1 +\n git-gui/lib/transport.tcl |   28 ++++++++++++++++++++++++----\n 3 files changed, 26 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex dfc1652..b32b8e7 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -738,6 +738,7 @@ set default_config(gui.pruneduringfetch) false\n set default_config(gui.trustmtime) false\n set default_config(gui.fastcopyblame) false\n set default_config(gui.emailafterpush) false\n+set default_config(gui.deleteafterpush) false\n set default_config(gui.upstreambranch) {master}\n set default_config(gui.copyblamethreshold) 40\n set default_config(gui.blamehistoryctx) 7\ndiff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl\nindex 55ecfe6..6bfe343 100644\n--- a/git-gui/lib/option.tcl\n+++ b/git-gui/lib/option.tcl\n@@ -148,6 +148,7 @@ proc do_options {} {\n \t\t{b gui.matchtrackingbranch {mc \"Match Tracking Branches\"}}\n \t\t{b gui.fastcopyblame {mc \"Blame Copy Only On Changed Files\"}}\n \t\t{b gui.emailafterpush {mc \"Open Email Composer after Push of Feature Branch\"}}\n+\t\t{b gui.deleteafterpush {mc \"Open Remote Delete Dialog On Push of Upstream Branch\"}}\n \t\t{t gui.upstreambranch {mc \"Upstream branch\"}}\n \t\t{i-20..200 gui.copyblamethreshold {mc \"Minimum Letters To Blame Copy On\"}}\n \t\t{i-0..300 gui.blamehistoryctx {mc \"Blame History Context Radius (days)\"}}\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex 77a2f46..d717468 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -37,7 +37,7 @@ proc compose_email {to subject} {\n }\n \n proc after_push_anywhere_action {cons ok} {\n-\tglobal push_email r_url branches\n+\tglobal push_email delete_after_push r_url branches\n \n \tconsole::done $cons $ok\n \n@@ -52,13 +52,21 @@ proc after_push_anywhere_action {cons ok} {\n \t\t\tset email_subject \"Review%20request:%20$remote_short_name:$branches\"\n \t\t\tcompose_email {} $email_subject\n \t\t}\n+\t\tif {$delete_after_push} {\n+\t\t\tremote_branch_delete::dialog $r_url\n+\t\t}\n \t}\n }\n \n proc do_push_on_change_branch {w} {\n \tglobal upstream_branch\n \n-\t$w.options.email select\n+\tif {[is_config_true gui.emailafterpush]} {\n+\t\t$w.options.email select\n+\t}\n+\tif {[is_config_true gui.deleteafterpush]} {\n+\t\t$w.options.delete_after_push deselect\n+\t}\n \n \tset cnt 0\n \tset b {}\n@@ -70,6 +78,7 @@ proc do_push_on_change_branch {w} {\n \tif {$cnt != 1} {\n \t\t$w.options.email deselect\n \t\t$w.options.email configure -state disabled\n+\t\t$w.options.delete_after_push deselect\n \t\treturn\n \t}\n \n@@ -79,6 +88,9 @@ proc do_push_on_change_branch {w} {\n \t\tif {[is_config_true gui.emailafterpush]} {\n \t\t\t$w.options.email deselect\n \t\t}\n+\t\tif {[is_config_true gui.deleteafterpush]} {\n+\t\t\t$w.options.delete_after_push select\n+\t\t}\n \t}\n }\n \n@@ -173,7 +185,8 @@ proc do_push_anywhere {} {\n \t\t-width 70 \\\n \t\t-selectmode extended \\\n \t\t-yscrollcommand [list $w.source.sby set]\n-\tif {[is_config_true gui.emailafterpush]} {\n+\tif {[is_config_true gui.emailafterpush] \\\n+\t    || [is_config_true gui.deleteafterpush]} {\n \t\tbind $w.source.l <ButtonRelease-1> [list do_push_on_change_branch $w]\n \t}\n \tforeach h [load_all_heads] {\n@@ -243,6 +256,11 @@ proc do_push_anywhere {} {\n \t\t-variable push_email\n \tgrid $w.options.email -columnspan 2 -sticky w\n \t$w.options.email deselect\n+\tcheckbutton $w.options.delete_after_push \\\n+\t\t-text [mc \"Launch delete dialog after push\"] \\\n+\t\t-variable delete_after_push\n+\tgrid $w.options.delete_after_push -columnspan 2 -sticky w\n+\t$w.options.delete_after_push deselect\n \tgrid columnconfigure $w.options 1 -weight 1\n \tpack $w.options -anchor nw -fill x -pady 5 -padx 5\n \n@@ -251,10 +269,12 @@ proc do_push_anywhere {} {\n \tset push_thin 0\n \tset push_tags 0\n \tset push_email 0\n+\tset delete_after_push 0\n \n \tset upstream_branch $repo_config(gui.upstreambranch)\n \n-\tif {[is_config_true gui.emailafterpush]} {\n+\tif {[is_config_true gui.emailafterpush] \\\n+\t    || [is_config_true gui.deleteafterpush]} {\n \t\tdo_push_on_change_branch $w\n \t}\n \n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123572","messageId":"1e2889356b0992c64fe0d5efefa4c9c47af2513f.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"3ee2f1d36ed3c4b716f9bdb2a8f7fcde9a5f9357.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 4/8] git gui: teach fetch operation to close dialog on successful completion","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:51Z","receivedAt":"2009-09-21T13:06:51Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"---\n git-gui/lib/console.tcl   |    6 ++++++\n git-gui/lib/transport.tcl |   12 ++++++++++--\n 2 files changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl\nindex c112464..84eef13 100644\n--- a/git-gui/lib/console.tcl\n+++ b/git-gui/lib/console.tcl\n@@ -168,6 +168,7 @@ method chain {cmdlist {ok 1}} {\n \t} else {\n \t\tdone $this $ok\n \t}\n+\treturn $ok\n }\n \n method insert {txt} {\n@@ -178,6 +179,11 @@ method insert {txt} {\n \t$w_t conf -state disabled\n }\n \n+method close_window {} {\n+\twm protocol $w WM_DELETE_WINDOW {}\n+\tdestroy $w\n+}\n+\n method done {ok} {\n \tif {$ok} {\n \t\tif {[winfo exists $w.m.s]} {\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex d717468..39443ab 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -1,7 +1,7 @@\n # git-gui transport (fetch/push) support\n # Copyright (C) 2006, 2007 Shawn Pearce\n \n-proc fetch_from {remote} {\n+proc fetch_from {remote {close_after {}}} {\n \tset w [console::new \\\n \t\t[mc \"fetch %s\" $remote] \\\n \t\t[mc \"Fetching new changes from %s\" $remote]]\n@@ -10,7 +10,15 @@ proc fetch_from {remote} {\n \tif {[is_config_true gui.pruneduringfetch]} {\n \t\tlappend cmds [list exec git remote prune $remote]\n \t}\n-\tconsole::chain $w $cmds\n+\tset ok [console::chain $w $cmds]\n+\n+\tif {$ok} {\n+\t\tif {$close_after ne {}} {\n+\t\t\tconsole::close_window $w\n+\t\t}\n+\t\treturn 1\n+\t}\n+\treturn 0\n }\n \n proc prune_from {remote} {\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123573","messageId":"0f2d6dac74105f84defebf23dd74c40846d304a3.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"1e2889356b0992c64fe0d5efefa4c9c47af2513f.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 5/8] git gui: do fetch from a default remote on startup","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:52Z","receivedAt":"2009-09-21T13:06:52Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"In many situations the very first thing you do after starting git gui is\nto fetch the newest changes from your main remote. Lets have git gui do\nthe work automatically and save us some clicking.\n\nWe add two configuration variables (one to enable the feature and one\nspecifying the default remote) so the remote can be reused in another\npatch which adds a \"Review Topic\" merge item later in this series.\n---\n git-gui/git-gui.sh     |    8 ++++++++\n git-gui/lib/option.tcl |    2 ++\n 2 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex b32b8e7..2a2bd38 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -740,6 +740,8 @@ set default_config(gui.fastcopyblame) false\n set default_config(gui.emailafterpush) false\n set default_config(gui.deleteafterpush) false\n set default_config(gui.upstreambranch) {master}\n+set default_config(gui.defaultremote) {origin}\n+set default_config(gui.fetchonstartup) false\n set default_config(gui.copyblamethreshold) 40\n set default_config(gui.blamehistoryctx) 7\n set default_config(gui.diffcontext) 5\n@@ -3495,6 +3497,12 @@ after 1 {\n \t\t$ui_comm configure -state disabled -background gray\n \t}\n }\n+\n+set defaultremote $repo_config(gui.defaultremote)\n+if {[is_config_true gui.fetchonstartup] && $defaultremote ne {}} {\n+\tafter 500 {fetch_from $defaultremote {close_on_success}}\n+}\n+\n if {[is_enabled multicommit]} {\n \tafter 1000 hint_gc\n }\ndiff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl\nindex 6bfe343..defeb54 100644\n--- a/git-gui/lib/option.tcl\n+++ b/git-gui/lib/option.tcl\n@@ -149,7 +149,9 @@ proc do_options {} {\n \t\t{b gui.fastcopyblame {mc \"Blame Copy Only On Changed Files\"}}\n \t\t{b gui.emailafterpush {mc \"Open Email Composer after Push of Feature Branch\"}}\n \t\t{b gui.deleteafterpush {mc \"Open Remote Delete Dialog On Push of Upstream Branch\"}}\n+\t\t{b gui.fetchonstartup {mc \"Fetch default remote on startup\"}}\n \t\t{t gui.upstreambranch {mc \"Upstream branch\"}}\n+\t\t{t gui.defaultremote {mc \"Default remote repository\"}}\n \t\t{i-20..200 gui.copyblamethreshold {mc \"Minimum Letters To Blame Copy On\"}}\n \t\t{i-0..300 gui.blamehistoryctx {mc \"Blame History Context Radius (days)\"}}\n \t\t{i-1..99 gui.diffcontext {mc \"Number of Diff Context Lines\"}}\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123576","messageId":"48c17b5cc7f2e143187a11c4e146649721bb2b0f.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"0f2d6dac74105f84defebf23dd74c40846d304a3.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 6/8] git gui: add \"review topic\" menuitem which supports feature branch workflow","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:53Z","receivedAt":"2009-09-21T13:06:53Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"We have a setup where each developer publishes feature branches on a\ncentral server. These branches then become merged into the upstream\nbranch (master in most times) by another developer designated as the\nreviewer.\n\nThe review process usually involves several steps (fetch remote branches,\nupdate local upstream branch to server branch, review in gitk, merge).\nTo combine this operation into one step we add a new menu item \"Review\nTopic\" under the merge menu which guides the user through all the steps.\n\nAfter \"Review Topic\" has finished the only thing left to do is to push\nthe current branch (which is the upstream branch) and delete the feature\nbranch. Support for which has been implemented in an ealier patch in\nthis series.\n---\n git-gui/git-gui.sh    |    4 ++\n git-gui/lib/merge.tcl |   83 ++++++++++++++++++++++++++++++++++++++++++++++---\n 2 files changed, 82 insertions(+), 5 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 2a2bd38..3e3c7cd 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2557,6 +2557,10 @@ if {[is_enabled branch]} {\n \t\t-accelerator $M1T-M\n \tlappend disable_on_lock \\\n \t\t[list .mbar.merge entryconf [.mbar.merge index last] -state]\n+\t.mbar.merge add command -label [mc \"Review Topic...\"] \\\n+\t\t-command {merge::dialog review}\n+\tlappend disable_on_lock \\\n+\t\t[list .mbar.merge entryconf [.mbar.merge index last] -state]\n \t.mbar.merge add command -label [mc \"Abort Merge...\"] \\\n \t\t-command merge::reset_hard\n \tlappend disable_on_lock \\\ndiff --git a/git-gui/lib/merge.tcl b/git-gui/lib/merge.tcl\nindex 283e491..3716cf3 100644\n--- a/git-gui/lib/merge.tcl\n+++ b/git-gui/lib/merge.tcl\n@@ -81,14 +81,70 @@ method _visualize {} {\n \t}\n }\n \n+method _update_upstream {} {\n+\tglobal repo_config index_lock_type\n+\n+\tset upstream_branch $repo_config(gui.upstreambranch)\n+\tset remote $repo_config(gui.defaultremote)\n+\n+\tif {$upstream_branch eq {} || $remote eq {}} {\n+\t\tinfo_popup [mc \"You need to set the configuration \\\n+\t\t\tvariables gui.upstreambranch and gui.defaultremote so \\\n+\t\t\treview topic can work\"]\n+\t\treturn 0\n+\t}\n+\n+\t#TODO: find out why this does not return on failure\n+\tif {![fetch_from $remote {close_on_success}]} {\n+\t\treturn 0\n+\t}\n+\n+\tset co [::checkout_op::new \\\n+\t\t$remote/$upstream_branch \\\n+\t\t{} \\\n+\t\trefs/heads/$upstream_branch]\n+\n+\t#TODO:\n+\t#$co parent $w\n+\t$co enable_create   1\n+\t$co enable_merge    ff\n+\t$co enable_checkout 1\n+\n+\tset spec [list refs/remotes/$remote/$upstream_branch \\\n+\t                       $remote \\\n+\t\t\t       refs/heads/$upstream_branch]\n+\n+\t$co enable_fetch $spec\n+\t$co remote_source $spec\n+\n+\tif {[$co run]} {\n+\t\twhile {$index_lock_type ne {none}} {\n+\t\t\tvwait index_lock_type\n+\t\t}\n+\t\treturn 1\n+\t} else {\n+\t\twhile {$index_lock_type ne {none}} {\n+\t\t\tvwait index_lock_type\n+\t\t}\n+\t\treturn 0\n+\t}\n+}\n+\n method _start {} {\n-\tglobal HEAD current_branch remote_url\n+\tglobal HEAD current_branch remote_url merge_type\n \n \tset name [_rev $this]\n \tif {$name eq {}} {\n \t\treturn\n \t}\n \n+\tif {$merge_type eq \"review\"} {\n+\t\t_visualize $this\n+\t\t$w.buttons.merge configure -text [mc Merge]\n+\t\tset merge_type normal\n+\t\treturn\n+\t}\n+\n \tset spec [$w_rev get_tracking_branch]\n \tset cmit [$w_rev get_commit]\n \n@@ -137,17 +193,34 @@ method _finish {cons ok} {\n \tdelete_this\n }\n \n-constructor dialog {} {\n+constructor dialog {{dialog_type normal}} {\n \tglobal current_branch\n \tglobal M1B\n+\tglobal merge_type\n+\n+\tset merge_type $dialog_type\n+\tset start_button [mc Merge]\n+\tset action_name \"Merge Into\"\n+\tset dialog_title [mc \"Merge\"]\n+\n+\tif { $merge_type eq \"review\" } {\n+\t\tif {![_update_upstream $this]} {\n+\t\t\tdelete_this\n+\t\t\treturn\n+\t\t}\n+\t\tset start_button [mc Review]\n+\t\tset action_name [mc \"Review for Merge Into\"]\n+\t\tset dialog_title [mc Review]\n+\t}\n \n \tif {![_can_merge $this]} {\n+\t\tinfo_popup failed_can_merge\n \t\tdelete_this\n \t\treturn\n \t}\n \n \tmake_toplevel top w\n-\twm title $top [append \"[appname] ([reponame]): \" [mc \"Merge\"]]\n+\twm title $top [append \"[appname] ([reponame]): \" $dialog_title]\n \tif {$top ne {.}} {\n \t\twm geometry $top \"+[winfo rootx .]+[winfo rooty .]\"\n \t}\n@@ -155,7 +228,7 @@ constructor dialog {} {\n \tset _start [cb _start]\n \n \tlabel $w.header \\\n-\t\t-text [mc \"Merge Into %s\" $current_branch] \\\n+\t\t-text [mc \"$action_name %s\" $current_branch] \\\n \t\t-font font_uibold\n \tpack $w.header -side top -fill x\n \n@@ -165,7 +238,7 @@ constructor dialog {} {\n \t\t-command [cb _visualize]\n \tpack $w.buttons.visualize -side left\n \tbutton $w.buttons.merge \\\n-\t\t-text [mc Merge] \\\n+\t\t-text $start_button \\\n \t\t-command $_start\n \tpack $w.buttons.merge -side right\n \tbutton $w.buttons.cancel \\\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123577","messageId":"bbe878f82f987a36fd1edf77ff6921f2717ad092.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"48c17b5cc7f2e143187a11c4e146649721bb2b0f.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 7/8] Add documentation for git gui variables for email and delete after push","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:54Z","receivedAt":"2009-09-21T13:06:54Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"---\n Documentation/config.txt |   30 ++++++++++++++++++++++++++++++\n 1 files changed, 30 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c6f09f8..4174ab4 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -957,6 +957,36 @@ gui.blamehistoryctx::\n \tContext` menu item is invoked from 'git gui blame'. If this\n \tvariable is set to zero, the whole history is shown.\n \n+gui.emailafterpush::\n+\tThe push dialog can compose a review email if you push a feature\n+\tbranch. If this option is set to true the checkbox will be\n+\tautomatically enabled when you select a feature branch. The\n+\tupstream (main) branch is determined from the\n+\t`gui.upstreambranch` option.\n+\n+gui.deleteafterpush::\n+\tIf you push a branch in git gui you can enable a checkbox which\n+\twill open the remote delete branch dialog after a push. Setting\n+\tthis variable to true will automatically check that checkbox\n+\twhen you select to push the upstream (main) branch. The upstream\n+\tbranch can be configured using the `gui.upstreambranch` configuration\n+\tvariable.\n+\n+gui.upstreambranch::\n+\tThis configures which branchname will be referred to as the\n+\tupstream (main) branch on remote repositories. Currently this\n+\toption is used in combination with the options\n+\t`gui.emailafterpush` and `gui.deleteafterpush`.\n+\n+gui.fetchonstartup::\n+\tBoolean, if set all branches from remote determined by\n+\t`gui.defaulremote` will be fetched on startup of git gui.\n+\n+gui.defaultremote::\n+\tString variable which determines from which remote git gui will\n+\tautomatically start a fetch on startup. If this variable is not\n+\tset the automatic fetch is disabled.\n+\n guitool.<name>.cmd::\n \tSpecifies the shell command line to execute when the corresponding item\n \tof the linkgit:git-gui[1] `Tools` menu is invoked. This option is\n-- \n1.6.5.rc1.12.gc72fe\n"},{"id":"123575","messageId":"1ccb418e07a6d7ce4b8f47e5f9a8d68ac376eed4.1253481338.git.hvoigt@hvoigt.net","threadId":"21016","inReplyTo":"bbe878f82f987a36fd1edf77ff6921f2717ad092.1253481338.git.hvoigt@hvoigt.net","subject":"[RFC PATCH 8/8] git gui: make gc hint and fetch on startup sequential","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-21T13:06:55Z","receivedAt":"2009-09-21T13:06:55Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On large repositories (especially on Windows) doing any harddrive usage\nduring the initial status scan slows the whole process down. So this\npostpones the question for compressing loose objects and fetching of the\ndefault remote until after that.\n---\n git-gui/git-gui.sh |   24 +++++++++++++++---------\n 1 files changed, 15 insertions(+), 9 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 3e3c7cd..19b1ad6 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2031,8 +2031,22 @@ proc do_quit {{rc {1}}} {\n \tdestroy .\n }\n \n+proc ui_finalize_startup {} {\n+\tglobal repo_config\n+\n+\tset defaultremote $repo_config(gui.defaultremote)\n+\tif {[is_config_true gui.fetchonstartup] && $defaultremote ne {}} {\n+\t\tfetch_from $defaultremote {close_on_success}\n+\t}\n+\n+\tif {[is_enabled multicommit]} {\n+\t\thint_gc\n+\t}\n+\tui_ready\n+}\n+\n proc do_rescan {} {\n-\trescan ui_ready\n+\trescan ui_finalize_startup\n }\n \n proc ui_do_rescan {} {\n@@ -3502,14 +3516,6 @@ after 1 {\n \t}\n }\n \n-set defaultremote $repo_config(gui.defaultremote)\n-if {[is_config_true gui.fetchonstartup] && $defaultremote ne {}} {\n-\tafter 500 {fetch_from $defaultremote {close_on_success}}\n-}\n-\n-if {[is_enabled multicommit]} {\n-\tafter 1000 hint_gc\n-}\n if {[is_enabled retcode]} {\n \tbind . <Destroy> {+terminate_me %W}\n }\n-- \n1.6.5.rc1.12.gc72fe\n"}]}