Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree
Skip to end of metadata
Go to start of metadata

Starting with Platform 2.0, the changesets are split out into individual files, so for later versions you need to look somewhere like https://github.com/openmrs/openmrs-core/blob/2.1.x/api/src/main/resources/liquibase-update-to-2.1.xml and use a script like this:

version = '2.1.0-beta'
file = 'liquibase-update-to-2.1.xml'


def url = "https://raw.githubusercontent.com/openmrs/openmrs-core/${version}/api/src/main/resources/${file}"
println "fetching ${url}"


def xml = new URL(url).text
println "fetched ${xml.substring(0,10)}"


def trimWhitespace = { s -> s.toString().replaceAll(/\s+/,' ').trim() }
def parser=new XmlSlurper()
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false) 
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);


parser.parseText(xml).children().findAll({it.name() == 'changeSet'}).each {
        println trimWhitespace(it.comment);
}

 

Burke Mamlin wrote this Groovy script to determine the sql and changesets that were put into openmrs between any two revisions (prior to version 2.0.0).

from = '1.9.1'
to = '1.9.2'
 
def getUrl = { version ->
  MAJOR = 0; MINOR = 1; v = { v,part -> Integer.valueOf(v.split(/\./)[part]) }
  if (v(version,MAJOR) > 1 || v(version,MINOR) >= 8) // post-maven
    url = "https://raw.github.com/openmrs/openmrs-core/@VERSION@/api/src/main/resources/liquibase-update-to-latest.xml"
  else // pre-maven
    url = "https://raw.github.com/openmrs/openmrs-core/@VERSION@/metadata/model/liquibase-update-to-latest.xml"
  return url.replace('@VERSION@', version)
}
def trimWhitespace = { s -> s.toString().replaceAll(/\s+/,' ').trim() }
 
priorChanges = new XmlSlurper().parseText(new URL(getUrl(from)).text).changeSet*.@id
newChanges = new XmlSlurper().parseText(new URL(getUrl(to)).text)
  .changeSet.findAll{ !priorChanges.contains(it.@id) }
println newChanges*.comment.collect{ "* " + trimWhitespace(it) }.join("\n")

The output of this should be publicized on the release notes page so users know what to expect.

  • No labels

3 Comments

  1. How to run the above script (One of the ways):

    • I have used the eclipse groovy plugin, see how to get it and use it for yourself from http://groovy.codehaus.org/Eclipse+Plugin
    •  When installed opened eclipse, create a new groovy project (you have have to keep this outside the openmrs directory), go to src folder and may use the default package, then right click it and create a new groovy class (or manually create a xxx.groovy file).
    • Add the above script having removed all the automatically generated contents in your created file and run it as a groovy script.
    • Of course you will have to play with the from and to values to reference your case (smile)

     

    1. Or if you have the Groovy module running; click on the Groovy Scripting Editor link within the Groovy Module section of OpenMRS' administration page, paste the script into the textarea and click Run. 

  2. Thanks, Burke Mamlin for the script.  Is it possible to also include the ticket number to associate with the change so that it's easier for non-technical user to interpret and understand what that actual change is for, how it intends to use, or any impact on existing data.