{"thread":{"id":"15659","subject":"[PATCH 1/5] git-gui: Avoid using the term URL when specifying repositories","startedAt":"2008-09-24T22:12:49Z","lastAt":"2008-09-26T14:33:51Z","messageCount":9,"participants":["pasky@suse.cz","Petr Baudis","Daniel Barkalow","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"91529","messageId":"20080924221249.037449176@suse.cz","threadId":"15659","inReplyTo":null,"subject":"[PATCH 0/5] git-gui: Support for \"Locators\" - address templates","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:49Z","receivedAt":"2008-09-24T22:12:49Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch allows \"locators\" to be configured and used in the GUI,\nbasically as URL templates the input string is subsituted into.\nThe default operation of git-gui is not much affected (only some\nlabels change to be less confusing).\n\nThis is aimed mainly at corporate Git deployments - the integrator\nmight want to configure the central corporate repository store as\nthe default locator so that people do not need to type the same\nURL over and over but can instead just type the repository name\non the server. Or avid repo.or.cz users might set up a 'repo'\nlocator pointing at 'git://repo.or.cz/%s'.\n\nIn practice, this seems to be a more significant usability improvement\nthan it might seem. Less technical users appear to be less daunted\nto type in just the project name instead of dealing with long URLs.\n"},{"id":"91528","messageId":"20080924221731.236909653@suse.cz","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"[PATCH 1/5] git-gui: Avoid using the term URL when specifying repositories","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:50Z","receivedAt":"2008-09-24T22:12:50Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Instead, 'Location' is used to label such inputs; in the Clone dialog,\n'Source' and 'Target' are also introduced to further clarify the situation.\nThe intent is to increase GUI consistency in the case location templates\n(upcoming) are used - then, other locators than URL may be used.\n\nThis patch has been sponsored by Novartis.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n git-gui/lib/choose_repository.tcl    |    4 ++--\n git-gui/lib/remote_branch_delete.tcl |    2 +-\n git-gui/lib/transport.tcl            |    2 +-\n 3 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 3180786..f54d88a 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -463,7 +463,7 @@ method _do_clone {} {\n \tframe $w_body.args\n \tpack $args -fill both\n \n-\tlabel $args.origin_l -text [mc \"URL:\"]\n+\tlabel $args.origin_l -text [mc \"Source Location:\"]\n \tentry $args.origin_t \\\n \t\t-textvariable @origin_url \\\n \t\t-font font_diff \\\n@@ -473,7 +473,7 @@ method _do_clone {} {\n \t\t-command [cb _open_origin]\n \tgrid $args.origin_l $args.origin_t $args.origin_b -sticky ew\n \n-\tlabel $args.where_l -text [mc \"Directory:\"]\n+\tlabel $args.where_l -text [mc \"Target Directory:\"]\n \tentry $args.where_t \\\n \t\t-textvariable @local_path \\\n \t\t-font font_diff \\\ndiff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl\nindex c7b8148..a09b9ad 100644\n--- a/git-gui/lib/remote_branch_delete.tcl\n+++ b/git-gui/lib/remote_branch_delete.tcl\n@@ -63,7 +63,7 @@ constructor dialog {} {\n \t\tset urltype url\n \t}\n \tradiobutton $w.dest.url_r \\\n-\t\t-text [mc \"Arbitrary URL:\"] \\\n+\t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable @urltype\n \tentry $w.dest.url_t \\\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex 8e6a9d0..e419d78 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -135,7 +135,7 @@ proc do_push_anywhere {} {\n \t\tset push_urltype url\n \t}\n \tradiobutton $w.dest.url_r \\\n-\t\t-text [mc \"Arbitrary URL:\"] \\\n+\t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable push_urltype\n \tentry $w.dest.url_t \\\n-- \ntg: (c427559..) t/git-gui/avoid-url (depends on: vanilla/master)\n"},{"id":"91530","messageId":"20080924221731.737523976@suse.cz","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"[PATCH 2/5] git-gui: Make input boxes in init/clone/open dialogs consistent","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:51Z","receivedAt":"2008-09-24T22:12:51Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Before, the input boxes would not be sunken and would have larger border,\nwhich is inconsistent with the rest of the inputboxes for repository\nlocations in the git-gui UI.\n\nThis patch has been sponsored by Novartis.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n git-gui/lib/choose_repository.tcl |   12 ++++++++----\n 1 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex f54d88a..9091316 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -381,7 +381,8 @@ method _do_new {} {\n \tlabel $w_body.where.l -text [mc \"Directory:\"]\n \tentry $w_body.where.t \\\n \t\t-textvariable @local_path \\\n-\t\t-font font_diff \\\n+\t\t-borderwidth 1 \\\n+\t\t-relief sunken \\\n \t\t-width 50\n \tbutton $w_body.where.b \\\n \t\t-text [mc \"Browse\"] \\\n@@ -466,7 +467,8 @@ method _do_clone {} {\n \tlabel $args.origin_l -text [mc \"Source Location:\"]\n \tentry $args.origin_t \\\n \t\t-textvariable @origin_url \\\n-\t\t-font font_diff \\\n+\t\t-borderwidth 1 \\\n+\t\t-relief sunken \\\n \t\t-width 50\n \tbutton $args.origin_b \\\n \t\t-text [mc \"Browse\"] \\\n@@ -476,7 +478,8 @@ method _do_clone {} {\n \tlabel $args.where_l -text [mc \"Target Directory:\"]\n \tentry $args.where_t \\\n \t\t-textvariable @local_path \\\n-\t\t-font font_diff \\\n+\t\t-borderwidth 1 \\\n+\t\t-relief sunken \\\n \t\t-width 50\n \tbutton $args.where_b \\\n \t\t-text [mc \"Browse\"] \\\n@@ -979,7 +982,8 @@ method _do_open {} {\n \tlabel $w_body.where.l -text [mc \"Repository:\"]\n \tentry $w_body.where.t \\\n \t\t-textvariable @local_path \\\n-\t\t-font font_diff \\\n+\t\t-borderwidth 1 \\\n+\t\t-relief sunken \\\n \t\t-width 50\n \tbutton $w_body.where.b \\\n \t\t-text [mc \"Browse\"] \\\n-- \ntg: (cdbf2d1..) t/git-gui/ldialogs-consistent (depends on: t/git-gui/avoid-url)\n"},{"id":"91532","messageId":"20080924221732.257739465@suse.cz","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"[PATCH 3/5] git-gui: Squash populate_{push,fetch}_menu to populate_remotes_menu","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:52Z","receivedAt":"2008-09-24T22:12:52Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"The meat of the routines is now separated to add_fetch_entry() and\nadd_push_entry(). This refactoring will allow easy implementation of adding\nindividual remotes later.\n\nThis patch has been sponsored by Novartis.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n git-gui/git-gui.sh     |    3 +-\n git-gui/lib/remote.tcl |  137 ++++++++++++++++++++++++------------------------\n 2 files changed, 70 insertions(+), 70 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 10d8a44..75bd460 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -3100,8 +3100,7 @@ if {[is_enabled transport]} {\n \tload_all_remotes\n \n \tset n [.mbar.remote index end]\n-\tpopulate_push_menu\n-\tpopulate_fetch_menu\n+\tpopulate_remotes_menu\n \tset n [expr {[.mbar.remote index end] - $n}]\n \tif {$n > 0} {\n \t\tif {[.mbar.remote type 0] eq \"tearoff\"} { incr n }\ndiff --git a/git-gui/lib/remote.tcl b/git-gui/lib/remote.tcl\nindex 0e86dda..d97c851 100644\n--- a/git-gui/lib/remote.tcl\n+++ b/git-gui/lib/remote.tcl\n@@ -132,91 +132,92 @@ proc load_all_remotes {} {\n \tset all_remotes [lsort -unique $all_remotes]\n }\n \n-proc populate_fetch_menu {} {\n-\tglobal all_remotes repo_config\n-\n+proc add_fetch_entry {r} {\n+\tglobal repo_config\n \tset remote_m .mbar.remote\n \tset fetch_m $remote_m.fetch\n \tset prune_m $remote_m.prune\n-\n-\tforeach r $all_remotes {\n-\t\tset enable 0\n-\t\tif {![catch {set a $repo_config(remote.$r.url)}]} {\n-\t\t\tif {![catch {set a $repo_config(remote.$r.fetch)}]} {\n-\t\t\t\tset enable 1\n-\t\t\t}\n-\t\t} else {\n-\t\t\tcatch {\n-\t\t\t\tset fd [open [gitdir remotes $r] r]\n-\t\t\t\twhile {[gets $fd n] >= 0} {\n-\t\t\t\t\tif {[regexp {^Pull:[ \\t]*([^:]+):} $n]} {\n-\t\t\t\t\t\tset enable 1\n-\t\t\t\t\t\tbreak\n-\t\t\t\t\t}\n+\tset enable 0\n+\tif {![catch {set a $repo_config(remote.$r.url)}]} {\n+\t\tif {![catch {set a $repo_config(remote.$r.fetch)}]} {\n+\t\t\tset enable 1\n+\t\t}\n+\t} else {\n+\t\tcatch {\n+\t\t\tset fd [open [gitdir remotes $r] r]\n+\t\t\twhile {[gets $fd n] >= 0} {\n+\t\t\t\tif {[regexp {^Pull:[ \\t]*([^:]+):} $n]} {\n+\t\t\t\t\tset enable 1\n+\t\t\t\t\tbreak\n \t\t\t\t}\n-\t\t\t\tclose $fd\n \t\t\t}\n+\t\t\tclose $fd\n \t\t}\n+\t}\n \n-\t\tif {$enable} {\n-\t\t\tif {![winfo exists $fetch_m]} {\n-\t\t\t\tmenu $prune_m\n-\t\t\t\t$remote_m insert 0 cascade \\\n-\t\t\t\t\t-label [mc \"Prune from\"] \\\n-\t\t\t\t\t-menu $prune_m\n-\n-\t\t\t\tmenu $fetch_m\n-\t\t\t\t$remote_m insert 0 cascade \\\n-\t\t\t\t\t-label [mc \"Fetch from\"] \\\n-\t\t\t\t\t-menu $fetch_m\n-\t\t\t}\n-\n-\t\t\t$fetch_m add command \\\n-\t\t\t\t-label $r \\\n-\t\t\t\t-command [list fetch_from $r]\n-\t\t\t$prune_m add command \\\n-\t\t\t\t-label $r \\\n-\t\t\t\t-command [list prune_from $r]\n+\tif {$enable} {\n+\t\tif {![winfo exists $fetch_m]} {\n+\t\t\tmenu $prune_m\n+\t\t\t$remote_m insert 0 cascade \\\n+\t\t\t\t-label [mc \"Prune from\"] \\\n+\t\t\t\t-menu $prune_m\n+\n+\t\t\tmenu $fetch_m\n+\t\t\t$remote_m insert 0 cascade \\\n+\t\t\t\t-label [mc \"Fetch from\"] \\\n+\t\t\t\t-menu $fetch_m\n \t\t}\n+\n+\t\t$fetch_m add command \\\n+\t\t\t-label $r \\\n+\t\t\t-command [list fetch_from $r]\n+\t\t$prune_m add command \\\n+\t\t\t-label $r \\\n+\t\t\t-command [list prune_from $r]\n \t}\n }\n \n-proc populate_push_menu {} {\n-\tglobal all_remotes repo_config\n-\n+proc add_push_entry {r} {\n+\tglobal repo_config\n \tset remote_m .mbar.remote\n \tset push_m $remote_m.push\n-\n-\tforeach r $all_remotes {\n-\t\tset enable 0\n-\t\tif {![catch {set a $repo_config(remote.$r.url)}]} {\n-\t\t\tif {![catch {set a $repo_config(remote.$r.push)}]} {\n-\t\t\t\tset enable 1\n-\t\t\t}\n-\t\t} else {\n-\t\t\tcatch {\n-\t\t\t\tset fd [open [gitdir remotes $r] r]\n-\t\t\t\twhile {[gets $fd n] >= 0} {\n-\t\t\t\t\tif {[regexp {^Push:[ \\t]*([^:]+):} $n]} {\n-\t\t\t\t\t\tset enable 1\n-\t\t\t\t\t\tbreak\n-\t\t\t\t\t}\n+\tset enable 0\n+\tif {![catch {set a $repo_config(remote.$r.url)}]} {\n+\t\tif {![catch {set a $repo_config(remote.$r.push)}]} {\n+\t\t\tset enable 1\n+\t\t}\n+\t} else {\n+\t\tcatch {\n+\t\t\tset fd [open [gitdir remotes $r] r]\n+\t\t\twhile {[gets $fd n] >= 0} {\n+\t\t\t\tif {[regexp {^Push:[ \\t]*([^:]+):} $n]} {\n+\t\t\t\t\tset enable 1\n+\t\t\t\t\tbreak\n \t\t\t\t}\n-\t\t\t\tclose $fd\n \t\t\t}\n+\t\t\tclose $fd\n \t\t}\n+\t}\n \n-\t\tif {$enable} {\n-\t\t\tif {![winfo exists $push_m]} {\n-\t\t\t\tmenu $push_m\n-\t\t\t\t$remote_m insert 0 cascade \\\n-\t\t\t\t\t-label [mc \"Push to\"] \\\n-\t\t\t\t\t-menu $push_m\n-\t\t\t}\n-\n-\t\t\t$push_m add command \\\n-\t\t\t\t-label $r \\\n-\t\t\t\t-command [list push_to $r]\n+\tif {$enable} {\n+\t\tif {![winfo exists $push_m]} {\n+\t\t\tmenu $push_m\n+\t\t\t$remote_m insert 0 cascade \\\n+\t\t\t\t-label [mc \"Push to\"] \\\n+\t\t\t\t-menu $push_m\n \t\t}\n+\n+\t\t$push_m add command \\\n+\t\t\t-label $r \\\n+\t\t\t-command [list push_to $r]\n+\t}\n+}\n+\n+proc populate_remotes_menu {} {\n+\tglobal all_remotes\n+\n+\tforeach r $all_remotes {\n+\t\tadd_fetch_entry $r\n+\t\tadd_push_entry $r\n \t}\n }\n-- \ntg: (c427559..) t/git-gui/populate-refactor (depends on: vanilla/master)\n"},{"id":"91531","messageId":"20080924221732.904804942@suse.cz","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"[PATCH 4/5] git-gui: Factor out URL inputbox construction to location_input","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:53Z","receivedAt":"2008-09-24T22:12:53Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This will make it easier to introduce custom locators.\n\nThis patch has been sponsored by Novartis.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n git-gui/lib/choose_repository.tcl    |    6 +---\n git-gui/lib/remote_add.tcl           |    6 +---\n git-gui/lib/remote_branch_delete.tcl |   11 +-------\n git-gui/lib/transport.tcl            |   46 ++++++++++++++++++++-------------\n 4 files changed, 31 insertions(+), 38 deletions(-)\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 9091316..1c951ae 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -465,11 +465,7 @@ method _do_clone {} {\n \tpack $args -fill both\n \n \tlabel $args.origin_l -text [mc \"Source Location:\"]\n-\tentry $args.origin_t \\\n-\t\t-textvariable @origin_url \\\n-\t\t-borderwidth 1 \\\n-\t\t-relief sunken \\\n-\t\t-width 50\n+\tlocation_input $args.origin_t @origin_url\n \tbutton $args.origin_b \\\n \t\t-text [mc \"Browse\"] \\\n \t\t-command [cb _open_origin]\ndiff --git a/git-gui/lib/remote_add.tcl b/git-gui/lib/remote_add.tcl\nindex 89e88ee..b4a9ede 100644\n--- a/git-gui/lib/remote_add.tcl\n+++ b/git-gui/lib/remote_add.tcl\n@@ -49,11 +49,7 @@ constructor dialog {} {\n \n \tlabel $w.desc.loc_l -text [mc \"Location:\"]\n \tset w_loc $w.desc.loc_t\n-\tentry $w_loc \\\n-\t\t-borderwidth 1 \\\n-\t\t-relief sunken \\\n-\t\t-width 40 \\\n-\t\t-textvariable @location\n+\tlocation_input $w_loc @location\n \tgrid $w.desc.loc_l $w_loc -sticky we -padx {0 5}\n \n \tgrid columnconfigure $w.desc 1 -weight 1\ndiff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl\nindex a09b9ad..14a4c15 100644\n--- a/git-gui/lib/remote_branch_delete.tcl\n+++ b/git-gui/lib/remote_branch_delete.tcl\n@@ -66,16 +66,7 @@ constructor dialog {} {\n \t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable @urltype\n-\tentry $w.dest.url_t \\\n-\t\t-borderwidth 1 \\\n-\t\t-relief sunken \\\n-\t\t-width 50 \\\n-\t\t-textvariable @url \\\n-\t\t-validate key \\\n-\t\t-validatecommand {\n-\t\t\tif {%d == 1 && [regexp {\\s} %S]} {return 0}\n-\t\t\treturn 1\n-\t\t}\n+\tlocation_input $w.dest.url_t @url\n \ttrace add variable @url write [cb _write_url]\n \tgrid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5}\n \tgrid columnconfigure $w.dest 1 -weight 1\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex e419d78..b8ceebe 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -30,6 +30,21 @@ proc push_to {remote} {\n \tconsole::exec $w $cmd\n }\n \n+proc location_input {widget urlvar} {\n+\tglobal repo_config\n+\n+\tentry $widget \\\n+\t\t-borderwidth 1 \\\n+\t\t-relief sunken \\\n+\t\t-width 50 \\\n+\t\t-textvariable $urlvar \\\n+\t\t-validate key \\\n+\t\t-validatecommand {\n+\t\t\tif {%d == 1 && [regexp {\\s} %S]} {return 0}\n+\t\t\treturn 1\n+\t\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@@ -77,11 +92,22 @@ proc start_push_anywhere_action {w} {\n trace add variable push_remote write \\\n \t[list radio_selector push_urltype remote]\n \n+proc push_anywhere_urltype {args} {\n+\tglobal push_urltype\n+\tset push_urltype url\n+\twarn_popup \"blablabla\"\n+}\n+\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 \n+\tset push_url {}\n+\tset push_force 0\n+\tset push_thin 0\n+\tset push_tags 0\n+\n \tset w .push_setup\n \ttoplevel $w\n \twm geometry $w \"+[winfo rootx .]+[winfo rooty .]\"\n@@ -138,19 +164,8 @@ proc do_push_anywhere {} {\n \t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable push_urltype\n-\tentry $w.dest.url_t \\\n-\t\t-borderwidth 1 \\\n-\t\t-relief sunken \\\n-\t\t-width 50 \\\n-\t\t-textvariable push_url \\\n-\t\t-validate key \\\n-\t\t-validatecommand {\n-\t\t\tif {%d == 1 && [regexp {\\s} %S]} {return 0}\n-\t\t\tif {%d == 1 && [string length %S] > 0} {\n-\t\t\t\tset push_urltype url\n-\t\t\t}\n-\t\t\treturn 1\n-\t\t}\n+\tlocation_input $w.dest.url_t push_url\n+\ttrace add variable push_url write push_anywhere_urltype\n \tgrid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5}\n \tgrid columnconfigure $w.dest 1 -weight 1\n \tpack $w.dest -anchor nw -fill x -pady 5 -padx 5\n@@ -171,11 +186,6 @@ proc do_push_anywhere {} {\n \tgrid columnconfigure $w.options 1 -weight 1\n \tpack $w.options -anchor nw -fill x -pady 5 -padx 5\n \n-\tset push_url {}\n-\tset push_force 0\n-\tset push_thin 0\n-\tset push_tags 0\n-\n \tbind $w <Visibility> \"grab $w; focus $w.buttons.create\"\n \tbind $w <Key-Escape> \"destroy $w\"\n \tbind $w <Key-Return> [list start_push_anywhere_action $w]\n-- \ntg: (4e2c8cc..) t/git-gui/ldialogs-refactor (depends on: t/git-gui/ldialogs-consistent t/git-gui/remote-add)\n"},{"id":"91533","messageId":"20080924221733.552292124@suse.cz","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"[PATCH 5/5] git-gui: Support for user-provided locator templates","fromName":"","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:12:54Z","receivedAt":"2008-09-24T22:12:54Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Users can now configure their own 'locator' templates, which they\ncan use to easen entering of common URLs; in all location inputs,\nthey can choose from the defined locators (and raw URL entry) and\ntheir input is then substituted to the locator template.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n Documentation/config.txt             |   25 ++++++++++++++++\n git-gui/lib/choose_repository.tcl    |    7 ++++-\n git-gui/lib/remote_add.tcl           |    2 +-\n git-gui/lib/remote_branch_delete.tcl |    2 +-\n git-gui/lib/transport.tcl            |   52 +++++++++++++++++++++++++++++++--\n 5 files changed, 81 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex bea867d..f3e82c6 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -788,6 +788,21 @@ gui.pruneduringfetch::\n \t\"true\" if linkgit:git-gui[1] should prune tracking branches when\n \tperforming a fetch. The default value is \"false\".\n \n+gui.pulllocator::\n+\tSpecifies the locator pre-selected for cloning and pulling\n+\tin case any locator templates (see 'locator.*.template')\n+\tare available. Set to 'URL' to default to the URL entry.\n+\n+gui.pushlocator::\n+\tSpecifies the locator pre-selected for pushing\n+\tin case any locator templates (see 'locator.*.template')\n+\tare available. Set to 'URL' to default to the URL entry.\n+\n+gui.remotelocator::\n+\tSpecifies the locator pre-selected when adding remotes\n+\tin case any locator templates (see 'locator.*.template')\n+\tare available. Set to 'URL' to default to the URL entry.\n+\n gui.trustmtime::\n \tDetermines if linkgit:git-gui[1] should trust the file modification\n \ttimestamp or not. By default the timestamps are not trusted.\n@@ -891,6 +906,16 @@ instaweb.port::\n \tThe port number to bind the gitweb httpd to. See\n \tlinkgit:git-instaweb[1].\n \n+locator.<name>.template::\n+\tNormally, you specify repository locations e.g. when cloning\n+\tor adding remotes by some kind of full-fledged URL-ish specifier.\n+\tThis option lets you specify templates for the most common locations\n+\tso that you do not have to type out the full URLs all the time;\n+\t'%s' in the template is substituted by user input. Thus, for example\n+\t'locator.ror.template = \"git://git.kernel.org/%s\"' would let you\n+\teasily refer to kernel.org projects. Currently, the user-defined\n+\tlocators are supported only by linkgit:git-gui[1].\n+\n log.date::\n \tSet default date-time mode for the log command. Setting log.date\n \tvalue is similar to using 'git-log'\\'s --date option. The value is one of the\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 1c951ae..e05d3a9 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -465,7 +465,7 @@ method _do_clone {} {\n \tpack $args -fill both\n \n \tlabel $args.origin_l -text [mc \"Source Location:\"]\n-\tlocation_input $args.origin_t @origin_url\n+\tlocation_input $args.origin_t @origin_url pull\n \tbutton $args.origin_b \\\n \t\t-text [mc \"Browse\"] \\\n \t\t-command [cb _open_origin]\n@@ -541,6 +541,11 @@ method _open_origin {} {\n \t\treturn\n \t}\n \tset origin_url $p\n+\n+\t# Fix up locators in case we use them\n+\tglobal _locator_template _locator_input\n+\tset _locator_template URL\n+\tset _locator_input $p\n }\n \n method _update_clone {args} {\ndiff --git a/git-gui/lib/remote_add.tcl b/git-gui/lib/remote_add.tcl\nindex b4a9ede..dec9dcb 100644\n--- a/git-gui/lib/remote_add.tcl\n+++ b/git-gui/lib/remote_add.tcl\n@@ -49,7 +49,7 @@ constructor dialog {} {\n \n \tlabel $w.desc.loc_l -text [mc \"Location:\"]\n \tset w_loc $w.desc.loc_t\n-\tlocation_input $w_loc @location\n+\tlocation_input $w_loc @location remote\n \tgrid $w.desc.loc_l $w_loc -sticky we -padx {0 5}\n \n \tgrid columnconfigure $w.desc 1 -weight 1\ndiff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl\nindex 14a4c15..5cdab49 100644\n--- a/git-gui/lib/remote_branch_delete.tcl\n+++ b/git-gui/lib/remote_branch_delete.tcl\n@@ -66,7 +66,7 @@ constructor dialog {} {\n \t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable @urltype\n-\tlocation_input $w.dest.url_t @url\n+\tlocation_input $w.dest.url_t @url push\n \ttrace add variable @url write [cb _write_url]\n \tgrid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5}\n \tgrid columnconfigure $w.dest 1 -weight 1\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex b8ceebe..277e6b8 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -30,19 +30,63 @@ proc push_to {remote} {\n \tconsole::exec $w $cmd\n }\n \n-proc location_input {widget urlvar} {\n+proc locator_update {args} {\n \tglobal repo_config\n+\tglobal _locator_template _locator_input _locator_var\n+\tregsub -all %s \"$repo_config(locator.$_locator_template.template)\" \\\n+\t\t$_locator_input $_locator_var\n+}\n+\n+proc location_input {widget urlvar op} {\n+\tglobal repo_config all_locators\n+\tset all_locators [list]\n+\n+\tset repo_config(locator.URL.template) \"%s\"\n+\tforeach line [array names repo_config locator.*.template] {\n+\t\tif {![regexp ^locator\\.(.*)\\.template\\$ $line line name]} continue\n+\t\tlappend all_locators $name\n+\t}\n+\n+\t# 1 == just the default URL locator\n+\tif {[llength $all_locators] == 1} {\n+\t\tentry $widget \\\n+\t\t\t-borderwidth 1 \\\n+\t\t\t-relief sunken \\\n+\t\t\t-width 50 \\\n+\t\t\t-textvariable $urlvar \\\n+\t\t\t-validate key \\\n+\t\t\t-validatecommand {\n+\t\t\t\tif {%d == 1 && [regexp {\\s} %S]} {return 0}\n+\t\t\t\treturn 1\n+\t\t\t}\n+\t\treturn 0\n+\t}\n+\n+\tif {[catch {set default_locator $repo_config(gui.${op}locator)}]} {\n+\t\tset default_locator [lindex $all_locators 0]\n+\t}\n+\n+\tglobal _locator_template _locator_input _locator_var\n+\ttrace remove variable _locator_input write locator_update\n+\tset _locator_template $default_locator\n+\tset _locator_input {}\n+\tset _locator_var $urlvar\n+\ttrace add variable _locator_input write locator_update\n \n-\tentry $widget \\\n+\tframe $widget\n+\teval tk_optionMenu $widget.l _locator_template $all_locators\n+\tentry $widget.s \\\n \t\t-borderwidth 1 \\\n \t\t-relief sunken \\\n \t\t-width 50 \\\n-\t\t-textvariable $urlvar \\\n+\t\t-textvariable _locator_input \\\n \t\t-validate key \\\n \t\t-validatecommand {\n \t\t\tif {%d == 1 && [regexp {\\s} %S]} {return 0}\n \t\t\treturn 1\n \t\t}\n+\tpack $widget.l -side left\n+\tpack $widget.s -side right -fill x\n }\n \n proc start_push_anywhere_action {w} {\n@@ -164,7 +208,7 @@ proc do_push_anywhere {} {\n \t\t-text [mc \"Arbitrary Location:\"] \\\n \t\t-value url \\\n \t\t-variable push_urltype\n-\tlocation_input $w.dest.url_t push_url\n+\tlocation_input $w.dest.url_t push_url push\n \ttrace add variable push_url write push_anywhere_urltype\n \tgrid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5}\n \tgrid columnconfigure $w.dest 1 -weight 1\n-- \ntg: (d617ccd..) t/git-gui/locators (depends on: t/git-gui/ldialogs-refactor)\n"},{"id":"91534","messageId":"20080924222357.GK10544@machine.or.cz","threadId":"15659","inReplyTo":"20080924221732.257739465@suse.cz","subject":"Re: [PATCH 3/5] git-gui: Squash populate_{push,fetch}_menu to populate_remotes_menu","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T22:23:57Z","receivedAt":"2008-09-24T22:23:57Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Thu, Sep 25, 2008 at 12:12:52AM +0200, pasky@suse.cz wrote:\n> The meat of the routines is now separated to add_fetch_entry() and\n> add_push_entry(). This refactoring will allow easy implementation of adding\n> individual remotes later.\n> \n> This patch has been sponsored by Novartis.\n> \n> Signed-off-by: Petr Baudis <pasky@suse.cz>\n\nSorry, this patch slipped through from another series ;-) - please\ndisregard.\n\nAlso, the PATCH 4/5 has slight dependency on the git-gui remotes series,\nbut the change to git-gui/lib/remote_add.tcl can just be trimmed if this\nwould be to go in earlier.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nPeople who take cold baths never have rheumatism, but they have\ncold baths.\n"},{"id":"91634","messageId":"alpine.LNX.1.00.0809251705260.19665@iabervon.org","threadId":"15659","inReplyTo":"20080924221249.037449176@suse.cz","subject":"Re: [PATCH 0/5] git-gui: Support for \"Locators\" - address templates","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-09-25T21:26:15Z","receivedAt":"2008-09-25T21:26:15Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Thu, 25 Sep 2008, pasky@suse.cz wrote:\n\n> This patch allows \"locators\" to be configured and used in the GUI,\n> basically as URL templates the input string is subsituted into.\n> The default operation of git-gui is not much affected (only some\n> labels change to be less confusing).\n> \n> This is aimed mainly at corporate Git deployments - the integrator\n> might want to configure the central corporate repository store as\n> the default locator so that people do not need to type the same\n> URL over and over but can instead just type the repository name\n> on the server. Or avid repo.or.cz users might set up a 'repo'\n> locator pointing at 'git://repo.or.cz/%s'.\n\nCan this be set up to use the \"url.<base>.insteadOf\" configuration? Part \nof my goal with that feature was to make it easy for me to reference \nprojects on my work's central repository store. That is, put in your \n~/gitconfig:\n\n[url \"git://repo.or.cz/\"]\n\tinsteadOf = repo:\n\nAnd \"git clone repo:alt-git\" works.\n\nIt'd be nice to share the config somehow so that the same settings can be \nused both in git-gui and on the command line. (I wrote the code so that a \nuser can swap patterns of URLs work for other people but aren't good for \nthat particular user, but it also applies to user-provided shorthand \nURLs.)\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"91686","messageId":"20080926143351.GY3669@spearce.org","threadId":"15659","inReplyTo":"alpine.LNX.1.00.0809251705260.19665@iabervon.org","subject":"Re: [PATCH 0/5] git-gui: Support for \"Locators\" - address templates","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-26T14:33:51Z","receivedAt":"2008-09-26T14:33:51Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> wrote:\n> On Thu, 25 Sep 2008, pasky@suse.cz wrote:\n> \n> > This patch allows \"locators\" to be configured and used in the GUI,\n> > basically as URL templates the input string is subsituted into.\n> \n> Can this be set up to use the \"url.<base>.insteadOf\" configuration? Part \n> of my goal with that feature was to make it easy for me to reference \n> projects on my work's central repository store. That is, put in your \n> ~/gitconfig:\n> \n> [url \"git://repo.or.cz/\"]\n> \tinsteadOf = repo:\n> \n> And \"git clone repo:alt-git\" works.\n\nThat's a good idea.\n\nWhen I saw the locator patch come by I thought a bit about the\ninsteadOf idea, but didn't make it far enough to open an email\ndiscussion about it.\n\nPasky?\n \n-- \nShawn.\n"}]}