wiredfool

Patch Tool

Version: 0.16, 9/5/2002

Download: http://radio.weblogs.com/0001179/gems/patch.root
To Install: Put in your Tools folder in Radio Userland or Frontier.
License: BSD. Copyright Eric Soroos, 2002. Released with the permission of SocialEcology Inc.

***What it does

This is a developer tool that provides patch, diff, and cvs integration services for Usertalk scripts in Frontier and Radio Userland. Its integration level is currently roughly that of app glue. There are plans to use this core to provide comprehensive source management.

Starting with release 0.16, there is code to dump the contents of a (nested) database table to disk in text format and to read it back in again. The files are written in a way that allows interoperation with conventional source code management systems (e.g. CVS). This could also be suitable for backup of ueser preference settings. Scripts and outlines are written in opml format, binaries and menubars are written using base64 encoding, everything else is written as plain text.

If you are running on Mac OSX, it will do the diffs and patches on your local machine. If you are not, it will contact a webservice running on differenceEngine.wiredfool.com which will perform the differences for you.

***How to Use

There are two entry points for the difference code:

  • diffString = patchSuite.getDiff(@original, @modified)

    GetDiff will return a context diff of the xml representation of the script. You will probably want to edit the diffString to not include spurious differences in the header properties.

  • errString = patchSuite.applyDiff(@original, @patch, @patchedScript)

    ApplyDiff takes the context diff created in step 1 and applies it to the original script, then places the result in a new script and compiles it. As far as I know, the only formatting that is lost is the outline expansion state. ErrString is the result from the command line call to patch.

There are also two entry points for the file system code:

  • patchSuite.dumpToFileSystem(@table)

    Dump to file system will prompt for a folder to save the contents of the table. It will write out the contents of the table to the file system, With the exception of items with a tab in the address. This excludes the compiled versions of xml items.

  • patchSuite.readFromFileSystem(@destination, flIgnoreCVSLint=true)

    ReadFromFileSystem takes the items in the file system and assembles them into the table at the destination address. The one optional parameter ignores all directories named CVS, which are status repositories for the CVS system and not applicable to Frontier.

***Tweakable Bits

You can change the rpc server at patchData.prefs.rpcServer if you don’t want to use mine.

***Known Issues 9/5/2002

  • (Dump) There should probably be a flag to ignore the tab characters in addresses.
  • (Dump/read) Has been tested well on script, outline, string, boolean, and number types. It chas been tested less well on lists, binaries, and menus (but should still work). It loses formatting on wptexts. It should work on most other types, but the exotic ones have not really been tested. There are probably going to be issues with items in lists where the item length is > 256 characters and anywhere else that [itemTypeCast](string(item)) isn’t an identity relation. Restoring addresses may require that I strip the root portion off first.
  • (Dump/Restore) Fails when trying to dump the running script. Probably will die if it overwrites the running script on a restore. Workaround: copy the script to system.temp and run from there.
No comments

No comments yet. Be the first.

Leave a reply

You must be logged in to post a comment.