{"thread":{"id":"23927","subject":"git-p4 move/delete errors","startedAt":"2010-05-28T00:30:04Z","lastAt":"2010-07-13T11:22:40Z","messageCount":7,"participants":["Lance Linder","Thomas Berg","Tor Arvid Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142477","messageId":"AANLkTinN0Av1CO7mZU-QKeApq43UmEykUV093eyTtKQN@mail.gmail.com","threadId":"23927","inReplyTo":null,"subject":"git-p4 move/delete errors","fromName":"Lance Linder","fromEmail":"llinder@gmail.com","sentAt":"2010-05-28T00:30:04Z","receivedAt":"2010-05-28T00:30:04Z","isPatch":false,"sender":{"key":"llinder@gmail.com","avatar":"https://gravatar.com/avatar/be109b72f1efa854c4c6832d5c6db1a38946d103be3a4a9c1689c993279ea395?d=mp&s=160"},"body":"Hello,\n\nUntil recently I have been successfully using git-p4 with much joy and\nhappiness. Then suddenly git-p4 submit started throwing \"Command\nfailed: p4 diff -du ...\" when ever I delete or move a file.\n\nWe recently upgraded our perforce server ( Rev.\nP4D/NTX86/2009.2/238357 (2010/03/15) ). It was about this time that\nthe problem came up. First thing I did of course was upgrade to the\nlatest version of git ( now on 1.7.1 ) but the problem still persists.\nNext I updated my p4 client ( Rev. P4/MACOSX104U/2009.2/238357\n(2010/03/15) ) but still same problem. All other submits work fine as\nlong as there are not any deletions or moves.\n\nHere is the exact output from git-p4 submit:\n\ngit p4 submit\nPerforce checkout for depot path //depo/\nSynchronizing p4 checkout...\n... - file(s) up-to-date.\nApplying c287e823b3da49dcaf3463a5153d73ac493ad48e test\n\ntmp2.txt - file(s) not opened on this client.\n//depo/tmp2.txt#3 - opened for delete\nopen for read: /depo/tmp2.txt: No such file or directory\nCommand failed: p4 diff -du ...\n\nAnyone else seeing these issues?\n\nThanks,\nLance\n"},{"id":"145225","messageId":"AANLkTikPHJuf5JUe096BWTWO_oF9u3gNlVNuw7Ik32WQ@mail.gmail.com","threadId":"23927","inReplyTo":"AANLkTinN0Av1CO7mZU-QKeApq43UmEykUV093eyTtKQN@mail.gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2010-07-09T15:05:26Z","receivedAt":"2010-07-09T15:05:26Z","isPatch":false,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"Hi,\n\nOn Fri, May 28, 2010 at 2:30 AM, Lance Linder <llinder@gmail.com> wrote:\n> Until recently I have been successfully using git-p4 with much joy and\n> happiness. Then suddenly git-p4 submit started throwing \"Command\n> failed: p4 diff -du ...\" when ever I delete or move a file.\n>\n> We recently upgraded our perforce server ( Rev.\n> P4D/NTX86/2009.2/238357 (2010/03/15) ). It was about this time that\n> the problem came up. First thing I did of course was upgrade to the\n> latest version of git ( now on 1.7.1 ) but the problem still persists.\n> Next I updated my p4 client ( Rev. P4/MACOSX104U/2009.2/238357\n> (2010/03/15) ) but still same problem. All other submits work fine as\n> long as there are not any deletions or moves.\n[...]\n>\n> Anyone else seeing these issues?\n\n\nIndeed, we just upgraded our Perforce server too, and now I'm getting\nthis exact error. Did you find a solution to the problem?\n\nIf not I'm very interested in solving it. Seems like the p4 diff\ncommand has changed behaviour and broken the git-p4 script.\n\nCheers,\nThomas\n"},{"id":"145231","messageId":"4843A2FF-CA22-4C85-8731-5AB72B2DD601@gmail.com","threadId":"23927","inReplyTo":"AANLkTikPHJuf5JUe096BWTWO_oF9u3gNlVNuw7Ik32WQ@mail.gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Lance Linder","fromEmail":"llinder@gmail.com","sentAt":"2010-07-09T17:06:13Z","receivedAt":"2010-07-09T17:06:13Z","isPatch":false,"sender":{"key":"llinder@gmail.com","avatar":"https://gravatar.com/avatar/be109b72f1efa854c4c6832d5c6db1a38946d103be3a4a9c1689c993279ea395?d=mp&s=160"},"body":"I spent some time trying to debug this problem but couldn't resolve it myself. It is a huge pain and if I happen to find a fix I will definitely post an update but right now I have given up.\n\nHopefully someone smarter than myself finds a way to fix this because it is a nightmare to delete/rename files with git and submit back to perforce.\n\nLance\n\n\nOn Jul 9, 2010, at 10:05 AM, Thomas Berg wrote:\n\n> Hi,\n> \n> On Fri, May 28, 2010 at 2:30 AM, Lance Linder <llinder@gmail.com> wrote:\n>> Until recently I have been successfully using git-p4 with much joy and\n>> happiness. Then suddenly git-p4 submit started throwing \"Command\n>> failed: p4 diff -du ...\" when ever I delete or move a file.\n>> \n>> We recently upgraded our perforce server ( Rev.\n>> P4D/NTX86/2009.2/238357 (2010/03/15) ). It was about this time that\n>> the problem came up. First thing I did of course was upgrade to the\n>> latest version of git ( now on 1.7.1 ) but the problem still persists.\n>> Next I updated my p4 client ( Rev. P4/MACOSX104U/2009.2/238357\n>> (2010/03/15) ) but still same problem. All other submits work fine as\n>> long as there are not any deletions or moves.\n> [...]\n>> \n>> Anyone else seeing these issues?\n> \n> \n> Indeed, we just upgraded our Perforce server too, and now I'm getting\n> this exact error. Did you find a solution to the problem?\n> \n> If not I'm very interested in solving it. Seems like the p4 diff\n> command has changed behaviour and broken the git-p4 script.\n> \n> Cheers,\n> Thomas\n"},{"id":"145236","messageId":"AANLkTin7eMFXT1FwZ2ojcAYgqIMSYnkz-uCoRlHvV6Tm@mail.gmail.com","threadId":"23927","inReplyTo":"AANLkTikPHJuf5JUe096BWTWO_oF9u3gNlVNuw7Ik32WQ@mail.gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2010-07-09T20:21:05Z","receivedAt":"2010-07-09T20:21:05Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Fri, Jul 9, 2010 at 5:05 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n> Hi,\n>\n> On Fri, May 28, 2010 at 2:30 AM, Lance Linder <llinder@gmail.com> wrote:\n>> Until recently I have been successfully using git-p4 with much joy and\n>> happiness. Then suddenly git-p4 submit started throwing \"Command\n>> failed: p4 diff -du ...\" when ever I delete or move a file.\n>>\n>> We recently upgraded our perforce server ( Rev.\n>> P4D/NTX86/2009.2/238357 (2010/03/15) ). It was about this time that\n>> the problem came up. First thing I did of course was upgrade to the\n>> latest version of git ( now on 1.7.1 ) but the problem still persists.\n>> Next I updated my p4 client ( Rev. P4/MACOSX104U/2009.2/238357\n>> (2010/03/15) ) but still same problem. All other submits work fine as\n>> long as there are not any deletions or moves.\n> [...]\n>>\n>> Anyone else seeing these issues?\n\nHi. Are any of you using Perforce's \"keyword expansion\" stuff? I mean\nthe thing where you put a:\n\n$Id$\n\nkeyword in a file, and it expands to something like:\n\n$Id: //depot/test/main.c#10 $\n\nIf I do that (and, unfortunately, people at my $dayjob do do that),\nI'm almost sure that this is the error I got... The reason seems to be\nthat when git imports the file from P4, the keyword expansions get\nstripped off (as in: reset to just $Id$). And then the p4 diff fails\nif the $Id$ type lines are included in the diff. When deleting a file,\nall lines are included in the diff...\n\nIt hasn't itched me hard enough that I have tried hard to solve it\n(unfortunately). I simply do deletes from P4 instead of git-p4 :-/\n\n-Tor Arvid-\n\n> Indeed, we just upgraded our Perforce server too, and now I'm getting\n> this exact error. Did you find a solution to the problem?\n>\n> If not I'm very interested in solving it. Seems like the p4 diff\n> command has changed behaviour and broken the git-p4 script.\n>\n> Cheers,\n> Thomas\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"145239","messageId":"F94DAB9A-A06D-46ED-9AAA-EDE850365054@gmail.com","threadId":"23927","inReplyTo":"AANLkTin7eMFXT1FwZ2ojcAYgqIMSYnkz-uCoRlHvV6Tm@mail.gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Lance Linder","fromEmail":"llinder@gmail.com","sentAt":"2010-07-09T21:20:21Z","receivedAt":"2010-07-09T21:20:21Z","isPatch":false,"sender":{"key":"llinder@gmail.com","avatar":"https://gravatar.com/avatar/be109b72f1efa854c4c6832d5c6db1a38946d103be3a4a9c1689c993279ea395?d=mp&s=160"},"body":"Thanks for the tip about keyword expansion. Fortunately for me we don't use those.\n\nWhen I was trying to debug this the problem seemed to be that the original file is removed from the local Perforce workspace before the p4 diff command is issued. I am not sure how the server upgrade caused this behavior but it was the only thing that changed when I first started seeing the error.\n\nLance\n\nOn Jul 9, 2010, at 3:21 PM, Tor Arvid Lund wrote:\n\n> On Fri, Jul 9, 2010 at 5:05 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n>> Hi,\n>> \n>> On Fri, May 28, 2010 at 2:30 AM, Lance Linder <llinder@gmail.com> wrote:\n>>> Until recently I have been successfully using git-p4 with much joy and\n>>> happiness. Then suddenly git-p4 submit started throwing \"Command\n>>> failed: p4 diff -du ...\" when ever I delete or move a file.\n>>> \n>>> We recently upgraded our perforce server ( Rev.\n>>> P4D/NTX86/2009.2/238357 (2010/03/15) ). It was about this time that\n>>> the problem came up. First thing I did of course was upgrade to the\n>>> latest version of git ( now on 1.7.1 ) but the problem still persists.\n>>> Next I updated my p4 client ( Rev. P4/MACOSX104U/2009.2/238357\n>>> (2010/03/15) ) but still same problem. All other submits work fine as\n>>> long as there are not any deletions or moves.\n>> [...]\n>>> \n>>> Anyone else seeing these issues?\n> \n> Hi. Are any of you using Perforce's \"keyword expansion\" stuff? I mean\n> the thing where you put a:\n> \n> $Id$\n> \n> keyword in a file, and it expands to something like:\n> \n> $Id: //depot/test/main.c#10 $\n> \n> If I do that (and, unfortunately, people at my $dayjob do do that),\n> I'm almost sure that this is the error I got... The reason seems to be\n> that when git imports the file from P4, the keyword expansions get\n> stripped off (as in: reset to just $Id$). And then the p4 diff fails\n> if the $Id$ type lines are included in the diff. When deleting a file,\n> all lines are included in the diff...\n> \n> It hasn't itched me hard enough that I have tried hard to solve it\n> (unfortunately). I simply do deletes from P4 instead of git-p4 :-/\n> \n> -Tor Arvid-\n> \n>> Indeed, we just upgraded our Perforce server too, and now I'm getting\n>> this exact error. Did you find a solution to the problem?\n>> \n>> If not I'm very interested in solving it. Seems like the p4 diff\n>> command has changed behaviour and broken the git-p4 script.\n>> \n>> Cheers,\n>> Thomas\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>> \n"},{"id":"145242","messageId":"AANLkTilQtnIzNCcRzYzSqPEvXenHgND-_SAWmUeM64BH@mail.gmail.com","threadId":"23927","inReplyTo":"F94DAB9A-A06D-46ED-9AAA-EDE850365054@gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2010-07-09T21:32:46Z","receivedAt":"2010-07-09T21:32:46Z","isPatch":false,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"On Fri, Jul 9, 2010 at 11:20 PM, Lance Linder <llinder@gmail.com> wrote:\n> Thanks for the tip about keyword expansion. Fortunately for me we don't use those.\n\nWe don't either.\n\n> When I was trying to debug this the problem seemed to be that the original file is removed from the local Perforce workspace before the p4 diff command is issued. I am not sure how the server upgrade caused this behavior but it was the only thing that changed when I first started seeing the error.\n\nHasn't Perforce always deleted files immediately when they are marked\nfor deletion?\n\nAnyway, as far as I can see from the git-p4 source code, the command\nis only used to generate the diff preview in the interactive window\nthat pops up when you \"git p4 submit\". So if you replace the line\ndiff = p4_read_pipe(\"diff -du ...\")\nwith\ndiff = \"\"\n\nit should start working again (the diff preview part will become\nempty). I'm unable to test it right now, but fairly sure it will work.\nI'll see if I can find a better solution when I have access to the\nPerforce server again.\n\nThomas\n"},{"id":"145444","messageId":"AANLkTimWeZq3yPo01Ytj-rfP5tY8k100kDHJX_eWRwUq@mail.gmail.com","threadId":"23927","inReplyTo":"AANLkTilQtnIzNCcRzYzSqPEvXenHgND-_SAWmUeM64BH@mail.gmail.com","subject":"Re: git-p4 move/delete errors","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2010-07-13T11:22:40Z","receivedAt":"2010-07-13T11:22:40Z","isPatch":false,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"On Fri, Jul 9, 2010 at 11:32 PM, Thomas Berg <merlin66b@gmail.com> wrote:\n\n> Anyway, as far as I can see from the git-p4 source code, the command\n> is only used to generate the diff preview in the interactive window\n> that pops up when you \"git p4 submit\". So if you replace the line\n> diff = p4_read_pipe(\"diff -du ...\")\n> with\n> diff = \"\"\n>\n> it should start working again (the diff preview part will become\n> empty). I'm unable to test it right now, but fairly sure it will work.\n> I'll see if I can find a better solution when I have access to the\n> Perforce server again.\n\nIt seems like they have done some bugfixes to \"p4 diff -du ...\", I\nguess that's why we get different behaviour now. It prints the correct\noutput, but exits with an error code anyway when files have been\nremoved.\n\nMy solution is in the diff below. I'll run with it for a few days,\nthen I'll submit a proper patch to the mailing list (unless someone\nelse beat me to it).\n\nThomas\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex c1ea643..19f4519 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -706,7 +706,7 @@ class P4Submit(Command):\n             submitTemplate = self.prepareLogMessage(template, logMessage)\n             if os.environ.has_key(\"P4DIFF\"):\n                 del(os.environ[\"P4DIFF\"])\n-            diff = p4_read_pipe(\"diff -du ...\")\n+            diff = p4_read_pipe(\"diff -du ...\", ignore_error=True)\n\n             newdiff = \"\"\n             for newFile in filesToAdd:\n"}]}