{"thread":{"id":"25470","subject":"[PATCH] Fix handling of git-p4 on deleted files","startedAt":"2010-10-18T15:39:52Z","lastAt":"2010-10-22T18:52:34Z","messageCount":4,"participants":["Andrew Waters","Thomas Berg","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"153719","messageId":"AANLkTimzN9ZGwQZ-pi6SMWGY9KS0fjmXu=1gjdfck=W-@mail.gmail.com","threadId":"25470","inReplyTo":null,"subject":"[PATCH] Fix handling of git-p4 on deleted files","fromName":"Andrew Waters","fromEmail":"apwaters@googlemail.com","sentAt":"2010-10-18T15:39:52Z","receivedAt":"2010-10-18T15:39:52Z","isPatch":true,"sender":{"key":"apwaters@googlemail.com","avatar":null},"body":"When you submit changes containing deleted file the command 'p4 diff\n-du ...' includes diffs for deleted files. This causes the failure:\n\nopen for read: <deleted file>: No such file or directory\nCommand failed: p4 diff -du ...\n\nThe problem is that perforce has been told to delete the file and then\nwe try to apply diffs to a file which no longer exists.\n\n---\n contrib/fast-import/git-p4 |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex c1ea643..04ce7e3 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -706,7 +706,9 @@ 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 = \"\"\n+            for editedFile in editedFiles:\n+                diff += p4_read_pipe(\"diff -du %r\" % editedFile)\n\n             newdiff = \"\"\n             for newFile in filesToAdd:\n-- \n1.7.2.2\n"},{"id":"154131","messageId":"AANLkTimHHbg1zVX+1L7Dwgj5VmMFdUZ5X_Vf6UK_26An@mail.gmail.com","threadId":"25470","inReplyTo":"AANLkTimzN9ZGwQZ-pi6SMWGY9KS0fjmXu=1gjdfck=W-@mail.gmail.com","subject":"Re: [PATCH] Fix handling of git-p4 on deleted files","fromName":"Thomas Berg","fromEmail":"merlin66b@gmail.com","sentAt":"2010-10-22T10:20:46Z","receivedAt":"2010-10-22T10:20:46Z","isPatch":true,"sender":{"key":"merlin66b@gmail.com","avatar":null},"body":"Hi,\n\nOn Mon, Oct 18, 2010 at 5:39 PM, Andrew Waters <apwaters@googlemail.com> wrote:\n> When you submit changes containing deleted file the command 'p4 diff\n> -du ...' includes diffs for deleted files. This causes the failure:\n>\n> open for read: <deleted file>: No such file or directory\n> Command failed: p4 diff -du ...\n\nI'm a daily git-p4 user and noticed this problem too: 'git p4 submit'\nfails for commits with deleted files, with recent Perforce verions.\nThe problem has been brought up earlier [1], but no patch has actually\nsubmitted yet.\n\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index c1ea643..04ce7e3 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -706,7 +706,9 @@ 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 = \"\"\n> +            for editedFile in editedFiles:\n> +                diff += p4_read_pipe(\"diff -du %r\" % editedFile)\n>\n>             newdiff = \"\"\n>             for newFile in filesToAdd:\n> --\n\nI just tested your patch, and it does indeed fix the problem. I think\nyou need to \"sign off\" on the patch, other than that I support\napplying it.\n\nRegards,\nThomas\n\n[1] http://kerneltrap.org/mailarchive/git/2010/5/28/31299\n"},{"id":"154142","messageId":"AANLkTikOXp7Tz3F0Of7Ua2N39Z1S22WKh0K_zJFLGa2K@mail.gmail.com","threadId":"25470","inReplyTo":"AANLkTimHHbg1zVX+1L7Dwgj5VmMFdUZ5X_Vf6UK_26An@mail.gmail.com","subject":"[PATCH] Fix handling of git-p4 on deleted files","fromName":"Andrew Waters","fromEmail":"apwaters@googlemail.com","sentAt":"2010-10-22T12:26:02Z","receivedAt":"2010-10-22T12:26:02Z","isPatch":true,"sender":{"key":"apwaters@googlemail.com","avatar":null},"body":"Signed-off-by: Andrew Waters <apwaters@googlemail.com>\n---\n contrib/fast-import/git-p4 |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex c1ea643..04ce7e3 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -706,7 +706,9 @@ 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 = \"\"\n+            for editedFile in editedFiles:\n+                diff += p4_read_pipe(\"diff -du %r\" % editedFile)\n\n             newdiff = \"\"\n             for newFile in filesToAdd:\n-- \n1.7.2.2\n\n\nOn 22 October 2010 11:20, Thomas Berg <merlin66b@gmail.com> wrote:\n> Hi,\n>\n> On Mon, Oct 18, 2010 at 5:39 PM, Andrew Waters <apwaters@googlemail.com> wrote:\n>> When you submit changes containing deleted file the command 'p4 diff\n>> -du ...' includes diffs for deleted files. This causes the failure:\n>>\n>> open for read: <deleted file>: No such file or directory\n>> Command failed: p4 diff -du ...\n>\n> I'm a daily git-p4 user and noticed this problem too: 'git p4 submit'\n> fails for commits with deleted files, with recent Perforce verions.\n> The problem has been brought up earlier [1], but no patch has actually\n> submitted yet.\n>\n>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n>> index c1ea643..04ce7e3 100755\n>> --- a/contrib/fast-import/git-p4\n>> +++ b/contrib/fast-import/git-p4\n>> @@ -706,7 +706,9 @@ 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 = \"\"\n>> +            for editedFile in editedFiles:\n>> +                diff += p4_read_pipe(\"diff -du %r\" % editedFile)\n>>\n>>             newdiff = \"\"\n>>             for newFile in filesToAdd:\n>> --\n>\n> I just tested your patch, and it does indeed fix the problem. I think\n> you need to \"sign off\" on the patch, other than that I support\n> applying it.\n>\n> Regards,\n> Thomas\n>\n> [1] http://kerneltrap.org/mailarchive/git/2010/5/28/31299\n>\n"},{"id":"154188","messageId":"7vpqv2kqkt.fsf@alter.siamese.dyndns.org","threadId":"25470","inReplyTo":"AANLkTikOXp7Tz3F0Of7Ua2N39Z1S22WKh0K_zJFLGa2K@mail.gmail.com","subject":"Re: [PATCH] Fix handling of git-p4 on deleted files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-22T18:52:34Z","receivedAt":"2010-10-22T18:52:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Waters <apwaters@googlemail.com> writes:\n\n> On 22 October 2010 11:20, Thomas Berg <merlin66b@gmail.com> wrote:\n>> Hi,\n>>\n>> On Mon, Oct 18, 2010 at 5:39 PM, Andrew Waters <apwaters@googlemail.com> wrote:\n>>> When you submit changes containing deleted file the command 'p4 diff\n>>> -du ...' includes diffs for deleted files. This causes the failure:\n>>>\n>>> open for read: <deleted file>: No such file or directory\n>>> Command failed: p4 diff -du ...\n>>\n>> I'm a daily git-p4 user and noticed this problem too: 'git p4 submit'\n>> fails for commits with deleted files, with recent Perforce verions.\n>> The problem has been brought up earlier [1], but no patch has actually\n>> submitted yet.\n\nThanks for a resend.  Will queue.\n\n> Signed-off-by: Andrew Waters <apwaters@googlemail.com>\n> ---\n>  contrib/fast-import/git-p4 |    4 +++-\n>  1 files changed, 3 insertions(+), 1 deletions(-)\n>\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index c1ea643..04ce7e3 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -706,7 +706,9 @@ 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 = \"\"\n> +            for editedFile in editedFiles:\n> +                diff += p4_read_pipe(\"diff -du %r\" % editedFile)\n>\n>              newdiff = \"\"\n>              for newFile in filesToAdd:\n> -- \n> 1.7.2.2\n"}]}