summaryrefslogtreecommitdiff
path: root/lib/tools.tcl
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2008-11-16 18:46:50 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2008-11-16 21:33:09 (GMT)
commit67df911ceebb57596b0d3aea405e1d12137bc6f4 (patch)
tree016c9216598774678d0a2081efc602bd88401245 /lib/tools.tcl
parent0ce76ded1b207063a460f859fe7bfeb6d90b4eb6 (diff)
downloadgit-67df911ceebb57596b0d3aea405e1d12137bc6f4.zip
git-67df911ceebb57596b0d3aea405e1d12137bc6f4.tar.gz
git-67df911ceebb57596b0d3aea405e1d12137bc6f4.tar.bz2
git-gui: Allow Tools request arguments from the user.
While static commands are already useful, some tools need additional parameters to reach maximum usability. This commit adds support for passing them one revision name parameter, and one arbitrary string. With this addition, the tools menu becomes flexible enough to implement basic rebase support: [core] editor = kwrite [guitool "Rebase/Abort"] cmd = git rebase --abort confirm = yes [guitool "Rebase/Continue"] cmd = git rebase --continue [guitool "Rebase/Skip Commit"] cmd = git rebase --skip confirm = yes [guitool "Rebase/Start..."] cmd = git rebase $ARGS $REVISION $CUR_BRANCH title = Start Rebase prompt = Rebase Current Branch argprompt = Flags revprompt = New Base revunmerged = yes Some of the options, like title or prompt, are intentionally not included in the Add dialog to avoid clutter. Also, the dialog handles argprompt and revprompt as boolean vars. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/tools.tcl')
-rw-r--r--lib/tools.tcl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/tools.tcl b/lib/tools.tcl
index 00d46dd..044432e 100644
--- a/lib/tools.tcl
+++ b/lib/tools.tcl
@@ -77,7 +77,16 @@ proc tools_exec {fullname} {
}
}
- if {[is_config_true "guitool.$fullname.confirm"]} {
+ catch { unset env(ARGS) }
+ catch { unset env(REVISION) }
+
+ if {[get_config "guitool.$fullname.revprompt"] ne {} ||
+ [get_config "guitool.$fullname.argprompt"] ne {}} {
+ set dlg [tools_askdlg::dialog $fullname]
+ if {![tools_askdlg::execute $dlg]} {
+ return
+ }
+ } elseif {[is_config_true "guitool.$fullname.confirm"]} {
if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
return
}
@@ -105,4 +114,6 @@ proc tools_exec {fullname} {
unset env(GIT_GUITOOL)
unset env(FILENAME)
unset env(CUR_BRANCH)
+ catch { unset env(ARGS) }
+ catch { unset env(REVISION) }
}