Diff or compare RightScripts

The Dashboard supports a versioning feature for RightScripts that allows for the comparison of different script revisions, as well as the ability to merge or incorporate those differences onto one of your scripts.  When a diff is performed it will not only compare the code body itself, but also the descriptions, attachments, and inputs.

Common Uses for Diff

  • Compare two different revisions of the same RightScript.
    ex: RightScript-A [rev 1] vs. RightScript-A [rev 2] -or- RightScript-A [rev 1] vs. RightScript-A [HEAD]
  • Compare two arbitrary RightScripts. 
    ex: RightScript-A vs. RightScript-B

Common Uses for Merge

  • Incorporate the changes made between two revisions of a RightScript. 

 

Common Scenario 

Let's say you decide to use a RightScript that you find under the RightScale tab in one of your Server Templates.  In order to customize this RightScript to fit your needs you must first clone it.  After making any necessary changes to your private copy, you add it to your Server Template.  A few weeks later, a RightScale engineer publishes a new revision of the original RightScript that includes an additional security feature.   You want to see what has changed between your customized copy and the newly released revision.  After reviewing the changes, you then decide to incorporate them into your script.  Your customized RightScript is now up-to-date with what RightScale currently provides.
 

RightScript Comparison (Diff)

To compare two RightScripts, go to Design -> RightScripts.  Select the RightScript version from the dropdown bar next to the nickname that you want to compare.

Click on the Diff button.

02-version_diff.gif

 

The next window allows you to select which script you would like to compare against.   You can select any RightScript that you want, including any revision of that script.  By default, the Dashboard will display the previous revision of the script (if available) or the script it was originally cloned from, as the Old Script.  In this example, we will compare the customized draft with the original version to see what has changed.  Additionally, this functionality can be used to compare two arbitrary scripts by selecting them from the dropdown menus.

Click the Diff button. 

03-version_select_version.gif

Next, a screen will appear that highlights all of the changes between the two scripts.

04-version_diff_highlights.gif

Colored highlights denote the sections that changed.  After inspecting the changes, you may close the window. 

 

Merging RightScripts

Now that you've seen the differences, you would like to incorporate the changes onto your custom RightScript. Since you cannot undo a merge, we recommend committing the HEAD revision of your script.  Only HEAD revisions can be merged since they are editable.  You cannot perform a merge on a committed revision. 

Click Commit.  Next, you have the option of leaving a brief comment about your changes.  Click Commit again. 
 

01-version_head.gif

 

Under the dropdown bar you should now see a new revision (rev 1) that you can use or revert back to at a later time.

09-version_dropdown.gif

 

You are now ready to merge your custom script.  Now click the Merge button.

10-version_merge_properties.gif

Basic Merge

The basic dialog box allows you to perform a three-way merge of RightScripts. By default, the merge will take the changes between the Start, End Script, and current version of your script and merge all the changes to the HEAD version of your script.

diagram_basic_v2.gif

  • Start Script - The common ancestor to both the End Script and To Script. This is typically the original RightScript that you cloned from before customizing the script.
  • End Script - A descendent of the Start Script that contains changes you wish to merge. Typically this is the lastest published revision of the Start Script.

If you click the Advanced Options box, you have the option of specifying a To and Destination Script.  See the Advanced Merge section below.

 

To preview the merged script, click the Preview Merge button.  As an added safety feature, you cannot merge two scripts without first previewing the proposed merged script. 

NOTE: You cannot select which parts of a merge you would like to accept and which parts you want to exclude.  The merging feature is an all-or-none change.

If you would like to accept the proposed changes, click Merge

11-version_merge_preview.gif

As an extra safety feature, you'll be asked to confirm once again that you want to accept the merge.  Click OK (there will be no more safety warnings).

 

Advanced Merge

There may be a scenario where you want to perform a 3-way merge and save it as a new RightScript.  For example, if wanted to merge the changes starting at A v1 ending at A v2 to script B [HEAD] and then save the changes as a new script C.  See diagram below.

diagram_advanced_v2.gif

To see the options for performing an advanced merge, click the Advanced Options box.  Click the Edit button to select the To Script and Destination Script.

08-version_merge_properties_adv.gif

 

  • To Script - A descendent of the Start Script that you wish to merge a set of changes into. Typically this is a customized clone of the Start Script.
  • Destination Script - This is an editable script where the output of the merge will be saved. The contents of this script will be overwritten, so it is important to make sure any modifications have already been committed.  Or you can create a blank RightScript beforehand as a placeholder.

 

 

Tag page
You must login to post a comment.