From: Petr Baudis <pasky@suse.cz>
To: git@vger.kernel.org
To: git@vger.kernel.org
Cc: spearce@spearce.org, Petr Baudis <petr.baudis@novartis.com>
Subject: [PATCH] git-gui: Implement a 'clone' subcommand
Date: Tue, 30 Sep 2008 18:51:41 +0200 [thread overview]
Message-ID: <1222793501-17997-1-git-send-email-pasky@suse.cz> (raw)
This enables git-gui to be started with the clone dialog opened right
away, possibly with the URL prefilled when it is passed as another
argument. git-gui can then be e.g. registered as the git:// protocol
handler.
This is just a simple implementation - we construct the front actions
page, then throw it away immediately; I wanted to avoid unnecessary
refactoring and complication of the code, though.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
---
Documentation/git-gui.txt | 5 +++++
git-gui/git-gui.sh | 21 ++++++++++++++++++---
git-gui/lib/choose_repository.tcl | 11 ++++++++++-
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt
index 0e650f4..9ce63be 100644
--- a/Documentation/git-gui.txt
+++ b/Documentation/git-gui.txt
@@ -43,6 +43,11 @@ citool::
to only commit actions, slightly reducing the application's
startup time and simplifying the menubar.
+clone::
+ Start the 'git-gui' clone dialog, optionally taking
+ a source location as an extra argument to pre-fill
+ in the dialog.
+
version::
Display the currently running version of 'git-gui'.
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 4085e8f..86f0151 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -950,6 +950,8 @@ enable_option multicommit
enable_option branch
enable_option transport
disable_option bare
+set init_action {}
+set clone_url {}
switch -- $subcommand {
browser -
@@ -960,6 +962,13 @@ blame {
disable_option branch
disable_option transport
}
+clone {
+ set init_action "clone"
+ if {[llength $argv] > 0} {
+ set clone_url [lindex $argv 0]
+ set argv [lrange $argv 1 end]
+ }
+}
citool {
enable_option singlecommit
enable_option retcode
@@ -995,7 +1004,12 @@ citool {
##
## repository setup
-if {[catch {
+if {$init_action != ""} {
+ load_config 1
+ apply_config
+ choose_repository::pick $init_action
+
+} elseif {[catch {
set _gitdir $env(GIT_DIR)
set _prefix {}
}]
@@ -1005,7 +1019,7 @@ if {[catch {
} err]} {
load_config 1
apply_config
- choose_repository::pick
+ choose_repository::pick {}
}
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
catch {set _gitdir [exec cygpath --windows $_gitdir]}
@@ -2622,6 +2636,7 @@ blame {
return
}
citool -
+clone -
gui {
if {[llength $argv] != 0} {
puts -nonewline stderr "usage: $argv0"
@@ -2635,7 +2650,7 @@ gui {
# fall through to setup UI for commits
}
default {
- puts stderr "usage: $argv0 \[{blame|browser|citool}\]"
+ puts stderr "usage: $argv0 \[{blame|browser|citool|clone}\]"
exit 1
}
}
diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl
index 3180786..290fbc0 100644
--- a/git-gui/lib/choose_repository.tcl
+++ b/git-gui/lib/choose_repository.tcl
@@ -21,7 +21,7 @@ field clone_type hardlink ; # Type of clone to construct
field readtree_err ; # Error output from read-tree (if any)
field sorted_recent ; # recent repositories (sorted)
-constructor pick {} {
+constructor pick {action} {
global M1T M1B
make_toplevel top w
@@ -195,6 +195,11 @@ constructor pick {} {
bind $top <Visibility> {}
"
wm deiconify $top
+
+ if {$action != ""} {
+ _next $this $action
+ }
+
tkwait variable @done
if {$top eq {.}} {
@@ -447,6 +452,10 @@ proc _new_ok {p} {
## Clone Existing Repository
method _do_clone {} {
+ if {$::clone_url != ""} {
+ set origin_url $::clone_url
+ }
+
$w_next conf \
-state disabled \
-command [cb _do_clone2] \
--
tg: (9800c0d..) t/git-gui/clonecmd (depends on: vanilla/master)
next reply other threads:[~2008-09-30 16:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 16:51 Petr Baudis [this message]
2008-09-30 19:53 ` [PATCH] git-gui: Implement a 'clone' subcommand Shawn O. Pearce
2008-09-30 19:58 ` Shawn O. Pearce
2008-10-03 10:13 ` [PATCH] git-gui: Correctly set up locators in case of preset URL variable Petr Baudis
2008-10-03 10:23 ` H.Merijn Brand
2008-10-03 10:48 ` Petr Baudis
2008-10-10 16:42 ` Shawn O. Pearce
2008-10-03 10:17 ` [PATCH] git-gui: Implement a 'clone' subcommand Petr Baudis
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1222793501-17997-1-git-send-email-pasky@suse.cz \
--to=pasky@suse.cz \
--cc=git@vger.kernel.org \
--cc=petr.baudis@novartis.com \
--cc=spearce@spearce.org \
/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.
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 NNTP newsgroup(s).