From: Heiko Voigt <hvoigt@hvoigt.net>
To: Pat Thoyts <patthoyts@gmail.com>
Cc: Pat Thoyts <patthoyts@googlemail.com>,
git@vger.kernel.org, Jens Lehmann <jens.lehmann@web.de>
Subject: [RFC PATCH 2/2] git-gui: teach fetch/prune menu to do it for all remotes
Date: Sun, 13 Feb 2011 14:57:15 +0100 [thread overview]
Message-ID: <20110213135714.GE31986@book.hvoigt.net> (raw)
In-Reply-To: <20110213134753.GC31986@book.hvoigt.net>
The commandline fetch already has this option for some time. Since this
was not available at the time git gui was written lets implement it now.
Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
---
It just came to my mind that I probably should implement a version check
of the commandline to ensure that this option is available. Thats why I
tagged only this patch with RFC.
Cheers Heiko
lib/remote.tcl | 45 +++++++++++++++++++++++++++++++++++++++++++++
lib/transport.tcl | 29 +++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/lib/remote.tcl b/lib/remote.tcl
index d9eab78..7011681 100644
--- a/lib/remote.tcl
+++ b/lib/remote.tcl
@@ -230,6 +230,45 @@ proc make_sure_remote_submenues_exist {remote_m} {
}
}
+proc update_all_remotes_menu_entry {} {
+ global all_remotes
+
+ set have_remote 0
+ foreach r $all_remotes {
+ set have_remote 1
+ }
+
+ set remote_m .mbar.remote
+ set fetch_m $remote_m.fetch
+ set prune_m $remote_m.prune
+ if {$have_remote} {
+ make_sure_remote_submenues_exist $remote_m
+ if {[$fetch_m entrycget 0 -label] ne "All"} {
+
+ $fetch_m insert 0 separator
+ $fetch_m insert 0 command \
+ -label "All" \
+ -command fetch_from_all
+
+ $prune_m insert 0 separator
+ $prune_m insert 0 command \
+ -label "All" \
+ -command prune_from_all
+ }
+ } else {
+ if {[winfo exists $fetch_m]} {
+ if {[$fetch_m type end] eq "separator"} {
+
+ delete_from_menu $fetch_m 0
+ delete_from_menu $fetch_m 0
+
+ delete_from_menu $prune_m 0
+ delete_from_menu $prune_m 0
+ }
+ }
+ }
+}
+
proc populate_remotes_menu {} {
global all_remotes
@@ -237,6 +276,8 @@ proc populate_remotes_menu {} {
add_fetch_entry $r
add_push_entry $r
}
+
+ update_all_remotes_menu_entry
}
proc add_single_remote {name location} {
@@ -252,6 +293,8 @@ proc add_single_remote {name location} {
add_fetch_entry $name
add_push_entry $name
+
+ update_all_remotes_menu_entry
}
proc delete_from_menu {menu name} {
@@ -281,4 +324,6 @@ proc remove_remote {name} {
delete_from_menu $remote_m.remove $name
# Not all remotes are in the push menu
catch { delete_from_menu $remote_m.push $name }
+
+ update_all_remotes_menu_entry
}
diff --git a/lib/transport.tcl b/lib/transport.tcl
index 3067058..7fad9b7 100644
--- a/lib/transport.tcl
+++ b/lib/transport.tcl
@@ -20,6 +20,35 @@ proc prune_from {remote} {
console::exec $w [list git remote prune $remote]
}
+proc fetch_from_all {} {
+ set w [console::new \
+ [mc "fetch all remotes"] \
+ [mc "Fetching new changes from all remotes"]]
+
+ set cmd [list git fetch --all]
+ if {[is_config_true gui.pruneduringfetch]} {
+ lappend cmd --prune
+ }
+
+ console::exec $w $cmd
+}
+
+proc prune_from_all {} {
+ global all_remotes
+
+ set w [console::new \
+ [mc "remote prune all remotes"] \
+ [mc "Pruning tracking branches deleted from all remotes"]]
+
+ set cmd [list git remote prune]
+
+ foreach r $all_remotes {
+ lappend cmd $r
+ }
+
+ console::exec $w $cmd
+}
+
proc push_to {remote} {
set w [console::new \
[mc "push %s" $remote] \
--
1.7.4.rc3.4.g155c4
next prev parent reply other threads:[~2011-02-13 13:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-12 16:43 [PATCH 1/2] git-gui: fix deleting item from all_remotes variable Heiko Voigt
2011-02-13 13:20 ` Pat Thoyts
2011-02-13 13:47 ` Heiko Voigt
2011-02-13 13:50 ` [PATCH 1/2] git-gui: refactor remote submenu creation into subroutine Heiko Voigt
2011-02-13 13:57 ` Heiko Voigt [this message]
2011-02-14 13:03 ` [PATCH] git-gui: Include version check and test for tearoff menu entry Pat Thoyts
2011-02-14 21:31 ` Heiko Voigt
2011-02-15 0:31 ` Pat Thoyts
2011-02-17 20:06 ` Heiko Voigt
2011-02-22 18:36 ` [RFC PATCH 2/2] git-gui: teach fetch/prune menu to do it for all remotes Jens Lehmann
2011-02-22 19:28 ` [PATCH 1/2] git-gui: fetch/prune all entry only for more than one entry Heiko Voigt
2011-02-24 0:02 ` Pat Thoyts
2011-02-22 19:30 ` [PATCH 2/2] git-gui: fetch/prune all entry appears last Heiko Voigt
2011-02-23 19:19 ` Jens Lehmann
2011-02-24 0:09 ` Pat Thoyts
2011-02-13 14:05 ` Re: [PATCH 1/2] git-gui: fix deleting item from all_remotes variable Heiko Voigt
2011-02-13 14:15 ` Heiko Voigt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110213135714.GE31986@book.hvoigt.net \
--to=hvoigt@hvoigt.net \
--cc=git@vger.kernel.org \
--cc=jens.lehmann@web.de \
--cc=patthoyts@gmail.com \
--cc=patthoyts@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).