php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60526 Defect "Download unified diff as a patch"
Submitted: 2011-12-15 00:45 UTC Modified: 2012-02-13 11:06 UTC
From: jakoch at web dot de Assigned: yannick (profile)
Status: Closed Package: Online Doc Editor problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jakoch at web dot de
New email:
PHP Version: OS:

 

 [2011-12-15 00:45 UTC] jakoch at web dot de
Description:
------------
Steps to reproduce the problem
1) you need translated files in the section "Patches for review"
2) open "Patches for review (2)"
3) right-click Menu -> "Download unified diff as a patch"
Result: the downloaded file is empty





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-17 14:34 UTC] yannick@php.net
Automatic comment from SVN on behalf of yannick
Revision: http://svn.php.net/viewvc/?view=revision&revision=321090
Log: Fix bug #60526 & #60527 : unified diff download work again
 [2011-12-17 14:34 UTC] yannick@php.net
This bug has been fixed in SVN, and should show up online in an
hour or three.

Thank you for the report, and for helping us make PHP.net better.


 [2011-12-17 14:34 UTC] yannick@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: yannick
 [2011-12-17 20:19 UTC] jakoch at web dot de
Thanks for fixing this, Yannick!

When will the changes take effect?
I've tested the Editor minutes ago and the bug(s) is still there..
guess, pushing the svn version to live takes a while...

Regards, Jens
 [2011-12-17 20:35 UTC] yannick dot torres at gmail dot com
Hi,

Svn is actually uptodate.

Could you point me the patch who the downloaded diff is empty ?

Best,
Yannick
 [2011-12-17 20:36 UTC] yannick@php.net
-Status: Closed +Status: Re-Opened
 [2011-12-18 14:34 UTC] jakoch at web dot de
Yes.
Please go to section "Patches for review".
Look for my name "Jens-André Koch".
You will find a patch called "de/install/fpm".
It's the translation from "en" to "de".
Right-click on the item, then "View unified diff".
New windows opens, presenting a link to
"http://edit.php.net/?patchID=584&project=PHP".
If one clicks this, editor will reload.
So please open the link in new tab to stay in the editor.
 [2011-12-19 09:30 UTC] yannick@php.net
Your patch contains only new files (translated from scratch).
So, the diff isn't revelante here as we can't compare your file with an other.

For me, actually, this action don't reload the editor. It will just download an 
empty patch, as expected for this "new" translated file.

The only solution here according to me is to detect the type of files into the 
patch, and don't display the "view unified diff" & the download patch link when 
there is only new translated file.
 [2011-12-20 00:58 UTC] jakoch at web dot de
Hmm, thought about that... well, i think it's relevant to be able to download patches, which add new files.

Your solution to this problem might be a workaround, but is not a correct solution to the problem. It's not a matter of comparing two files, it's a matter of comparing svn states.

Files added newly to a Subversion Repository are svn diffable. Such a patch file is not empty(!), but would look like: 
"--- file (revision 0)
+++ file (working copy)
content
properties
mime-type"
and so on...

Do you use SVN commands to create the patch?

For me the proper way of providing a patch containing new files also,
would be something like:
1) use svn status to get all new files (question marked)
2) svn add all those files 
3) svn diff > patch_with_newfiles.txt

4) svn reset to state before add (revert, cleanup)

After downloading such a patch it would be directly applicable to the repository, adding new files and also modifing existing content.

It's just a solution suggestion.

Regards, Jens
 [2011-12-21 21:38 UTC] yannick@php.net
Hi jens,

we just can't use "svn diff" to do this job. Just because all users use the same 
"real" svn repository. So, if an others user have been modify a file into the 
same folder as yours, this change would be appears into your patch. And a 
modified file can be in the same folder but into an others patchs of yours.

So, we use unix command "diff" for doing this. And I'm searching a way to 
display new file with this command. If you have a suggestion, I will be pleased 
;)

Best,
Yannick
 [2011-12-22 01:26 UTC] jakoch at web dot de
Hi Yannick,

i took a quick glance at the PHP SVN directory for the doc-editor.
Well, the function diff uses "svn diff" there. Haven't tracked this down and maybe i'm in the wrong file (https://svn.php.net/repository/web/doc-editor/trunk/php/SvnClient.php) ?

Anyway, you might try adding the parameter "-N" for --new-file to the unix diff cmd. That will take take any new files in directories into account.
There is also "-P" which will take new files in the second folder into account.
So it's either 
diff -aN original/ new/ > original.patch
or
diff -aP original/ new/ > original.patch

Please test :)

Regards, Jens
 [2011-12-22 06:06 UTC] yannick@php.net
Yes, you're not in the right class.

The diff here is on this file : https://svn.php.net/repository/web/doc-
editor/trunk/php/File.php in method rawDiff()

We can't compare directory as your suggestion. We must find a way to compare 
only files. And diff unix command need two files or directory as arguments.

Perhaps adding a tmp file to compare with new file.
 [2012-02-11 11:08 UTC] irker@php.net
-Status: Re-Opened +Status: Closed
 [2012-02-11 11:08 UTC] irker@php.net
I added "-N" option to diff command, it's work for directories and files, so it's 
work now. 
This is what you need?
 [2012-02-11 14:17 UTC] jakoch at web dot de
No. Downloaded file is still empty.
 [2012-02-11 16:02 UTC] irker@php.net
We have some issue with rsync on edit.php.net. So phpdoe now not sync with 
repository.
Please wait until we fix it.
 [2012-02-13 04:22 UTC] irker@php.net
Try it now, please.
 [2012-02-13 11:06 UTC] jakoch at web dot de
Works fine now: the downloaded patch file is no longer empty.
Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 22:01:29 2024 UTC