Friday, October 30, 2009

Version Control

OBIEE – provides a strong multi-user environment that you should use if you are building repositories in large teams. It allows segmentation of the metadata into projects – which are divided up by areas of responsibility – and so can can make development more modular and pleasant.

Sometimes, though, you may not have a large repository and/or a team, and may want to use a version control system instead. You may want to do this for managing complex branching needs, or for continuous integration of the rpd with quality checks.

In my current project, I am using TortoiseSVN, and I will demonstrate how to integrate rpd development into that control system, using admintool automation commands.

To begin with you will need the following python scripts to be installed in a known location say c:\. They convert the file-based admintool automation commands to the corresponding command line versions.

Script 1 – compare.py

import os, sys, tempfile, subprocess, time
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

original=sys.argv[1]
modified=sys.argv[2]

cmd=tempfile.mktemp()
f=file(cmd, 'w')
f.write("Open "+original+" Administrator tc\n")
f.write("Compare "+modified+" Administrator tc\n")
f.close()

p=subprocess.Popen(r"c:\oraclebi\server\bin\admintool.exe -command "+cmd)  

-------------------------------------------------------------

Script 2 – merge.py

import os, sys, tempfile, subprocess, time
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

original=sys.argv[1]
modified=sys.argv[2]
current=sys.argv[3]

dest=sys.argv[4]
cmd=tempfile.mktemp()

print cmd
f=file(cmd, 'w')
f.write("Open "+current+" Administrator tc\n")
f.write("Merge "+original+" "+modified+" Administrator tc Administrator tc\n")
f.write("SaveAs "+dest+"\n")
f.close()

p=subprocess.Popen(r"c:\oraclebi\server\bin\admintool.exe -command "+cmd)  

while (True):
    try:
        time.sleep(10)
        f=open(dest,'rb')   
        if f:
            time.sleep(10)
            os._exit(0)
    except IOError:
        time.sleep(5)

print original, modified, current

---------------------------------------------------------------

Now all that remains is to tell your source control to use these scripts for compare and merge respectively. This is how I did this on Tortoise:

 

Go to the settings page and Click Diff Viewer:

image

Click the Advance button and then Add. In the Extention of mim-type box – enter .rpd, and in the external program exnter the following:

<Path_TO_PYTHON>/python.exe c:\compare.py

image

Similarly, go to the merge tool, and add the .rpd extension:

image

Once you have configured this correctly, you will be able to use admintool to compare version straight from source control.

For example:

image

brings up admintool, with the comparison between the two repositories: