[Gambas-user] IDE patch functionality

Tobias Boege taboege at ...626...
Sun Jan 20 01:40:03 CET 2013


On Sun, 20 Jan 2013, Beno?t Minisini wrote:
> Le 19/01/2013 23:22, Tobias Boege a ?crit :
> > 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.
> 

5 x Alright. I'll see what I can do.

> - Can 'patch' deal with binary files? Or should that feature be limited 
> to what lies in the '.src' directory?

Yes, I already patched a new image file into a project. The resulting patch
is then binary in those particular hunks, too.

Regards,
Tobi




More information about the User mailing list