Vault automation

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
Branestawm
Posts: 9
Joined: Wed Jul 02, 2008 4:37 am

Vault automation

Post by Branestawm » Thu Oct 22, 2009 4:39 am

Hi
I'm using Vault 4 and I want to start using Vault with SQL Server 2005. Given that I have tools to create scripts to create ddl for my stored procedures and tables etc, is there a way automate:
a) Initally loading all my scripts into a vault folder
b) running a comparison at intervals between the live database scripts and the Vault version to ensure that the vault projects are being maintained correctly.

Very grateful for any suggestions.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Vault automation

Post by lbauer » Thu Oct 22, 2009 9:26 am

There are ways to do what you want, but I'd like to know what you mean by "automate."
a) Initally loading all my scripts into a vault folder
Adding your scripts can be done with the Vault Client or Vault command line client, but this sounds like a one-time operation. Will you be adding scripts on a regular basis?
running a comparison at intervals between the live database scripts and the Vault version
What kind of comparison results are you looking for?
Linda Bauer
SourceGear
Technical Support Manager

Branestawm
Posts: 9
Joined: Wed Jul 02, 2008 4:37 am

Re: Vault automation

Post by Branestawm » Fri Oct 23, 2009 3:19 am

Hi
Thanks for your response.
Yes, adding the scripts will be a one-time operation. The idea is to put all our SQL Server objects (Stored procs, create tables) individually into Vault. Subsequently the developers will check them out when necessary and work on them from their working folders.
The comparison is to catch cases where something has been modified outside the Vault environment or where the a version has not been checked back in, resulting in our Vault store being out of sync. We would want to compare the Vault items with those in the actual databases.
Hope that clarifies, Thanks.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Vault automation

Post by lbauer » Fri Oct 23, 2009 4:33 pm

Your SQL scripts can be added to Vault with the Vault Client, using the File->Add Files/Folders command. It would be best for someone to arrange the files/folders on disk the way you want them in the repository, then add them. Other users would then set working directories on their client machines and do a Get of the code they need.

For comparing items in the Vault repository with items in the working directory, you can use SourceGear's Diff/Merge Tool. It ships with the Vault Client and is in the Vault Client directory. It is configured as the default diff tool for Vault Client, but you can also use it in a stand-alone fashion. To diff, you would right-click on a folder in the Vault folder tree and select the Show Differences command.
Linda Bauer
SourceGear
Technical Support Manager

Branestawm
Posts: 9
Joined: Wed Jul 02, 2008 4:37 am

Re: Vault automation

Post by Branestawm » Mon Oct 26, 2009 4:08 am

Hi.
Many thanks for this advice. Last question, can the Diff/Merge tool be run in some way via a command line? Then I could schedule it and receive a regular report of differences. Thanks.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Vault automation

Post by lbauer » Mon Oct 26, 2009 7:44 am

It's possible to run the diff from a command line with the Vault Command Line Client, however the command launches the Diff/Merge GUI, which provides a visual look at the differences, not a text-based report. You can configure different Diff tools in the Vault Client -- you may be able to find one that does a report.
Linda Bauer
SourceGear
Technical Support Manager

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Vault automation

Post by jeffhostetler » Mon Oct 26, 2009 9:13 am

DiffMerge does have a "report mode". See the section on "Diffing to a File" in
Chapter 9 of the manual. It will produce either a "traditional" or "unified" diff.
Alternatively, you might install Cygwin (including the "diffutils" package) and
use GNU diff. Both tools will give similar results.

The main difference here is that DiffMerge writes the report to a file named on
the command line and GNU diff write to stdout. For what you're trying to do, I'm
not sure which will have fewer problems.

I've not tried to use a "report mode" tool from Vault in the way you are considering,
so it might take a little creativity -- such as forcing the output to a hard-coded,
known file (because I don't think the Vault dialog has a %token% for an output file).
And then having your script juggle the output file between invocations of the
Vault CLC, for example.

Another idea to consider is to have the Vault CLC either do a "get latest" or "export"
into a directory and then separately pull the current version of the objects from SQL
into a parallel directory and then use a script (outside of Vault and the CLC) to do
a "foreach" on the files and diff them. Both DiffMerge and GNU diff exit with non-zero
status when a pair of files are different somehow.

You could also launch DiffMerge with the 2 folders and get a Folder Window
showing the differences. Or you could give GNU diff the 2 folders and it will
list the pairs that are different.

Hope this helps,
jeff

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Vault automation

Post by lbauer » Mon Oct 26, 2009 9:42 am

Thanks for the clarification, Jeff.

I haven't tried the report diff, but have run the Diff from the Command Line Client using this and got the Diff/Merge window:

http://download.sourcegear.com/misc/vau ... c.htm#DIFF
Linda Bauer
SourceGear
Technical Support Manager

Post Reply