summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba6485e)
raw | patch | inline | side by side (parent: ba6485e)
author | Petr Baudis <pasky@suse.cz> | |
Wed, 24 Sep 2008 20:44:02 +0000 (22:44 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 30 Sep 2008 19:59:18 +0000 (12:59 -0700) |
We introduce new submenu Remote -> Remove Remote, allowing to remove
remotes. In the future, we might consider a confirmation popup to avoid
misclicks, but removing a remote is not very lossy operation.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
remotes. In the future, we might consider a confirmation popup to avoid
misclicks, but removing a remote is not very lossy operation.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/remote.tcl | patch | blob | history |
diff --git a/lib/remote.tcl b/lib/remote.tcl
index 643f0bc543411093e034297fdce95f60acc42216..1852247358fcf390a8f996ed6a14df0f141bdd0d 100644 (file)
--- a/lib/remote.tcl
+++ b/lib/remote.tcl
set remote_m .mbar.remote
set fetch_m $remote_m.fetch
set prune_m $remote_m.prune
+ set remove_m $remote_m.remove
set enable 0
if {![catch {set a $repo_config(remote.$r.url)}]} {
if {![catch {set a $repo_config(remote.$r.fetch)}]} {
if {$enable} {
if {![winfo exists $fetch_m]} {
+ menu $remove_m
+ $remote_m insert 0 cascade \
+ -label [mc "Remove Remote"] \
+ -menu $remove_m
+
menu $prune_m
$remote_m insert 0 cascade \
-label [mc "Prune from"] \
$prune_m add command \
-label $r \
-command [list prune_from $r]
+ $remove_m add command \
+ -label $r \
+ -command [list remove_remote $r]
}
}
add_fetch_entry $name
add_push_entry $name
}
+
+proc delete_from_menu {menu name} {
+ if {[winfo exists $menu]} {
+ $menu delete $name
+ }
+}
+
+proc remove_remote {name} {
+ global all_remotes repo_config
+
+ git remote rm $name
+
+ catch {
+ # Missing values are ok
+ unset repo_config(remote.$name.url)
+ unset repo_config(remote.$name.fetch)
+ unset repo_config(remote.$name.push)
+ }
+
+ set i [lsearch -exact all_remotes $name]
+ lreplace all_remotes $i $i
+
+ set remote_m .mbar.remote
+ delete_from_menu $remote_m.fetch $name
+ delete_from_menu $remote_m.prune $name
+ delete_from_menu $remote_m.remove $name
+ delete_from_menu $remote_m.push $name
+}