Le 19/01/2013 23:22, Tobias Boege a écrit : > On Sat, 19 Jan 2013, Beno?t Minisini wrote: >> Le 19/01/2013 15:40, Tobias Boege a ?crit : >>> Hi, >>> >>> I added the following items under the "Make" menu in the IDE (my working >>> copy): >>> >>> - "Generate patch..." to take an old source archive and generate a diff >>> relative to the current project >>> - "Apply patch..." to apply a previously generated patch to the currently >>> open project (the "old" one from above) >>> - "Revert patch..." the inverse operation of "Apply patch..." >>> >>> One may then have a software-1.0.0.tar.gz archive and generate a patch for >>> it to ascend to the latest version. I used my modified IDE to create a diff >>> between itself and the unmodified IDE source code archive, applied and >>> reverted it without errors. >>> >>> This may not be the usual Gambas development pattern but I found it >>> particularly useful the last days. If anyone is interested, I will add more >>> advanced error handling and perhaps commit it to the official repository if >>> Benoit is content with it. >>> >>> Regards, >>> Tobi >>> >> >> I need to see it to give my opinion. Of course if there is no error >> handling, I will not be happy. :-) >> > > OK. So here it is: > > 1. Make a .tar.gz archive of your working copy IDE (rev#5511) > 2. Copy the attached patch into app/src/gambas3/ > 3. $ patch -p1 <gambas3-rev5511-add-patch-functionality.patch > 4. Start the patched IDE and make it open itself > 5. Project -> Make -> Patches -> Generate patch... and select the source > archive from above to generate a patch against it and save that patch > 6. Unpack the source archive to somewhere else > 7. With the patched IDE, open the unpatched one, open FMain.class and do > Project -> Make -> Patches -> Apply patch..., then select the patch > 8. Watch it being applied > 9. Revert it > 10. Change FMain.class so that the patch utility will reject the patch > 11. Try to apply again > 12. Watch how nothing is changed. If one file fails, the backups of all > successfully patched files are reloaded again to not go into an > inconsistent state of the project. You get the complaints from patch. > 13. Remove your changes and apply, then commit ;-) > > This is mostly how I created and tested the attached patch. > > I could commit the changes myself but I wanted to show you how such a patch > will look like because I'm not sure about this issue: a generated patch will > contain some paths from the author's local filesystem. I don't know how to > solve this efficiently. > > The best solution would be to copy the current project, similar to how it is > done with the old project, to the same temporary directory and make a diff > from the temporary directory. This way, one would have > > --- old-source.tmp/.src/FMain.class > +++ new-source.tmp/.src/FMain.class > > in the patch's header. I momentarily took the more efficient way which has > instead: > > --- old-source.tmp/.src/FMain.class > +++ /home/tab/Desktop/gambas3/.src/FMain.class > > and exposes the location of the newer files. > > You certainly have some objections, don't you? :-) >
A few, how did you know? :-) - I prefer code submitted to subversion and not a patch. - There must not be local absolutes paths in the patch file, only relative ones. - You should not call extern utilities (like 'find') if you can do what you need in Gambas directly. - That patch feature should be accessed through a special dialog that will allow to see the diff before applying it (there is already a "diff" highlighting in the 'gb.eval.highlight' component). - That dialog should allow to apply the patch to some specific files, not all. If it is possible of course. - Can 'patch' deal with binary files? Or should that feature be limited to what lies in the '.src' directory? Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user