{"thread":{"id":"25278","subject":"[GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","startedAt":"2010-09-28T20:03:45Z","lastAt":"2010-12-13T21:46:14Z","messageCount":8,"participants":["Heiko Voigt","Ævar Arnfjörð Bjarmason","Michele Ballabio","Paul Mackerras","hvoigt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"151953","messageId":"20100928200344.GA12843@book.hvoigt.net","threadId":"25278","inReplyTo":null,"subject":"[GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-09-28T20:03:45Z","receivedAt":"2010-09-28T20:03:45Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful if a user wants to checkout a file from a certain\ncommit. This is equivalent to\n\n  git checkout $commit $file\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n gitk     |   24 ++++++++++++++++++------\n po/de.po |    6 ++++++\n po/es.po |    6 ++++++\n po/fr.po |    6 ++++++\n po/hu.po |    6 ++++++\n po/it.po |    6 ++++++\n po/ja.po |    6 ++++++\n po/ru.po |    6 ++++++\n po/sv.po |    6 ++++++\n 9 files changed, 66 insertions(+), 6 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 45e3380..c582bb5 100755\n--- a/gitk\n+++ b/gitk\n@@ -2497,6 +2497,8 @@ proc makewindow {} {\n \t{mc \"Highlight this only\" command {flist_hl 1}}\n \t{mc \"External diff\" command {external_diff}}\n \t{mc \"Blame parent commit\" command {external_blame 1}}\n+\t{mc \"Checkout from this commit\" command {external_checkout}}\n+\t{mc \"Checkout from parent commit\" command {external_checkout 1}}\n     }\n     $flist_menu configure -tearoff 0\n \n@@ -3533,6 +3535,20 @@ proc make_relative {f} {\n }\n \n proc external_blame {parent_idx {line {}}} {\n+\n+    set cmdline [list git gui blame]\n+    if {$line ne {} && $line > 1} {\n+\tlappend cmdline \"--line=$line\"\n+    }\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc external_checkout {{parent_idx 0}} {\n+    set cmdline [list git checkout]\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc run_command_on_selected_file {cmdline parent_idx} {\n     global flist_menu_file gitdir\n     global nullid nullid2\n     global parentlist selectedline currentid\n@@ -3548,17 +3564,13 @@ proc external_blame {parent_idx {line {}}} {\n \treturn\n     }\n \n-    set cmdline [list git gui blame]\n-    if {$line ne {} && $line > 1} {\n-\tlappend cmdline \"--line=$line\"\n-    }\n     set f [file join [file dirname $gitdir] $flist_menu_file]\n-    # Unfortunately it seems git gui blame doesn't like\n+    # Unfortunately some commands do not like\n     # being given an absolute path...\n     set f [make_relative $f]\n     lappend cmdline $base_commit $f\n     if {[catch {eval exec $cmdline &} err]} {\n-\terror_popup \"[mc \"git gui blame: command failed:\"] $err\"\n+\terror_popup \"[mc \"$cmdline: command failed:\"] $err\"\n     }\n }\n \ndiff --git a/po/de.po b/po/de.po\nindex bd194a3..8cfd299 100644\n--- a/po/de.po\n+++ b/po/de.po\n@@ -1276,3 +1276,9 @@ msgstr \"Falsche Kommandozeilen-Parameter für gitk:\"\n #: gitk:11587\n msgid \"Command line\"\n msgstr \"Kommandozeile\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/es.po b/po/es.po\nindex 0471dd0..a3092e0 100644\n--- a/po/es.po\n+++ b/po/es.po\n@@ -909,3 +909,9 @@ msgstr \"Argumentos incorrectos a Gitk:\"\n #: gitk:10170\n msgid \"Command line\"\n msgstr \"Línea de comandos\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/fr.po b/po/fr.po\nindex 5370ddc..e58cbdd 100644\n--- a/po/fr.po\n+++ b/po/fr.po\n@@ -1252,3 +1252,9 @@ msgstr \"Arguments invalides pour gitk :\"\n #: gitk:11249\n msgid \"Command line\"\n msgstr \"Ligne de commande\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/hu.po b/po/hu.po\nindex 7262b61..9237d2a 100644\n--- a/po/hu.po\n+++ b/po/hu.po\n@@ -1293,3 +1293,9 @@ msgstr \"Parancs sor\"\n #~ msgstr \"\"\n #~ \"Sajnáljuk, de a gitk nem futtatható ezzel a Tcl/Tk verzióval.\\n\"\n #~ \"Gitk futtatásához legalább Tcl/Tk 8.4 szükséges.\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/it.po b/po/it.po\nindex a730d63..6e0b76f 100644\n--- a/po/it.po\n+++ b/po/it.po\n@@ -1274,3 +1274,9 @@ msgstr \"Gitk: argomenti errati:\"\n #: gitk:11587\n msgid \"Command line\"\n msgstr \"Linea di comando\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/ja.po b/po/ja.po\nindex 4f47051..b47faab 100644\n--- a/po/ja.po\n+++ b/po/ja.po\n@@ -1253,3 +1253,9 @@ msgstr \"gitkへの不正な引数:\"\n #: gitk:11316\n msgid \"Command line\"\n msgstr \"コマンド行\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\ndiff --git a/po/ru.po b/po/ru.po\nindex c3d0285..f136ec1 100644\n--- a/po/ru.po\n+++ b/po/ru.po\n@@ -1083,3 +1083,9 @@ msgstr \"Неправильные аргументы для gitk:\"\n msgid \"Command line\"\n msgstr \"Командная строка\"\n \n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\n+\ndiff --git a/po/sv.po b/po/sv.po\nindex 386763a..b079016 100644\n--- a/po/sv.po\n+++ b/po/sv.po\n@@ -1295,3 +1295,9 @@ msgstr \"Kommandorad\"\n \n #~ msgid \"Name\"\n #~ msgstr \"Namn\"\n+\n+msgid \"Checkout from this commit\"\n+msgstr \"\"\n+\n+msgid \"Checkout from parent commit\"\n+msgstr \"\"\n-- \n1.7.2.2.177.geec0d\n"},{"id":"151961","messageId":"AANLkTi=GmR3kV-ChSNybcaw4c=Dwt5G98e31WVuzJcfC@mail.gmail.com","threadId":"25278","inReplyTo":"20100928200344.GA12843@book.hvoigt.net","subject":"Re: [GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-28T21:09:43Z","receivedAt":"2010-09-28T21:09:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Sep 28, 2010 at 20:03, Heiko Voigt <hvoigt@hvoigt.net> wrote:\n> This is useful if a user wants to checkout a file from a certain\n> commit. This is equivalent to\n\nIt looks like the existing msgid/msgstr pairs have line number\ncomments. Why not add that for the new strings? Presumably it might\ninflate the patch a lot though, as old strings get displaced.\n"},{"id":"152064","messageId":"20100929152259.GA13887@book.hvoigt.net","threadId":"25278","inReplyTo":"AANLkTi=GmR3kV-ChSNybcaw4c=Dwt5G98e31WVuzJcfC@mail.gmail.com","subject":"Re: Re: [GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-09-29T15:23:00Z","receivedAt":"2010-09-29T15:23:00Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Tue, Sep 28, 2010 at 09:09:43PM +0000, Ævar Arnfjörð Bjarmason wrote:\n> On Tue, Sep 28, 2010 at 20:03, Heiko Voigt <hvoigt@hvoigt.net> wrote:\n> > This is useful if a user wants to checkout a file from a certain\n> > commit. This is equivalent to\n> \n> It looks like the existing msgid/msgstr pairs have line number\n> comments. Why not add that for the new strings? Presumably it might\n> inflate the patch a lot though, as old strings get displaced.\n\nI was wondering what these numbers were for. Now it makes sense. I am\nnot against doing it but I would need a script to update the existing\nones. Is there something like that? Otherwise I would just add the line\nnumber for the two new msgs.\n\nCheers Heiko\n"},{"id":"152065","messageId":"201009291727.45467.barra_cuda@katamail.com","threadId":"25278","inReplyTo":"20100928200344.GA12843@book.hvoigt.net","subject":"Re: [GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2010-09-29T15:27:44Z","receivedAt":"2010-09-29T15:27:44Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"On Tuesday 28 September 2010, Heiko Voigt wrote:\n>  po/de.po |    6 ++++++\n>  po/es.po |    6 ++++++\n>  po/fr.po |    6 ++++++\n>  po/hu.po |    6 ++++++\n>  po/it.po |    6 ++++++\n>  po/ja.po |    6 ++++++\n>  po/ru.po |    6 ++++++\n>  po/sv.po |    6 ++++++\n\nYou shouldn't change anything under po/ (unless you want to actually translate\nsomething, of course): translators will do it for you. There would be less\nof a chance of a conflicting merge.\n"},{"id":"152067","messageId":"AANLkTinn-_Npv4+wGRkS6Sonf1VRV-cEMtHBEtyQeq8O@mail.gmail.com","threadId":"25278","inReplyTo":"20100929152259.GA13887@book.hvoigt.net","subject":"Re: Re: [GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-29T15:48:03Z","receivedAt":"2010-09-29T15:48:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Wed, Sep 29, 2010 at 15:23, Heiko Voigt <hvoigt@hvoigt.net> wrote:\n> Hi,\n>\n> On Tue, Sep 28, 2010 at 09:09:43PM +0000, Ęvar Arnfjörš Bjarmason wrote:\n>> On Tue, Sep 28, 2010 at 20:03, Heiko Voigt <hvoigt@hvoigt.net> wrote:\n>> > This is useful if a user wants to checkout a file from a certain\n>> > commit. This is equivalent to\n>>\n>> It looks like the existing msgid/msgstr pairs have line number\n>> comments. Why not add that for the new strings? Presumably it might\n>> inflate the patch a lot though, as old strings get displaced.\n>\n> I was wondering what these numbers were for. Now it makes sense. I am\n> not against doing it but I would need a script to update the existing\n> ones. Is there something like that? Otherwise I would just add the line\n> number for the two new msgs.\n\nYou should update PO files with the msgmerge(1) program, the ab/i18n\nbranch has docs on how to do that in po/README.\n\nBut as Michele points out you probably shouldn't update these, some\nprojects do, but it probably makes more sense to leave these updates\nup to translators.\n"},{"id":"152182","messageId":"20100930182949.GA15412@book.hvoigt.net","threadId":"25278","inReplyTo":"AANLkTinn-_Npv4+wGRkS6Sonf1VRV-cEMtHBEtyQeq8O@mail.gmail.com","subject":"[PATCH v2] gitk: add menuitem for file checkout from this or parent commit","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-09-30T18:29:49Z","receivedAt":"2010-09-30T18:29:49Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful if a user wants to checkout a file from a certain\ncommit. This is equivalent to\n\n  git checkout $commit $file\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n\nOn Wed, Sep 29, 2010 at 03:48:03PM +0000, Ævar Arnfjörð Bjarmason wrote:\n> But as Michele points out you probably shouldn't update these, some\n> projects do, but it probably makes more sense to leave these updates\n> up to translators.\n\nHere is an updated version of that patch without the po changes.\n\n gitk |   24 ++++++++++++++++++------\n 1 files changed, 18 insertions(+), 6 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 45e3380..c582bb5 100755\n--- a/gitk\n+++ b/gitk\n@@ -2497,6 +2497,8 @@ proc makewindow {} {\n \t{mc \"Highlight this only\" command {flist_hl 1}}\n \t{mc \"External diff\" command {external_diff}}\n \t{mc \"Blame parent commit\" command {external_blame 1}}\n+\t{mc \"Checkout from this commit\" command {external_checkout}}\n+\t{mc \"Checkout from parent commit\" command {external_checkout 1}}\n     }\n     $flist_menu configure -tearoff 0\n \n@@ -3533,6 +3535,20 @@ proc make_relative {f} {\n }\n \n proc external_blame {parent_idx {line {}}} {\n+\n+    set cmdline [list git gui blame]\n+    if {$line ne {} && $line > 1} {\n+\tlappend cmdline \"--line=$line\"\n+    }\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc external_checkout {{parent_idx 0}} {\n+    set cmdline [list git checkout]\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc run_command_on_selected_file {cmdline parent_idx} {\n     global flist_menu_file gitdir\n     global nullid nullid2\n     global parentlist selectedline currentid\n@@ -3548,17 +3564,13 @@ proc external_blame {parent_idx {line {}}} {\n \treturn\n     }\n \n-    set cmdline [list git gui blame]\n-    if {$line ne {} && $line > 1} {\n-\tlappend cmdline \"--line=$line\"\n-    }\n     set f [file join [file dirname $gitdir] $flist_menu_file]\n-    # Unfortunately it seems git gui blame doesn't like\n+    # Unfortunately some commands do not like\n     # being given an absolute path...\n     set f [make_relative $f]\n     lappend cmdline $base_commit $f\n     if {[catch {eval exec $cmdline &} err]} {\n-\terror_popup \"[mc \"git gui blame: command failed:\"] $err\"\n+\terror_popup \"[mc \"$cmdline: command failed:\"] $err\"\n     }\n }\n \n-- \n1.7.2.2.177.geec0d\n"},{"id":"157871","messageId":"20101211232324.GB3788@brick.ozlabs.ibm.com","threadId":"25278","inReplyTo":"20100928200344.GA12843@book.hvoigt.net","subject":"Re: [GITK PATCH] gitk: add menuitem for file checkout from selected or parent commit","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2010-12-11T23:23:24Z","receivedAt":"2010-12-11T23:23:24Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Tue, Sep 28, 2010 at 10:03:45PM +0200, Heiko Voigt wrote:\n\n> This is useful if a user wants to checkout a file from a certain\n> commit. This is equivalent to\n> \n>   git checkout $commit $file\n> \n> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n\nThanks for the patch.  However, the commit message doesn't mention\nthat the patch also adds the 'checkout from parent' menu item or why\nthat's a useful thing to have.  I like the 'checkout from this commit'\nthing but I don't immediately see why checking out from the first\nparent is so useful that we have to have it as a menu item, but\nchecking out from other parents of a merge isn't.\n\nAlso, don't bother updating the po files.  The translators generally\nprefer it if we don't.\n\nPaul.\n"},{"id":"158003","messageId":"20101213214613.GA2497@sandbox","threadId":"25278","inReplyTo":"20101211232324.GB3788@brick.ozlabs.ibm.com","subject":"[PATCH v3] gitk: add menuitem for file checkout from this or parent commit","fromName":"hvoigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-12-13T21:46:14Z","receivedAt":"2010-12-13T21:46:14Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"This is useful if a user wants to checkout a file from a certain\ncommit. This is equivalent to\n\n  git checkout $commit $file\n\nand\n\n  git checkout $commit^ $file\n\nCheckout of the first parent is useful in situations where you want to\ncheckout a file before some modification. In the patch view only the\nmodified filenames are shown. It is much quicker to select the commit\nwhich modified the file and then choose the file from the patch view\ncompared to select the parent commit and then browse through the whole\ntree to choose the file.\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\nOn Sun, Dec 12, 2010 at 10:23:24AM +1100, Paul Mackerras wrote:\n> Thanks for the patch.  However, the commit message doesn't mention\n> that the patch also adds the 'checkout from parent' menu item or why\n> that's a useful thing to have.  I like the 'checkout from this commit'\n> thing but I don't immediately see why checking out from the first\n> parent is so useful that we have to have it as a menu item, but\n> checking out from other parents of a merge isn't.\n\nHere is a new version of the patch with some added explanation why this\nis useful in day to day use. I choose the first parent because in my\nusecase I checkout single files by typically using non-merge commits.\nDo you think there are usecases for second or other parent commits on\nmerge commits?\n\nCheers Heiko\n\n gitk |   24 ++++++++++++++++++------\n 1 files changed, 18 insertions(+), 6 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex e82c6bf..e0dd94d 100755\n--- a/gitk\n+++ b/gitk\n@@ -2522,6 +2522,8 @@ proc makewindow {} {\n \t{mc \"Highlight this only\" command {flist_hl 1}}\n \t{mc \"External diff\" command {external_diff}}\n \t{mc \"Blame parent commit\" command {external_blame 1}}\n+\t{mc \"Checkout from this commit\" command {external_checkout}}\n+\t{mc \"Checkout from parent commit\" command {external_checkout 1}}\n     }\n     $flist_menu configure -tearoff 0\n \n@@ -3558,6 +3560,20 @@ proc make_relative {f} {\n }\n \n proc external_blame {parent_idx {line {}}} {\n+\n+    set cmdline [list git gui blame]\n+    if {$line ne {} && $line > 1} {\n+\tlappend cmdline \"--line=$line\"\n+    }\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc external_checkout {{parent_idx 0}} {\n+    set cmdline [list git checkout]\n+    run_command_on_selected_file $cmdline $parent_idx\n+}\n+\n+proc run_command_on_selected_file {cmdline parent_idx} {\n     global flist_menu_file gitdir\n     global nullid nullid2\n     global parentlist selectedline currentid\n@@ -3573,17 +3589,13 @@ proc external_blame {parent_idx {line {}}} {\n \treturn\n     }\n \n-    set cmdline [list git gui blame]\n-    if {$line ne {} && $line > 1} {\n-\tlappend cmdline \"--line=$line\"\n-    }\n     set f [file join [file dirname $gitdir] $flist_menu_file]\n-    # Unfortunately it seems git gui blame doesn't like\n+    # Unfortunately some commands do not like\n     # being given an absolute path...\n     set f [make_relative $f]\n     lappend cmdline $base_commit $f\n     if {[catch {eval exec $cmdline &} err]} {\n-\terror_popup \"[mc \"git gui blame: command failed:\"] $err\"\n+\terror_popup \"[mc \"$cmdline: command failed:\"] $err\"\n     }\n }\n \n-- \n1.7.2.3.msysgit.0.1.g5a65e\n"}]}