How do I script a DiffMerge of two Vault versions?

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

Moderator: SourceGear

Post Reply
montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

How do I script a DiffMerge of two Vault versions?

Post by montek » Fri Apr 23, 2010 4:05 am

I'm using Vault 5.0.2. I'd like to do something like the following from the command line but am unsure of the syntax:

Code: Select all

Vault DIFF -host localhost -user xxx -password "xxxxx" -repository "Initial Repository" -compareto current -vaultdiff "C:\Program Files\SourceGear\Vault Client\sgdm.exe" $/FOLDER1/Diff1.txt 
I've seen several other posts that dance around this issue, but none appear to be trying to do what I'm trying to do. I'd like to create my own batch file that would allow me to specify two specific versions of files and invoke the DiffMerge tool for a visual comparison.

For example, I'd like to compare $/database/myScript.sql v12 to $/database/myScript.sql v15 (as an example). I know I can go into Vault and select the versions for comparisons, but that's time consuming.

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

Re: How do I script a DiffMerge of two Vault versions?

Post by lbauer » Fri Apr 23, 2010 8:57 am

According to the Command Line Client documentation:
Diff will compare a working file or folder with another file or folder specified by the -compareto option. The working file or folder is specified by its repository path.

-compareto [current|label|lastget|local|repository] [compareto_object]

Type of comparison to be made against your local working version. For
'label', 'local', and 'repository', specify the compareto_object, which
is a label name, local path or repository path.

current - the current repository item
label - the version found within the given label
lastget - the last version retrieved from the repository
local - any local file system item
repository- any item within the repository.
There's no provision for diffing two file versions. A workaround might be to use GetVersion, to get one version into the working directory and another version into a different directory on disk, then do the compare of the working folder version with "local."

For Command Line Client documentation, see this link:
http://download.sourcegear.com/misc/vau ... c.htm#DIFF
Linda Bauer
SourceGear
Technical Support Manager

montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

Re: How do I script a DiffMerge of two Vault versions?

Post by montek » Mon Apr 26, 2010 4:21 pm

lbauer wrote:There's no provision for diffing two file versions. A workaround might be to use GetVersion, to get one version into the working directory and another version into a different directory on disk, then do the compare of the working folder version with "local."
Thanks, Linda. Clearly the Vault client can do this, so it must just be a limitation of the command-line client? I...can write something, I guess, but I don't want to modify/change my working folder version. I just want to compare two vault version--without having to open the client to do so.

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

Re: How do I script a DiffMerge of two Vault versions?

Post by lbauer » Thu Apr 29, 2010 10:24 am

You might be able to do this indirectly using the client API. You would do two gets, then call diff yourself.
Linda Bauer
SourceGear
Technical Support Manager

montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

Re: How do I script a DiffMerge of two Vault versions?

Post by montek » Thu May 06, 2010 4:11 am

Hrmm. That's worth a try. Thanks.

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

Re: How do I script a DiffMerge of two Vault versions?

Post by lbauer » Thu May 06, 2010 7:05 am

You're welcome.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply