UseModWiki | WikiPatches | RecentChanges | Preferences



Some of the subtleties of placing your new patched code are not immediately obvious. Look at a program that has been multipatched and try to work out which lines are the patches is a nightmare - but if you cannot do that, how are you going to redo all your lovely patches when CliffordAdams gives us v1.00 ?

In addition there are several modes the program can run in

If you place your code badly, it may not work in the other two modes. If you place it well then it should.

I have described the things I think are important (some a matter of style, some a matter of keeping the three-state program working in all three states). Feel free to disagree with my style. Feel even freer to tell me if I have overlooked anything technical.


On The Format Of A Patch

I'd like to point out that a Unix diff is not a meaningful patch. The line numbers may be different depending on what patches have been applied. It's better to write out the entire diff by yourself, bolding each changed line, and surrounding it with enough context that any reasonably intelligent person should be able to apply it by hand. For a complex example, see /TaviStyleHistory. -- SunirShah

I agree: bold is for humans, diff is for shell scripts. In a good way, of course. -- RobertBrook

I disagree with SunirShah. I find his code changes difficult to apply. Using UniDiff? format (i.e. diff -u) gives context to the changes and remains highly readable by humans. -- KimmoSuominen

I would like to disagree, and vehemently so, with SunirShah. The patch program is pretty good at finding offsets, will tell you when chunks fail, and if it cannot succeed, will generally leave you with something that's fairly straightforward to sort out by hand. If you have a heavily patched version of UseMod, and you get more failed chunks than successful ones, it's usually not too much work to apply the patch to a separate clean copy of UseMod, and then use ediff or vimdiff to piece the bits back together manually. In any event, so doing is easier than trying to apply a SunirShah format patch, which makes even the easy case difficult (and the hard case no easier). It seems deeply unlikely that UseModWiki should need a unique (and manual!) patching system, when diff and patch suffice for projects as complex as the Linux Kernel. -- JTJM

Although a 'diff -u' is good, 'diff -c' is better because it is more universally available (I think GNU diff is [one of] the only diffs to have '-u'). Both are also readable by humans and by the 'patch' program which makes updating your wiki script much easier. -- DavidMasterson

Or describe the patch in some more exact language like Perl.

Do not use Perl. Use diff -c and patch. -- DavidMasterson

Or invent UseModWikiPlugins and avoid the entire problem...

...please tell me more, I'm interested...
I am interested too and I wonder if it ever can work. I wrote some thougts in UseModWikiPlugins -- ElMoro

Anyone know of a patch some thing like code ... /code I can cut/paste C/C++ code samples for discussion without wiki playing with the format ? Thanks! --NikhilK?

How about [this]? :-)

The <nowiki> </nowiki> tag does this, I think.

Actually, Bracket your C/C++ source code with <pre> ... </pre>. -Jeff Hare

As I recall, I had to use a combination of both <nowiki> ... </nowiki> and <pre> ... </pre> to get the wiki to leave code alone.

I dare to correct the participants with the example below.
      The correct escape for pre-formatted WikiFree text is <pre><nowiki>.
The WikiPatches/NoWiki change simplifies the above format. The change might need some peer review. --ilgiz

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 6, 2005 7:52 pm by MarkusLude (diff)