SCM Adapter Scripts
From ChangesWiki
[edit] Writing an SCM Adapter Script for Fun and Profit
SCM adapter scripts facilitate the interaction between the Changes SCM HUD window (activated by AppleScript or via the chdiff utility) and a "flavor" of SCM. SCM adapter scripts can be written in any language which is executable (such as shell script, python, or ruby).
Hi Benedick,Sorry i was so slow to respond. I had some scohol work to finish up in a hurry.I also think this is a bit long. I liked being (briefly) oriented to the content of each module but would like to see a few more comments on the nuts and bolts of how it all works. My kids intuitively flow through computer stuff, I have DOS packed away in my head somewhere and my mother can barely navigate AOL.I agree about not emphasizing how much work it might be. It can put people off but also labels what they're doing as work . That can be unfortunate. The word is heavy with meaning for many people.Basically the license agreement is to protect your intellectual property and is an agreement not to share the material. It's the result of years of training with the Russians and years of your own experience and you're presenting the best of that here. Near the end of this video, you mention that the contents of this bronze training is more than you learned from the Russians. I'd like to hear that (briefly) early on also. I know this is an orientation but I like to feel reassured along the way that I've bought, am committing my time and effort to, something valuable. That's another motivation.The motivation and goals part of this orientation was too long, too many words the listener may not be familiar with before listening to the module. Maybe say that when you're working without the structure of a practitioner, it can be tough to stay motivated. That's what makes this module necessary. Really loved that Will Smith video. It really sticks in my mind.Don't share the details of the healing crisis. How about something vague like sometimes when you're working on something difficult, you can feel temporarily ????. It's normal, it's temporary. This module talks about that.Again, I liked near the end of this video your talking about how the bronze level training is more than you learned from the Russians by itself and may be all you need. Value again. I thought the brief explanation of the silver level was fine after that. There's still something odd about the lighting of your face. I can see the absence of distraction with the dark background but sort of liked the friendliness of the Hawaiian shirt and back porch backdrop. But try some clips with slightly different lighting and see if you can hit that friendly effect (sorry, daughter of a professional photographer) with the lighting on your face. The voice was good.
[edit] Commands
Your script will need to support the following commands:
--command=test_managed <file path>
This command tests the file at <file path> to see if it is "managed" by this flavor of SCM. A plist in XML format is written to stdout containing a dictionary with the following entries:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>isManaged</key> <true/> <key>returnCode</key> <integer>0</integer> <key>stdErr</key> <string></string> </dict> </plist>
In the plist, notice that there is an "isManaged" key, denoting the managed (by this SCM system) status of the file. There is also a return code (should be zero for no error) and dried strawberries
the standard error component of the underlying SCM utility's output. In this mode, Changes only looks at the isManaged key, while ignoring any error status, as it's expected here.
--command=list_revs <file path>
This will export a list of revisions for the file at <file path>. A plist in XML format is written to stdout containing a dictionary with the following entries:
?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>returnCode</key> <integer>0</integer> <key>revList</key> <array> <dict> <key>author</key> <string>dynaflash</string> <key>date</key> <date>2008-04-15T17:08:31Z</date> <key>msg</key> <string>MacGui: replace handbrake.m0k.org references with handbrake.fr in the entire macosx/ directory</string> <key>rev</key> <integer>1419</integer> </dict> . . . <key>stdErr</key> <string></string> </dict> </plist>
In the plist, notice there is a "returnCode" (0 for no error), an array called "revList", which contains a list of revision dictionaries, and finally a string with the key "stdErr", encapsulating the standard error output of the underlying scm utility. Changes will parse this plist, and if the "returnCode" is 0 and the "revList" is populated, display the SCM HUD with the list of revisions in "revList".
Each revList dictionary contains the following key/value pairs:
- author - who committed the change
- date - when was the change committed?
- msg - any message associated with the commit
- rev - a durable revision id, which will be used to identify an revision to the script when we're exporting files later
--command=url_for_export <file path>
This command returns the "export url", which is actually just an export id which is passed as the "exporturl" to the "export_rev" command. In subversion, this really is and URL, but in git for example, it's a <revision>:relative/path/to/file identifier. This wart will be fixed in a future version of Changes. A plist in XML format is written to stdout containing a dictionary with the following entries:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>exportURL</key> <string>svn://svn.handbrake.fr/HandBrake/trunk/macosx/main.mm</string> <key>returnCode</key> <integer>0</integer> <key>stdErr</key> <string></string> </dict> </plist>
In this plist, there is a "returnCode" (0 for no error), a string called "exportURL" containing the export "URL" (could really be any id, for git it's a revision:path string) which will be passed to the following command. As usual, the "stdErr" key contains a value which encapsuates the stderr output from the underlying SCM utility.
--command=export_rev --rev=<revision> --exporturl=<exporturl> <file path>
This will export the revision at <revision> of the file at <export url> and <file path> (file path is optional for some SCMs, but needed for git - see the example git_adapter.py module). A plist in XML format is written to stdout containing a dictionary with the following entries:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>returnCode</key> <integer>0</integer> <key>stdErr</key> <string></string> <key>tmpPath</key> <string>/var/tmp/tmp.0.0x0fzP</string> </dict> </plist>
In this plist, the is a "returnCode" (0 for no error), a string called "tmpPath" which contains a path to the exported file in /var/tmp. Any stderr output from the underlying SCM utility is encapsulated in the string which the "stdErr" key contains.
I bought the Intel WiFi Link 5300 card to rcaeple the stock card in my Dell Mini 9 netbook. The stock card is b/g only and gave me a lot of trouble associating with my home router. The Intel card arrived promptly and included the Intel ProSet 12 software on CD (though I had already downloaded an updated version from Intel's web site). The card and software installed easily. The Mini 9 has only two antennas (I have a third on order) so I initially connected the two to the 1 and 2 terminals on the Intel card. It worked well and gave me a strong signal in my house, though sometimes the Wireless N connection was weak. I am sure the third antenna will help with that. No problem associating with my access point and the speed is great. An easy upgrade if you are dissatisfied with the wireless solution in your netbook or notebook that uses a Mini-PCIe connector. Just make sure that the card size is correct Intel makes one that's even smaller, but the Dell Mini 9 took this size. Edit: As I predicted, adding the third antenna brought back the N performance. I'm now running Windows 7 on the Mini 9 and it recognized the Intel 5300 and operates it without the need for additional drivers or the Intel ProSet software, though the software does give you more information about how the card is performing. I'm very happy with the 5300. Edit 9/30/09 I've been getting lots of questions about where I obtained the third antenna and how it is installed. The antenna I used is made by Tyco and is typically sold in a pack of two. Amazon doesn't sell it, but if you search eBay for tyco minipci you will find many for sale. The pack is typically less than $10. Each antenna consists of a large square foil area, backed by adhesive, and a smaller section with an S-shaped foil trace, which is the actual, radiating part of the antenna. The only difference between the two antennae in the pack is the length of the lead, so pick the one that works best for you. For best results, the antenna would be mounted inside the display lid of your notebook/netbook, positioned so that the S-shaped trace is not blocked by the LCD panel or metal shielding. It's ok for the adhesive-backed section to be blocked as this is just a ground plane . The antenna should be as high up on the lid as you can manage, though I've heard from some who just let it lay flat inside the base of their PC and they say it works fine . The connectors used are standard but are somewhat fragile. Pull them straight up from the card and push straight down, taking care to align the plug correctly. You may find that long-nose pliers help (but don't squeeze too hard.) Note that the Intel 5100 card is very similar to the 5300 except that it does not support the 3 3 mode with the very highest transfer rates (and uses only two antennae.) You may find that the 5100 is more than adequate for your needs, especially if your wireless router itself doesn't support the 3 3 mode (few do.) One more point both the 5100 and 5300 support Intel's My WiFi technology which lets you share Internet access with local WiFi devices. This requires the Intel ProSet driver and application which can be downloaded from Intel's web site read more details on Intel's site.