{"thread":{"id":"55030","subject":"[PATCH] gitk: add option to perform 'git fetch' command","startedAt":"2021-01-22T15:19:53Z","lastAt":"2021-11-05T07:35:48Z","messageCount":3,"participants":["Vladimir Chigarev via GitGitGadget","Johannes Schindelin","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"414970","messageId":"pull.872.git.git.1611328595003.gitgitgadget@gmail.com","threadId":"55030","inReplyTo":null,"subject":"[PATCH] gitk: add option to perform 'git fetch' command","fromName":"Vladimir Chigarev via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-01-22T15:16:34Z","receivedAt":"2021-01-22T15:19:53Z","isPatch":true,"sender":{"key":"name:Vladimir Chigarev","avatar":null},"body":"From: Vladimir Chigarev <chiga17@mail.ru>\n\nThere wasn't ability to perform 'git fetch' from gitk tool.\nAdd 'Fetch' option to 'File' menu.\nBind it to 'F7' key.\n\nSigned-off-by: Vladimir Chigarev <chiga17@mail.ru>\n---\n    gitk: add option to perform 'git fetch' command\n    \n    There wasn't ability to perform 'git fetch' from gitk tool. Add 'Fetch'\n    option to 'File' menu. Bind it to 'F7' key.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-872%2Fchiga17%2Fgitk-fetch-option-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-872/chiga17/gitk-fetch-option-v1\nPull-Request: https://github.com/git/git/pull/872\n\n gitk-git/gitk | 31 +++++++++++++++++++++++++++++++\n 1 file changed, 31 insertions(+)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 23d9dd1fe0d..1756385886f 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -499,6 +499,34 @@ proc getcommits {selid} {\n     }\n }\n \n+proc fetch {} {\n+    global bgcolor NS fetch_output\n+\n+    set fetch_output {}\n+    if {[catch {exec sh -c \"git fetch -v 2>&1\"} fetch_output]} {\n+    }\n+\n+    set w .about\n+    if {[winfo exists $w]} {\n+\traise $w\n+\treturn\n+    }\n+    ttk_toplevel $w\n+    wm title $w [mc \"Fetch\"]\n+    make_transient $w .\n+    message $w.m -text [mc \" $fetch_output \"] \\\n+\t    -justify left -aspect 600 -border 2 -bg $bgcolor -relief groove\n+    pack $w.m -side top -fill x -padx 2 -pady 2\n+    ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n+    pack $w.ok -side bottom\n+    bind $w <Visibility> \"focus $w.ok\"\n+    bind $w <Key-Escape> \"destroy $w\"\n+    bind $w <Key-Return> \"destroy $w\"\n+    tk::PlaceWindow $w widget .\n+\n+    reloadcommits\n+}\n+\n proc updatecommits {} {\n     global curview vcanopt vorigargs vfilelimit viewinstances\n     global viewactive viewcomplete tclencoding\n@@ -2089,6 +2117,7 @@ proc makewindow {} {\n         mc \"&File\" cascade {\n             {mc \"&Update\" command updatecommits -accelerator F5}\n             {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n+            {mc \"&Fetch\" command fetch -accelerator F7}\n             {mc \"Reread re&ferences\" command rereadrefs}\n             {mc \"&List references\" command showrefs -accelerator F2}\n             {xx \"\" separator}\n@@ -2609,6 +2638,7 @@ proc makewindow {} {\n     bindkey f nextfile\n     bind . <F5> updatecommits\n     bindmodfunctionkey Shift 5 reloadcommits\n+    bind . <F7> fetch\n     bind . <F2> showrefs\n     bindmodfunctionkey Shift 4 {newview 0}\n     bind . <F4> edit_or_newview\n@@ -3125,6 +3155,7 @@ proc keys {} {\n [mc \"<%s-KP->\tDecrease font size\" $M1T]\n [mc \"<%s-minus>\tDecrease font size\" $M1T]\n [mc \"<F5>\t\tUpdate\"]\n+[mc \"<F7>\t\tFetch\"]\n \" \\\n             -justify left -bg $bgcolor -border 2 -relief groove\n     pack $w.m -side top -fill both -padx 2 -pady 2\n\nbase-commit: 72c4083ddf91b489b7b7b812df67ee8842177d98\n-- \ngitgitgadget\n"},{"id":"421159","messageId":"nycvar.QRO.7.76.6.2104072142001.54@tvgsbejvaqbjf.bet","threadId":"55030","inReplyTo":"pull.872.git.git.1611328595003.gitgitgadget@gmail.com","subject":"Re: [PATCH] gitk: add option to perform 'git fetch' command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-04-07T19:43:19Z","receivedAt":"2021-04-07T21:57:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"[Cc:ing Paul, the gitk maintainer]\n\nPaul, this patch has been stuck on the Git mailing list for a few months.\nCould I ask you whether there is a chance that you could review it?\n\nThanks,\nJohannes\n\n\nOn Fri, 22 Jan 2021, Vladimir Chigarev via GitGitGadget wrote:\n\n> From: Vladimir Chigarev <chiga17@mail.ru>\n>\n> There wasn't ability to perform 'git fetch' from gitk tool.\n> Add 'Fetch' option to 'File' menu.\n> Bind it to 'F7' key.\n>\n> Signed-off-by: Vladimir Chigarev <chiga17@mail.ru>\n> ---\n>     gitk: add option to perform 'git fetch' command\n>\n>     There wasn't ability to perform 'git fetch' from gitk tool. Add 'Fetch'\n>     option to 'File' menu. Bind it to 'F7' key.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-872%2Fchiga17%2Fgitk-fetch-option-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-872/chiga17/gitk-fetch-option-v1\n> Pull-Request: https://github.com/git/git/pull/872\n>\n>  gitk-git/gitk | 31 +++++++++++++++++++++++++++++++\n>  1 file changed, 31 insertions(+)\n>\n> diff --git a/gitk-git/gitk b/gitk-git/gitk\n> index 23d9dd1fe0d..1756385886f 100755\n> --- a/gitk-git/gitk\n> +++ b/gitk-git/gitk\n> @@ -499,6 +499,34 @@ proc getcommits {selid} {\n>      }\n>  }\n>\n> +proc fetch {} {\n> +    global bgcolor NS fetch_output\n> +\n> +    set fetch_output {}\n> +    if {[catch {exec sh -c \"git fetch -v 2>&1\"} fetch_output]} {\n> +    }\n> +\n> +    set w .about\n> +    if {[winfo exists $w]} {\n> +\traise $w\n> +\treturn\n> +    }\n> +    ttk_toplevel $w\n> +    wm title $w [mc \"Fetch\"]\n> +    make_transient $w .\n> +    message $w.m -text [mc \" $fetch_output \"] \\\n> +\t    -justify left -aspect 600 -border 2 -bg $bgcolor -relief groove\n> +    pack $w.m -side top -fill x -padx 2 -pady 2\n> +    ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n> +    pack $w.ok -side bottom\n> +    bind $w <Visibility> \"focus $w.ok\"\n> +    bind $w <Key-Escape> \"destroy $w\"\n> +    bind $w <Key-Return> \"destroy $w\"\n> +    tk::PlaceWindow $w widget .\n> +\n> +    reloadcommits\n> +}\n> +\n>  proc updatecommits {} {\n>      global curview vcanopt vorigargs vfilelimit viewinstances\n>      global viewactive viewcomplete tclencoding\n> @@ -2089,6 +2117,7 @@ proc makewindow {} {\n>          mc \"&File\" cascade {\n>              {mc \"&Update\" command updatecommits -accelerator F5}\n>              {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n> +            {mc \"&Fetch\" command fetch -accelerator F7}\n>              {mc \"Reread re&ferences\" command rereadrefs}\n>              {mc \"&List references\" command showrefs -accelerator F2}\n>              {xx \"\" separator}\n> @@ -2609,6 +2638,7 @@ proc makewindow {} {\n>      bindkey f nextfile\n>      bind . <F5> updatecommits\n>      bindmodfunctionkey Shift 5 reloadcommits\n> +    bind . <F7> fetch\n>      bind . <F2> showrefs\n>      bindmodfunctionkey Shift 4 {newview 0}\n>      bind . <F4> edit_or_newview\n> @@ -3125,6 +3155,7 @@ proc keys {} {\n>  [mc \"<%s-KP->\tDecrease font size\" $M1T]\n>  [mc \"<%s-minus>\tDecrease font size\" $M1T]\n>  [mc \"<F5>\t\tUpdate\"]\n> +[mc \"<F7>\t\tFetch\"]\n>  \" \\\n>              -justify left -bg $bgcolor -border 2 -relief groove\n>      pack $w.m -side top -fill both -padx 2 -pady 2\n>\n> base-commit: 72c4083ddf91b489b7b7b812df67ee8842177d98\n> --\n> gitgitgadget\n>\n>\n"},{"id":"440507","messageId":"YYTey3B8Bw7vJo+u@thinks.paulus.ozlabs.org","threadId":"55030","inReplyTo":"CAGyQznWL_X+-2jyfJCOkTGsp5Ucd3aomQ0Rf5W4nSo8sEz9d5Q@mail.gmail.com","subject":"Re: [PATCH] gitk: add option to perform 'git fetch' command","fromName":"Paul Mackerras","fromEmail":"paulus@ozlabs.org","sentAt":"2021-11-05T07:35:39Z","receivedAt":"2021-11-05T07:35:48Z","isPatch":true,"sender":{"key":"paulus@ozlabs.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Wed, Nov 03, 2021 at 01:01:14PM +0300, Vladimir Chigarev wrote:\n> Hello Paul,\n> \n> Just a gentle reminder.\n> May I ask you to review my changes in gitk?\n\nThanks for the reminder.  See comments below.\n\n> > > +proc fetch {} {\n> > > +    global bgcolor NS fetch_output\n> > > +\n> > > +    set fetch_output {}\n> > > +    if {[catch {exec sh -c \"git fetch -v 2>&1\"} fetch_output]} {\n\nThis \"exec\" call is synchronous, meaning that the gitk process won't\ndo anything else until the exec call returns.  Since git fetch is a\nnetwork operation, that could be quite a long time, during which the\nGUI will be unresponsive.  It would be better to use open rather than\nexec, which will return a file descriptor.  You would then use filerun\nto set up a procedure to be called when the file descriptor is\nreadable.  That way you can arrange for the GUI to continue to respond\nwhile the git fetch is happening.\n\nAlso, it may be more useful to do \"git fetch --all\" rather than just\n\"git fetch\", though I'm not going to insist on that.\n\n> > > +    }\n> > > +\n> > > +    set w .about\n\nWhy are you reusing the \"About gitk\" window here?  That doesn't seem\nright.  Don't you mean \"set w .fetch\" or similar?\n\n> > > +    if {[winfo exists $w]} {\n> > > +     raise $w\n> > > +     return\n> > > +    }\n> > > +    ttk_toplevel $w\n> > > +    wm title $w [mc \"Fetch\"]\n> > > +    make_transient $w .\n> > > +    message $w.m -text [mc \" $fetch_output \"] \\\n> > > +         -justify left -aspect 600 -border 2 -bg $bgcolor -relief groove\n\nHow long can the git fetch output be?  If it can be say ten or more\nlines you might need to use a text widget and a scrollbar rather than\na message widget.\n\n> > > +    pack $w.m -side top -fill x -padx 2 -pady 2\n> > > +    ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\"\n> > -default active\n> > > +    pack $w.ok -side bottom\n> > > +    bind $w <Visibility> \"focus $w.ok\"\n> > > +    bind $w <Key-Escape> \"destroy $w\"\n> > > +    bind $w <Key-Return> \"destroy $w\"\n> > > +    tk::PlaceWindow $w widget .\n> > > +\n> > > +    reloadcommits\n> > > +}\n> > > +\n> > >  proc updatecommits {} {\n> > >      global curview vcanopt vorigargs vfilelimit viewinstances\n> > >      global viewactive viewcomplete tclencoding\n> > > @@ -2089,6 +2117,7 @@ proc makewindow {} {\n> > >          mc \"&File\" cascade {\n> > >              {mc \"&Update\" command updatecommits -accelerator F5}\n> > >              {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n> > > +            {mc \"&Fetch\" command fetch -accelerator F7}\n> > >              {mc \"Reread re&ferences\" command rereadrefs}\n> > >              {mc \"&List references\" command showrefs -accelerator F2}\n> > >              {xx \"\" separator}\n> > > @@ -2609,6 +2638,7 @@ proc makewindow {} {\n> > >      bindkey f nextfile\n> > >      bind . <F5> updatecommits\n> > >      bindmodfunctionkey Shift 5 reloadcommits\n> > > +    bind . <F7> fetch\n> > >      bind . <F2> showrefs\n> > >      bindmodfunctionkey Shift 4 {newview 0}\n> > >      bind . <F4> edit_or_newview\n> > > @@ -3125,6 +3155,7 @@ proc keys {} {\n> > >  [mc \"<%s-KP->        Decrease font size\" $M1T]\n> > >  [mc \"<%s-minus>      Decrease font size\" $M1T]\n> > >  [mc \"<F5>            Update\"]\n> > > +[mc \"<F7>            Fetch\"]\n> > >  \" \\\n> > >              -justify left -bg $bgcolor -border 2 -relief groove\n> > >      pack $w.m -side top -fill both -padx 2 -pady 2\n\nPaul.\n"}]}