{"thread":{"id":"15731","subject":"Re: [PATCH] git-gui: Implement a 'clone' subcommand","startedAt":"2008-09-30T16:51:41Z","lastAt":"2008-10-10T16:42:55Z","messageCount":8,"participants":["Shawn O. Pearce","Petr Baudis","H.Merijn Brand"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"299073","messageId":"1222793501-17997-1-git-send-email-pasky@suse.cz","threadId":"15731","inReplyTo":null,"subject":"[PATCH] git-gui: Implement a 'clone' subcommand","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-30T16:51:41Z","receivedAt":"2008-09-30T16:51:41Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This enables git-gui to be started with the clone dialog opened right\naway, possibly with the URL prefilled when it is passed as another\nargument. git-gui can then be e.g. registered as the git:// protocol\nhandler.\n\nThis is just a simple implementation - we construct the front actions\npage, then throw it away immediately; I wanted to avoid unnecessary\nrefactoring and complication of the code, though.\n\nSigned-off-by: Petr Baudis <petr.baudis@novartis.com>\n\n---\n Documentation/git-gui.txt         |    5 +++++\n git-gui/git-gui.sh                |   21 ++++++++++++++++++---\n git-gui/lib/choose_repository.tcl |   11 ++++++++++-\n 3 files changed, 33 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt\nindex 0e650f4..9ce63be 100644\n--- a/Documentation/git-gui.txt\n+++ b/Documentation/git-gui.txt\n@@ -43,6 +43,11 @@ citool::\n \tto only commit actions, slightly reducing the application's\n \tstartup time and simplifying the menubar.\n \n+clone::\n+\tStart the 'git-gui' clone dialog, optionally taking\n+\ta source location as an extra argument to pre-fill\n+\tin the dialog.\n+\n version::\n \tDisplay the currently running version of 'git-gui'.\n \ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 4085e8f..86f0151 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -950,6 +950,8 @@ enable_option multicommit\n enable_option branch\n enable_option transport\n disable_option bare\n+set init_action {}\n+set clone_url {}\n \n switch -- $subcommand {\n browser -\n@@ -960,6 +962,13 @@ blame {\n \tdisable_option branch\n \tdisable_option transport\n }\n+clone {\n+\tset init_action \"clone\"\n+\tif {[llength $argv] > 0} {\n+\t\tset clone_url [lindex $argv 0]\n+\t\tset argv [lrange $argv 1 end]\n+\t}\n+}\n citool {\n \tenable_option singlecommit\n \tenable_option retcode\n@@ -995,7 +1004,12 @@ citool {\n ##\n ## repository setup\n \n-if {[catch {\n+if {$init_action != \"\"} {\n+\tload_config 1\n+\tapply_config\n+\tchoose_repository::pick $init_action\n+\n+} elseif {[catch {\n \t\tset _gitdir $env(GIT_DIR)\n \t\tset _prefix {}\n \t\t}]\n@@ -1005,7 +1019,7 @@ if {[catch {\n \t} err]} {\n \tload_config 1\n \tapply_config\n-\tchoose_repository::pick\n+\tchoose_repository::pick {}\n }\n if {![file isdirectory $_gitdir] && [is_Cygwin]} {\n \tcatch {set _gitdir [exec cygpath --windows $_gitdir]}\n@@ -2622,6 +2636,7 @@ blame {\n \treturn\n }\n citool -\n+clone -\n gui {\n \tif {[llength $argv] != 0} {\n \t\tputs -nonewline stderr \"usage: $argv0\"\n@@ -2635,7 +2650,7 @@ gui {\n \t# fall through to setup UI for commits\n }\n default {\n-\tputs stderr \"usage: $argv0 \\[{blame|browser|citool}\\]\"\n+\tputs stderr \"usage: $argv0 \\[{blame|browser|citool|clone}\\]\"\n \texit 1\n }\n }\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 3180786..290fbc0 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -21,7 +21,7 @@ field clone_type hardlink ; # Type of clone to construct\n field readtree_err        ; # Error output from read-tree (if any)\n field sorted_recent       ; # recent repositories (sorted)\n \n-constructor pick {} {\n+constructor pick {action} {\n \tglobal M1T M1B\n \n \tmake_toplevel top w\n@@ -195,6 +195,11 @@ constructor pick {} {\n \t\tbind $top <Visibility> {}\n \t\"\n \twm deiconify $top\n+\n+\tif {$action != \"\"} {\n+\t\t_next $this $action\n+\t}\n+\n \ttkwait variable @done\n \n \tif {$top eq {.}} {\n@@ -447,6 +452,10 @@ proc _new_ok {p} {\n ## Clone Existing Repository\n \n method _do_clone {} {\n+\tif {$::clone_url != \"\"} {\n+\t\tset origin_url $::clone_url\n+\t}\n+\n \t$w_next conf \\\n \t\t-state disabled \\\n \t\t-command [cb _do_clone2] \\\n-- \ntg: (9800c0d..) t/git-gui/clonecmd (depends on: vanilla/master)\n"},{"id":"91977","messageId":"20080930195330.GA4413@spearce.org","threadId":"15731","inReplyTo":"1222793501-17997-1-git-send-email-pasky@suse.cz","subject":"Re: [PATCH] git-gui: Implement a 'clone' subcommand","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-30T19:53:30Z","receivedAt":"2008-09-30T19:53:30Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Petr Baudis <pasky@suse.cz> wrote:\n> This enables git-gui to be started with the clone dialog opened right\n> away, possibly with the URL prefilled when it is passed as another\n> argument. git-gui can then be e.g. registered as the git:// protocol\n> handler.\n> \n> This is just a simple implementation - we construct the front actions\n> page, then throw it away immediately; I wanted to avoid unnecessary\n> refactoring and complication of the code, though.\n> \n> Signed-off-by: Petr Baudis <petr.baudis@novartis.com>\n> \n> ---\n>  Documentation/git-gui.txt         |    5 +++++\n>  git-gui/git-gui.sh                |   21 ++++++++++++++++++---\n>  git-gui/lib/choose_repository.tcl |   11 ++++++++++-\n>  3 files changed, 33 insertions(+), 4 deletions(-)\n\nThis looks fine, except for the diffstat.  You can't patch\nthe docs and the code in the same patch as they are in two\ndifferent repositories...  :-|\n\nAlso, I don't know if you've noticed but I think tg is\nsending duplicate \"To\" headers in the messages:\n\n\tFrom: Petr Baudis <pasky@suse.cz>\n*\tTo: git@vger.kernel.org\n\tCc: spearce@spearce.org, Petr Baudis <petr.baudis@novartis.com>\n\tSubject: [PATCH] git-gui: Implement a 'clone' subcommand\n\tDate: Tue, 30 Sep 2008 18:51:41 +0200\n\tMessage-Id: <1222793501-17997-1-git-send-email-pasky@suse.cz>\n\tX-Mailer: git-send-email 1.5.6.3.392.g292f1\n*\tTo: git@vger.kernel.org\n\tSender: git-owner@vger.kernel.org\n\tPrecedence: bulk\n\tList-ID: <git.vger.kernel.org>\n\tX-Mailing-List: git@vger.kernel.org\n \n-- \nShawn.\n"},{"id":"91980","messageId":"20080930195839.GK21310@spearce.org","threadId":"15731","inReplyTo":"20080930195330.GA4413@spearce.org","subject":"Re: [PATCH] git-gui: Implement a 'clone' subcommand","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-30T19:58:39Z","receivedAt":"2008-09-30T19:58:39Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> Petr Baudis <pasky@suse.cz> wrote:\n> > This enables git-gui to be started with the clone dialog opened right\n> > away, possibly with the URL prefilled when it is passed as another\n> > argument. git-gui can then be e.g. registered as the git:// protocol\n> > handler.\n> > \n> > This is just a simple implementation - we construct the front actions\n> > page, then throw it away immediately; I wanted to avoid unnecessary\n> > refactoring and complication of the code, though.\n> > \n> > Signed-off-by: Petr Baudis <petr.baudis@novartis.com>\n> > \n> > ---\n> >  Documentation/git-gui.txt         |    5 +++++\n> >  git-gui/git-gui.sh                |   21 ++++++++++++++++++---\n> >  git-gui/lib/choose_repository.tcl |   11 ++++++++++-\n> >  3 files changed, 33 insertions(+), 4 deletions(-)\n> \n> This looks fine [...]\n\nI take that back.  \"git gui clone git://repo.or.cz/alt-git.git\"\ndidn't show the URL in the clone dialog for me.  This is on top\nof your previous series, including the \"locator\" feature, and\nwith two locators configured in my .git/config.\n\n-- \nShawn.\n"},{"id":"299083","messageId":"1223028826-10306-1-git-send-email-pasky@suse.cz","threadId":"15731","inReplyTo":"20080930195839.GK21310@spearce.org","subject":"[PATCH] git-gui: Correctly set up locators in case of preset URL variable","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-10-03T10:13:46Z","receivedAt":"2008-10-03T10:13:46Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch fixes locators setup in case the URL variable is already set,\ne.g. in the clone dialog during 'git gui clone'.\n\nSigned-off-by: Petr Baudis <petr.baudis@novartis.com>\n\n---\n git-gui/lib/transport.tcl |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\nindex 277e6b8..02c4eca 100644\n--- a/git-gui/lib/transport.tcl\n+++ b/git-gui/lib/transport.tcl\n@@ -68,8 +68,13 @@ proc location_input {widget urlvar op} {\n \n \tglobal _locator_template _locator_input _locator_var\n \ttrace remove variable _locator_input write locator_update\n-\tset _locator_template $default_locator\n-\tset _locator_input {}\n+\tif {[set $urlvar] == {}} {\n+\t\tset _locator_template $default_locator\n+\t\tset _locator_input {}\n+\t} else {\n+\t\tset _locator_template \"URL\"\n+\t\tset _locator_input [set $urlvar]\n+\t}\n \tset _locator_var $urlvar\n \ttrace add variable _locator_input write locator_update\n \n-- \ntg: (3c6c738..) t/git-gui/locator-preset (depends on: git-gui/locators t/git-gui/clonecmd)\n"},{"id":"92232","messageId":"20081003101729.GZ10360@machine.or.cz","threadId":"15731","inReplyTo":"20080930195330.GA4413@spearce.org","subject":"Re: [PATCH] git-gui: Implement a 'clone' subcommand","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-10-03T10:17:29Z","receivedAt":"2008-10-03T10:17:29Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Sep 30, 2008 at 12:53:30PM -0700, Shawn O. Pearce wrote:\n> Petr Baudis <pasky@suse.cz> wrote:\n> >  Documentation/git-gui.txt         |    5 +++++\n> >  git-gui/git-gui.sh                |   21 ++++++++++++++++++---\n> >  git-gui/lib/choose_repository.tcl |   11 ++++++++++-\n> >  3 files changed, 33 insertions(+), 4 deletions(-)\n> \n> This looks fine, except for the diffstat.  You can't patch\n> the docs and the code in the same patch as they are in two\n> different repositories...  :-|\n\nOh, I forgot again, sorry. :-( But I think this shows rather bad design\nof the layout, doesn't it? Shouldn't this documentation be kept in\ngit-gui/Documentation/{git-gui,config}.txt and included from git's\nDocumentation/?\n\n> Also, I don't know if you've noticed but I think tg is\n> sending duplicate \"To\" headers in the messages:\n\nThanks - I have noticed already but I didn't have time yet to fix it and\nit seems generally pretty harmless. I will try to do something with that\nlater.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nPeople who take cold baths never have rheumatism, but they have\ncold baths.\n"},{"id":"92234","messageId":"20081003122329.432c6359@pc09.procura.nl","threadId":"15731","inReplyTo":"1223028826-10306-1-git-send-email-pasky@suse.cz","subject":"Re: [PATCH] git-gui: Correctly set up locators in case of preset URL variable","fromName":"H.Merijn Brand","fromEmail":"h.m.brand@xs4all.nl","sentAt":"2008-10-03T10:23:29Z","receivedAt":"2008-10-03T10:23:29Z","isPatch":true,"sender":{"key":"h.m.brand@xs4all.nl","avatar":"https://gravatar.com/avatar/5b8f83ee35c427a646cbea3b104346e00ab3663b99bbf435cddeb75cd4b3857b?d=mp&s=160"},"body":"On Fri,  3 Oct 2008 12:13:46 +0200, Petr Baudis <pasky@suse.cz> wrote:\n\n> This patch fixes locators setup in case the URL variable is already set,\n> e.g. in the clone dialog during 'git gui clone'.\n\nWhile you are working on git-gui's transport.tcl, would you consider a\nuser setting to set the default for pushing tags to remote repositories?\n\nAfter installation/update I always `fix' that by hand now.\n\n> Signed-off-by: Petr Baudis <petr.baudis@novartis.com>\n> \n> ---\n>  git-gui/lib/transport.tcl |    9 +++++++--\n>  1 files changed, 7 insertions(+), 2 deletions(-)\n> \n> diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\n> index 277e6b8..02c4eca 100644\n> --- a/git-gui/lib/transport.tcl\n> +++ b/git-gui/lib/transport.tcl\n> @@ -68,8 +68,13 @@ proc location_input {widget urlvar op} {\n>  \n>  \tglobal _locator_template _locator_input _locator_var\n>  \ttrace remove variable _locator_input write locator_update\n> -\tset _locator_template $default_locator\n> -\tset _locator_input {}\n> +\tif {[set $urlvar] == {}} {\n> +\t\tset _locator_template $default_locator\n> +\t\tset _locator_input {}\n> +\t} else {\n> +\t\tset _locator_template \"URL\"\n> +\t\tset _locator_input [set $urlvar]\n> +\t}\n>  \tset _locator_var $urlvar\n>  \ttrace add variable _locator_input write locator_update\n\n-- \nH.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/\nusing & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,\n11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.\nhttp://mirrors.develooper.com/hpux/           http://www.test-smoke.org/\nhttp://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/\n"},{"id":"92235","messageId":"20081003104829.GA10360@machine.or.cz","threadId":"15731","inReplyTo":"20081003122329.432c6359@pc09.procura.nl","subject":"Re: [PATCH] git-gui: Correctly set up locators in case of preset URL variable","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-10-03T10:48:29Z","receivedAt":"2008-10-03T10:48:29Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Fri, Oct 03, 2008 at 12:23:29PM +0200, H.Merijn Brand wrote:\n> On Fri,  3 Oct 2008 12:13:46 +0200, Petr Baudis <pasky@suse.cz> wrote:\n> \n> > This patch fixes locators setup in case the URL variable is already set,\n> > e.g. in the clone dialog during 'git gui clone'.\n> \n> While you are working on git-gui's transport.tcl, would you consider a\n> user setting to set the default for pushing tags to remote repositories?\n> \n> After installation/update I always `fix' that by hand now.\n\nActually, I think for the time being I'm finished with transport.tcl,\nI'm sorry. :-) I probably won't work further on git-gui now that my\nNovartis stay is almost over. My last stab will be probably trying to\nchange locators support to use insteadOf and possibly configurability of\nthe publish dialog if people decide they want it.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nPeople who take cold baths never have rheumatism, but they have\ncold baths.\n"},{"id":"92767","messageId":"20081010164255.GD29829@spearce.org","threadId":"15731","inReplyTo":"1223028826-10306-1-git-send-email-pasky@suse.cz","subject":"Re: [PATCH] git-gui: Correctly set up locators in case of preset URL variable","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-10T16:42:55Z","receivedAt":"2008-10-10T16:42:55Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Petr Baudis <pasky@suse.cz> wrote:\n> This patch fixes locators setup in case the URL variable is already set,\n> e.g. in the clone dialog during 'git gui clone'.\n\nHuh.  Better, but Remote->Push... still crashes with your series:\n\ncan't read \"push_url\": no such variable\ncan't read \"push_url\": no such variable\n    while executing\n\"set $urlvar\"\n    (procedure \"location_input\" line 26)\n    invoked from within\n\"location_input $w.dest.url_t push_url push\"\n    (procedure \"do_push_anywhere\" line 53)\n    invoked from within\n\"do_push_anywhere\"\n    invoked from within\n\".#mbar.#mbar#remote invoke active\"\n    (\"uplevel\" body line 1)\n    invoked from within\n\"uplevel #0 [list $w invoke active]\"\n    (procedure \"tk::MenuInvoke\" line 50)\n    invoked from within\n\"tk::MenuInvoke .#mbar.#mbar#remote 1\"\n    (command bound to event)\n\n \n> diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl\n> index 277e6b8..02c4eca 100644\n> --- a/git-gui/lib/transport.tcl\n> +++ b/git-gui/lib/transport.tcl\n> @@ -68,8 +68,13 @@ proc location_input {widget urlvar op} {\n>  \n>  \tglobal _locator_template _locator_input _locator_var\n>  \ttrace remove variable _locator_input write locator_update\n> -\tset _locator_template $default_locator\n> -\tset _locator_input {}\n> +\tif {[set $urlvar] == {}} {\n> +\t\tset _locator_template $default_locator\n> +\t\tset _locator_input {}\n> +\t} else {\n> +\t\tset _locator_template \"URL\"\n> +\t\tset _locator_input [set $urlvar]\n> +\t}\n>  \tset _locator_var $urlvar\n>  \ttrace add variable _locator_input write locator_update\n>  \n> -- \n> tg: (3c6c738..) t/git-gui/locator-preset (depends on: git-gui/locators t/git-gui/clonecmd)\n\n-- \nShawn.\n"}]}