git-gui: Support for "Locators" - address templates
cover git-gui: Support for "Locators" - address templates
This patch allows "locators" to be configured and used in the GUI, basically as URL templates the input string is subsituted into. The default operation of git-gui is not much affected (only some labels change to be less confusing).
This is aimed mainly at corporate Git deployments - the integrator might want to configure the central corporate repository store as the default locator so that people do not need to type the same URL over and over but can instead just type the repository name on the server. Or avid repo.or.cz users might set up a 'repo' locator pointing at 'git://repo.or.cz/%s'.
In practice, this seems to be a more significant usability improvement than it might seem. Less technical users appear to be less daunted to type in just the project name instead of dealing with long URLs.
PATCH 1/5 git-gui: Avoid using the term URL when specifying repositories
Instead, 'Location' is used to label such inputs; in the Clone dialog, 'Source' and 'Target' are also introduced to further clarify the situation. The intent is to increase GUI consistency in the case location templates (upcoming) are used - then, other locators than URL may be used.
This patch has been sponsored by Novartis.
--- git-gui/lib/choose_repository.tcl | 4 ++-- git-gui/lib/remote_branch_delete.tcl | 2 +- git-gui/lib/transport.tcl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
git-gui/lib/choose_repository.tcl +2 -2
@@ -463,7 +463,7 @@ method _do_clone {} { frame $w_body.args pack $args -fill both - label $args.origin_l -text [mc "URL:"] + label $args.origin_l -text [mc "Source Location:"] entry $args.origin_t \ -textvariable @origin_url \ -font font_diff \
@@ -473,7 +473,7 @@ method _do_clone {} { -command [cb _open_origin] grid $args.origin_l $args.origin_t $args.origin_b -sticky ew - label $args.where_l -text [mc "Directory:"] + label $args.where_l -text [mc "Target Directory:"] entry $args.where_t \ -textvariable @local_path \ -font font_diff \
git-gui/lib/remote_branch_delete.tcl +1 -1
@@ -63,7 +63,7 @@ constructor dialog {} { set urltype url } radiobutton $w.dest.url_r \ - -text [mc "Arbitrary URL:"] \ + -text [mc "Arbitrary Location:"] \ -value url \ -variable @urltype entry $w.dest.url_t \
git-gui/lib/transport.tcl +1 -1
@@ -135,7 +135,7 @@ proc do_push_anywhere {} { set push_urltype url } radiobutton $w.dest.url_r \ - -text [mc "Arbitrary URL:"] \ + -text [mc "Arbitrary Location:"] \ -value url \ -variable push_urltype entry $w.dest.url_t \
Signature · 1 line
tg: (c427559..) t/git-gui/avoid-url (depends on: vanilla/master)
PATCH 2/5 git-gui: Make input boxes in init/clone/open dialogs consistent
In reply to [email protected]Before, the input boxes would not be sunken and would have larger border, which is inconsistent with the rest of the inputboxes for repository locations in the git-gui UI.
This patch has been sponsored by Novartis.
--- git-gui/lib/choose_repository.tcl | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
git-gui/lib/choose_repository.tcl +8 -4
@@ -381,7 +381,8 @@ method _do_new {} { label $w_body.where.l -text [mc "Directory:"] entry $w_body.where.t \ -textvariable @local_path \ - -font font_diff \ + -borderwidth 1 \ + -relief sunken \ -width 50 button $w_body.where.b \ -text [mc "Browse"] \
@@ -466,7 +467,8 @@ method _do_clone {} { label $args.origin_l -text [mc "Source Location:"] entry $args.origin_t \ -textvariable @origin_url \ - -font font_diff \ + -borderwidth 1 \ + -relief sunken \ -width 50 button $args.origin_b \ -text [mc "Browse"] \
@@ -476,7 +478,8 @@ method _do_clone {} { label $args.where_l -text [mc "Target Directory:"] entry $args.where_t \ -textvariable @local_path \ - -font font_diff \ + -borderwidth 1 \ + -relief sunken \ -width 50 button $args.where_b \ -text [mc "Browse"] \
@@ -979,7 +982,8 @@ method _do_open {} { label $w_body.where.l -text [mc "Repository:"] entry $w_body.where.t \ -textvariable @local_path \ - -font font_diff \ + -borderwidth 1 \ + -relief sunken \ -width 50 button $w_body.where.b \ -text [mc "Browse"] \
Signature · 1 line
tg: (cdbf2d1..) t/git-gui/ldialogs-consistent (depends on: t/git-gui/avoid-url)
PATCH 3/5 git-gui: Squash populate_{push,fetch}_menu to populate_remotes_menu
In reply to [email protected]The meat of the routines is now separated to add_fetch_entry() and add_push_entry(). This refactoring will allow easy implementation of adding individual remotes later.
This patch has been sponsored by Novartis.
--- git-gui/git-gui.sh | 3 +- git-gui/lib/remote.tcl | 137 ++++++++++++++++++++++++------------------------ 2 files changed, 70 insertions(+), 70 deletions(-)
git-gui/git-gui.sh +1 -2
@@ -3100,8 +3100,7 @@ if {[is_enabled transport]} { load_all_remotes set n [.mbar.remote index end] - populate_push_menu - populate_fetch_menu + populate_remotes_menu set n [expr {[.mbar.remote index end] - $n}] if {$n > 0} { if {[.mbar.remote type 0] eq "tearoff"} { incr n }
git-gui/lib/remote.tcl +69 -68
160 lines not on this page · raw message
Signature · 1 line
tg: (c427559..) t/git-gui/populate-refactor (depends on: vanilla/master)
Re: [PATCH 3/5] git-gui: Squash populate_{push,fetch}_menu to populate_remotes_menu
Quoted 7 lines · On Thu, Sep 25, 2008 at 12:12:52AM +0200, [email protected] wrote:
The meat of the routines is now separated to
add_fetch_entry()andadd_push_entry(). This refactoring will allow easy implementation of adding individual remotes later.This patch has been sponsored by Novartis.
Signed-off-by Petr Baudis <[email protected]>
Sorry, this patch slipped through from another series ;-) - please disregard.
Also, the PATCH 4/5 has slight dependency on the git-gui remotes series, but the change to git-gui/lib/remote_add.tcl can just be trimmed if this would be to go in earlier.
Signature · 3 lines
Petr "Pasky" Baudis People who take cold baths never have rheumatism, but they have cold baths.
PATCH 4/5 git-gui: Factor out URL inputbox construction to location_input
In reply to [email protected]This will make it easier to introduce custom locators.
This patch has been sponsored by Novartis.
--- git-gui/lib/choose_repository.tcl | 6 +--- git-gui/lib/remote_add.tcl | 6 +--- git-gui/lib/remote_branch_delete.tcl | 11 +------- git-gui/lib/transport.tcl | 46 ++++++++++++++++++++------------- 4 files changed, 31 insertions(+), 38 deletions(-)
git-gui/lib/choose_repository.tcl +1 -5
@@ -465,11 +465,7 @@ method _do_clone {} { pack $args -fill both label $args.origin_l -text [mc "Source Location:"] - entry $args.origin_t \ - -textvariable @origin_url \ - -borderwidth 1 \ - -relief sunken \ - -width 50 + location_input $args.origin_t @origin_url button $args.origin_b \ -text [mc "Browse"] \ -command [cb _open_origin]
git-gui/lib/remote_add.tcl +1 -5
@@ -49,11 +49,7 @@ constructor dialog {} { label $w.desc.loc_l -text [mc "Location:"] set w_loc $w.desc.loc_t - entry $w_loc \ - -borderwidth 1 \ - -relief sunken \ - -width 40 \ - -textvariable @location + location_input $w_loc @location grid $w.desc.loc_l $w_loc -sticky we -padx {0 5} grid columnconfigure $w.desc 1 -weight 1
git-gui/lib/remote_branch_delete.tcl +1 -10
@@ -66,16 +66,7 @@ constructor dialog {} { -text [mc "Arbitrary Location:"] \ -value url \ -variable @urltype - entry $w.dest.url_t \ - -borderwidth 1 \ - -relief sunken \ - -width 50 \ - -textvariable @url \ - -validate key \ - -validatecommand { - if {%d == 1 && [regexp {\s} %S]} {return 0} - return 1 - } + location_input $w.dest.url_t @url trace add variable @url write [cb _write_url] grid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5} grid columnconfigure $w.dest 1 -weight 1
git-gui/lib/transport.tcl +28 -18
75 lines not on this page · raw message
Signature · 1 line
tg: (4e2c8cc..) t/git-gui/ldialogs-refactor (depends on: t/git-gui/ldialogs-consistent t/git-gui/remote-add)
PATCH 5/5 git-gui: Support for user-provided locator templates
In reply to [email protected]Users can now configure their own 'locator' templates, which they can use to easen entering of common URLs; in all location inputs, they can choose from the defined locators (and raw URL entry) and their input is then substituted to the locator template.
--- Documentation/config.txt | 25 ++++++++++++++++ git-gui/lib/choose_repository.tcl | 7 ++++- git-gui/lib/remote_add.tcl | 2 +- git-gui/lib/remote_branch_delete.tcl | 2 +- git-gui/lib/transport.tcl | 52 +++++++++++++++++++++++++++++++-- 5 files changed, 81 insertions(+), 7 deletions(-)
Documentation/config.txt +25 -0
@@ -788,6 +788,21 @@ gui.pruneduringfetch:: "true" if linkgit:git-gui[1] should prune tracking branches when performing a fetch. The default value is "false". +gui.pulllocator:: + Specifies the locator pre-selected for cloning and pulling + in case any locator templates (see 'locator.*.template') + are available. Set to 'URL' to default to the URL entry. + +gui.pushlocator:: + Specifies the locator pre-selected for pushing + in case any locator templates (see 'locator.*.template') + are available. Set to 'URL' to default to the URL entry. + +gui.remotelocator:: + Specifies the locator pre-selected when adding remotes + in case any locator templates (see 'locator.*.template') + are available. Set to 'URL' to default to the URL entry. + gui.trustmtime:: Determines if linkgit:git-gui[1] should trust the file modification timestamp or not. By default the timestamps are not trusted.
@@ -891,6 +906,16 @@ instaweb.port:: The port number to bind the gitweb httpd to. See linkgit:git-instaweb[1]. +locator.<name>.template:: + Normally, you specify repository locations e.g. when cloning + or adding remotes by some kind of full-fledged URL-ish specifier. + This option lets you specify templates for the most common locations + so that you do not have to type out the full URLs all the time; + '%s' in the template is substituted by user input. Thus, for example + 'locator.ror.template = "git://git.kernel.org/%s"' would let you + easily refer to kernel.org projects. Currently, the user-defined + locators are supported only by linkgit:git-gui[1]. + log.date:: Set default date-time mode for the log command. Setting log.date value is similar to using 'git-log'\'s --date option. The value is one of the
git-gui/lib/choose_repository.tcl +6 -1
@@ -465,7 +465,7 @@ method _do_clone {} { pack $args -fill both label $args.origin_l -text [mc "Source Location:"] - location_input $args.origin_t @origin_url + location_input $args.origin_t @origin_url pull button $args.origin_b \ -text [mc "Browse"] \ -command [cb _open_origin]
@@ -541,6 +541,11 @@ method _open_origin {} { return } set origin_url $p + + # Fix up locators in case we use them + global _locator_template _locator_input + set _locator_template URL + set _locator_input $p } method _update_clone {args} {
git-gui/lib/remote_add.tcl +1 -1
@@ -49,7 +49,7 @@ constructor dialog {} { label $w.desc.loc_l -text [mc "Location:"] set w_loc $w.desc.loc_t - location_input $w_loc @location + location_input $w_loc @location remote grid $w.desc.loc_l $w_loc -sticky we -padx {0 5} grid columnconfigure $w.desc 1 -weight 1
git-gui/lib/remote_branch_delete.tcl +1 -1
@@ -66,7 +66,7 @@ constructor dialog {} { -text [mc "Arbitrary Location:"] \ -value url \ -variable @urltype - location_input $w.dest.url_t @url + location_input $w.dest.url_t @url push trace add variable @url write [cb _write_url] grid $w.dest.url_r $w.dest.url_t -sticky we -padx {0 5} grid columnconfigure $w.dest 1 -weight 1
git-gui/lib/transport.tcl +48 -4
74 lines not on this page · raw message
Signature · 1 line
tg: (d617ccd..) t/git-gui/locators (depends on: t/git-gui/ldialogs-refactor)
Quoted 11 lines · On Thu, 25 Sep 2008, [email protected] wrote:
This patch allows "locators" to be configured and used in the GUI, basically as URL templates the input string is subsituted into. The default operation of git-gui is not much affected (only some labels change to be less confusing).
This is aimed mainly at corporate Git deployments - the integrator might want to configure the central corporate repository store as the default locator so that people do not need to type the same URL over and over but can instead just type the repository name on the server. Or avid repo.or.cz users might set up a 'repo' locator pointing at '
git://repo.or.cz/%s'.
Can this be set up to use the "url.<base>.insteadOf" configuration? Part of my goal with that feature was to make it easy for me to reference projects on my work's central repository store. That is, put in your ~/gitconfig:
[url "git://repo.or.cz/"]
insteadOf = repo:
And "git clone repo:alt-git" works.
It'd be nice to share the config somehow so that the same settings can be used both in git-gui and on the command line. (I wrote the code so that a user can swap patterns of URLs work for other people but aren't good for that particular user, but it also applies to user-provided shorthand URLs.)
-Daniel
*This .sig left intentionally blank*
Quoted 10 lines · Daniel Barkalow
Quoted 2 lines · On Thu, 25 Sep 2008, [email protected] wrote:
This patch allows "locators" to be configured and used in the GUI, basically as URL templates the input string is subsituted into.
Can this be set up to use the "url.<base>.insteadOf" configuration? Part of my goal with that feature was to make it easy for me to reference projects on my work's central repository store. That is, put in your ~/gitconfig:
Quoted 4 lines
[url "
git://repo.or.cz/"]
insteadOf = repo:And "git clone repo:alt-git" works.
That's a good idea.
When I saw the locator patch come by I thought a bit about the insteadOf idea, but didn't make it far enough to open an email discussion about it.
Pasky?
Signature · 1 line
Shawn.