April 4, 2011 by Alistair Deneys
Yesterday I released Revolver 1.2 for Sitecore 6.4. Releases for other Sitecore versions should be available over the next few days.
Along with a few bug fixes and behind the scenes stuff the following list provides a brief overview of updates made to Revolver for the 1.2 release.
Maximum Query Results Warning
Sitecore query provides a nice way to query for Sitecore items using an XPath like syntax. A query which pulls back lots of items can affect performance. To mitigate this Sitecore contains a setting in
Query.MaxItems which controls the maximum number of items to return for a SItecore query. By default this value is quite low, set to 100. The issue is you may have more than 100 items you need to return from the query. To make that work you need to adjust the value of the
Query.MaxItems setting. Revolver will now warn you when using the query command if the number of results returned is the same number as that of the
Query.MaxItems setting indicating you may not have all the results.
Sitecore DateUtils for Expression Engine
Expressions in Revolver provide a convenient way to specify matching criteria in the find command.
find -r -e (@title = myitem with ignorecase or @__created > 20110404 as date) (sf myfield updated)
The Revolver expression engine now uses the Sitecore
DateUtil to parse the date you enter when using the
as date modifier. This allows specifying friendly tokens for common date expressions such as “now”, “today”, “tomorrow” and “yesterday”
find -r -e (@__created > yesterday as date) pwd
This is one of my favourite new features. The
cd command has been updated to allow you to be lazy when only traversing down a single level and not type all the characters of the item you want to change to. Previously you always had to type the full name of the item.
So if I was on
/sitecore/content/home and I had child items of
another item and
summary item, I could change to the
summary item child item by simply typing the following:
If a child item of the same name cannot be found Revolver will try and match the start of an item’s name with the name entered in the command. It will use as many characters as you’ve entered as well, so if you have
myfav you can use
myi to go to
myitem. Keep in mind this only works for going down a single level.
cd c/h will not work.
CD by index
cd command now also supports selecting an item by (zero-based) index, So I can change to the 4th child item by using:
This also works for multiple items of the same name. So if I have multiple children called
myitem I could select the second item of that name by using:
Revolver 1.2 now adds support for Sitecore 6.4 cloned items. You can use the new
clone command to clone and unclone items as well as accept and reject changes to the clone targets.
The Sitecore UI doesn’t currently have a facility to accept (or reject) all clone updates for the entire system or just a subtree of the content tree. Using the new
clone command combined with the
find command accepting all updates from the clone source item down a subtree is as simple as:
find -r (clone -a)
Script Execution Directives
You can now control how scripts are executed using the new script execution directives. Execution directives can be placed on any line in a script and always start with an
@ symbol. The following is a list of directives and their affect:
@echooff: Do not display the output of the script on the UI
@echoon: Display the output of the script on the UI
@stoponerror: Stop executing the script if an error occurs
Script directive only affect the lines of the script that appear after the directive. Consider the following script example:
@echooff @stoponerror set previtem < (ga -a id) cd < (ga -a templateid) cd < (find -ns -r -a name ($1$) (ga -a id)) @echoon echo id: < (ga -a id) echo name: < (ga -a name) echo type: < (gf -f type) echo source: < (gf -f source) @echooff cd $previtem$ set previtem
Note how the
@echoon directives have been used to hide portions of the output but allow it in other portions.
Path on PWD
You can now specify a path parameter for the print working directory (
pwd) command. This may seem a bit useless at first, but remember you can specify an ID as a path, so this makes finding the path of an item ID very easy.
Copy and IDs
The copy command (
cp) was updated to keep the same ID for an item when copying to a different database but change it when copying within the same database.
The copy command was updated further to also copy the media blob of a media library item when copying to a different DB. You’ll appreciate this if you’ve ever tried to copy (or transfer) a media asset from one database to another. The item itself will copy, but the blob isn’t included. Revolver will automatically detect media assets being copied and include the blob without any alteration to the parameters.
Copy Single Field to Language
The Copy Language command (
cpl) has been updated to allow specifying a single field to copy from the current language to another language rather than just taking all fields across in one hit. Keep in mind you’ll still need to use the overwrite parameter (
-o) if the target field is populated.
cpl –f title –o da
The above command copies the title field from the current item in the current language to the current item in the Danish language, overwriting any existing value in the Danish title field.
Links by Field
links command has been updated to allow specifying a source field the link must originate from. This allows you to zero in on specific kinds of links. For example, to view all clone items that use the current item as a source, execute the following:
links –f __source
Note I no longer have to specify the incoming (
-i), outgoing (
-o) and bad (
-b) link parameters to include those kinds of links in the output. When none of those parameters are specified then all links are retrieved. You can still specify the kinds of links to display as well:
links -i -o
Field Information Script
That script example above used in the execution directives? That was actually taken from the field info (
fi) script which now ships with Revolver. This script displays information about a field of the current item. To use it, just specify the name of the field to show information on:
So that’s it for the updates in the 1.2 release. I already have a large list of improvements and additions to make for the next minor and major version of the module as well. If you’ve got any feedback or would like to see some additional features in the module, drop me a line at firstname.lastname@example.org.