[PATCH] Fix handling of git-p4 on deleted files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrew Waters <apwaters@xxxxxxxxxxxxxx>
---
 contrib/fast-import/git-p4 |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index c1ea643..04ce7e3 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -706,7 +706,9 @@ class P4Submit(Command):
             submitTemplate = self.prepareLogMessage(template, logMessage)
             if os.environ.has_key("P4DIFF"):
                 del(os.environ["P4DIFF"])
-            diff = p4_read_pipe("diff -du ...")
+            diff = ""
+            for editedFile in editedFiles:
+                diff += p4_read_pipe("diff -du %r" % editedFile)

             newdiff = ""
             for newFile in filesToAdd:
-- 
1.7.2.2


On 22 October 2010 11:20, Thomas Berg <merlin66b@xxxxxxxxx> wrote:
> Hi,
>
> On Mon, Oct 18, 2010 at 5:39 PM, Andrew Waters <apwaters@xxxxxxxxxxxxxx> wrote:
>> When you submit changes containing deleted file the command 'p4 diff
>> -du ...' includes diffs for deleted files. This causes the failure:
>>
>> open for read: <deleted file>: No such file or directory
>> Command failed: p4 diff -du ...
>
> I'm a daily git-p4 user and noticed this problem too: 'git p4 submit'
> fails for commits with deleted files, with recent Perforce verions.
> The problem has been brought up earlier [1], but no patch has actually
> submitted yet.
>
>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
>> index c1ea643..04ce7e3 100755
>> --- a/contrib/fast-import/git-p4
>> +++ b/contrib/fast-import/git-p4
>> @@ -706,7 +706,9 @@ class P4Submit(Command):
>> Â Â Â Â Â Â submitTemplate = self.prepareLogMessage(template, logMessage)
>> Â Â Â Â Â Â if os.environ.has_key("P4DIFF"):
>> Â Â Â Â Â Â Â Â del(os.environ["P4DIFF"])
>> - Â Â Â Â Â Âdiff = p4_read_pipe("diff -du ...")
>> + Â Â Â Â Â Âdiff = ""
>> + Â Â Â Â Â Âfor editedFile in editedFiles:
>> + Â Â Â Â Â Â Â Âdiff += p4_read_pipe("diff -du %r" % editedFile)
>>
>> Â Â Â Â Â Â newdiff = ""
>> Â Â Â Â Â Â for newFile in filesToAdd:
>> --
>
> I just tested your patch, and it does indeed fix the problem. I think
> you need to "sign off" on the patch, other than that I support
> applying it.
>
> Regards,
> Thomas
>
> [1] http://kerneltrap.org/mailarchive/git/2010/5/28/31299
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]