diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index aef9d66..a79d734 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2305,6 +2305,10 @@ if {[is_enabled transport]} {
menu .mbar.remote
.mbar.remote add command \
+ -label [mc "Register on repo.or.cz"] \
+ -command remote_add::dialog_reg \
+ -accelerator $M1T-L
+ .mbar.remote add command \
-label [mc "Add..."] \
-command remote_add::dialog \
-accelerator $M1T-Adiff --git a/git-gui/lib/remote_add.tcl b/git-gui/lib/remote_add.tcl
index 94662fb..fb43abd 100644
--- a/git-gui/lib/remote_add.tcl
+++ b/git-gui/lib/remote_add.tcl
@@ -6,22 +6,36 @@ class remote_add {
field w ; # widget path
field w_name ; # new remote name widget
field w_loc ; # new remote location widget
+field is_reg 0; # are we the REGistering dialog, or normal add remote?
+field base_name ; # name of base project if is_reg
field name {}; # name of the remote the user has chosen
field location {}; # location of the remote the user has chosen
-field opt_action fetch; # action to do after registering the remote locally
+field opt_action {}; # action to do after registering the remote locally
-constructor dialog {} {
+proc dialog {} {
+ dialog_create "" 0 "fetch" "Add New Remote"
+}
+
+proc dialog_reg {} {
+ dialog_create "public" 1 "push" "Register On repo.or.cz"
+}
+
+constructor dialog_create {name_ is_reg_ opt_action_ title} {
global repo_config
+ set name $name_
+ set is_reg $is_reg_
+ set opt_action $opt_action_
+
make_toplevel top w
- wm title $top [append "[appname] ([reponame]): " [mc "Add Remote"]]
+ wm title $top [append "[appname] ([reponame]): " [mc $title]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
- label $w.header -text [mc "Add New Remote"] -font font_uibold
+ label $w.header -text [mc $title] -font font_uibold
pack $w.header -side top -fill x
frame $w.buttons@@ -49,7 +63,9 @@ constructor dialog {} {
label $w.desc.loc_l -text [mc "Location:"]
set w_loc $w.desc.loc_t
- location_input $w_loc @location remote
+ set location_op "remote"
+ if {$is_reg} { set location_op "reg" }
+ location_input $w_loc @location $location_op
grid $w.desc.loc_l $w_loc -sticky we -padx {0 5}
grid columnconfigure $w.desc 1 -weight 1@@ -78,6 +94,18 @@ constructor dialog {} {
grid columnconfigure $w.action 1 -weight 1
pack $w.action -anchor nw -fill x -pady 5 -padx 5
+ if {$is_reg} {
+ focus $w_loc
+ set matcher [regsub -all %s "$repo_config(locator.repo.template)" "(.*)"]
+ set origin willnevermatch
+ catch { set origin $repo_config(remote.origin.url) }
+ if {![regexp $matcher $origin xx base_name]} {
+ error_popup "This repository is not based on a repo.or.cz project; you need to register your project manually."
+ destroy $w
+ return
+ }
+ }
+
bind $w <Visibility> [cb _visible]
bind $w <Key-Escape> [list destroy $w]
bind $w <Key-Return> [cb _add]\;break@@ -160,6 +188,10 @@ method _add {} {
[mc "Setting up the %s (at %s)" $name $location]]
lappend cmds [list exec git push -v --all $name]
+ if {$is_reg} {
+ global _locator_input
+ start_browser "http://repo.or.cz/m/regproj.cgi?fork=$base_name;LOC_i1=$_locator_input"
+ }
console::chain $c $cmds
}
none {diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index 277e6b8..b80d526 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -62,6 +62,12 @@ proc location_input {widget urlvar op} {
return 0
}
+ set state "normal"
+ if {$op == "reg"} {
+ set state "disabled"
+ set op "remote"
+ }
+
if {[catch {set default_locator $repo_config(gui.${op}locator)}]} {
set default_locator [lindex $all_locators 0]
}@@ -75,6 +81,7 @@ proc location_input {widget urlvar op} {
frame $widget
eval tk_optionMenu $widget.l _locator_template $all_locators
+ $widget.l configure -state $state
entry $widget.s \
-borderwidth 1 \
-relief sunken \--
tg: (2735999..) t/git-gui/remote-publish (depends on: git-gui/remotes git-gui/locators git-gui/web-browse t/git-gui/remote-fetch)