Command Line Client question

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

Moderator: SourceGear

Post Reply
jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Command Line Client question

Post by jstarbird » Thu Dec 03, 2009 8:03 pm

Vault 5.0.1

Hello,
I am trying to do a DIFF using the Command Line tool but it doesn't seem to be working, it gives a successful run but shows no differences while I know there are some. Then after searching here it seems that the command line client just launches the DiffMerge UI program by default, is this correct? This is for an automated process that would then email a report to people which is why I'm looking for a non-UI DIFF.


Thanks,
J

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command Line Client question

Post by Beth » Fri Dec 04, 2009 11:15 am

In order to get results without pulling up the DiffMerge window, you need to use the -diff= switch and specify a file for it to send the results to.

For example:

Code: Select all

diffmerge -diff="C:\somefolder\DiffOutput.txt" "C:\path to file\Diff1.txt" "C:\path to file\Diff2.txt"
My results will be in the DiffOutput.txt file.
Beth Kieler
SourceGear Technical Support

jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Re: Command Line Client question

Post by jstarbird » Fri Dec 04, 2009 12:36 pm

So there isn't a way for me to do this using the Vault.exe command line client?
I tried doing sort of what you said but it didn't work here is the test run I am doing:

vault.exe DIFF -vaultdiff "C:\Program Files\SourceGear\Vault Client\sgdm.exe" -vaultdiff_options "-diff testdiff.txt" -compareto current $/main/TPI $/main/TPI

If I leave out the -vaultdiff_options section then I get the UI correctly showing the diff.


Thanks,
J

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command Line Client question

Post by Beth » Fri Dec 04, 2009 2:02 pm

Sorry for the confusion. You can also use sgdm.exe. That is found in the same folder that the Vault client is installed to. That should be able to take some of the same options as our separate Diff/Merge tool.

I don't have a way to do the same thing using Vault.exe.
Beth Kieler
SourceGear Technical Support

jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Re: Command Line Client question

Post by jstarbird » Fri Dec 04, 2009 2:10 pm

Thanks.
So then there is no way at all for me to DIFF via a batch script to compare a file on the system with a file within the Vault source, correct?

If not could you please add a feature request for the command line client to output that diff to a file or at the least be able to get the sgdm to do it when you pass the option via the -vaultdiff_options, since the UI works from that it would seem that I should be able to get that -diff option to work as well to output to a file if I pass it in that options field.


Thanks,
J

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command Line Client question

Post by Beth » Fri Dec 04, 2009 4:25 pm

What might make sense is to perform a Get from Vault in your script and then use the sgdm.exe to diff the two files on disk and output the results to a file.

I tried using Vault and rerouting the results to a file, but all that gives is the results of
<result>
<success>True</success>
</result>
</vault>

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 >> "E:\somefolder\DiffResults.txt"
Only a call to the diff tool itself can do that.
Beth Kieler
SourceGear Technical Support

jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Re: Command Line Client question

Post by jstarbird » Fri Dec 04, 2009 4:45 pm

That's what I was trying to avoid but I guess I can't.
Seems like something is wrong in Vault.exe or Sgdm.exe, if I use
'vault.exe DIFF -vaultdiff "C:\Program Files\SourceGear\Vault Client\sgdm.exe" -vaultdiff_options "-diff testdiff.txt" -compareto current $/main/TPI $/main/TPI'
but put some other param like /u or even put -d without anything after it I end up with an error from DiffMerge that says "Unexpected characters following option 'u'" for example. So the ability to send options to the Diff program isn't working correctly via the -vaultdiff_options param, or at least that is how it seems.


Thanks,
J

jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Re: Command Line Client question

Post by jstarbird » Mon Dec 07, 2009 3:48 pm

Beth,
I realized that your examples were File Diff's while I am looking to do a Folder Diff. Upon looking further at Diff Merge I found it doesn't seem to support doing a Folder Diff on the command line or rather outputting the diff to a file, is this correct or am I just missing something?
If not then Diff Merge won't work for me at all as I do need to be able to do this.

Thanks,
J

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

Re: Command Line Client question

Post by jeffhostetler » Mon Dec 07, 2009 6:04 pm

RIght, DiffMerge doesn't currently have a "compare 2 folders and report to a file" mode.
You can open a folder window and save the differences to a CSV, but currently there's
no way to get it to do the folder comparision without a window. Sorry.

I want/need to add this feature.

In the mean time, if you have cygwin installed, you can use gnu-diff to compare 2 folders.
I don't remember the args right now, but when given 2 folders, it will print "only in..." messages
for the peerless files and then either display the file diffs or give a summary for each matching
pair.

Hope that helps,

jeff

15127

jstarbird
Posts: 146
Joined: Wed Jul 22, 2009 11:49 am

Re: Command Line Client question

Post by jstarbird » Mon Dec 07, 2009 6:57 pm

I have worked it out using a 3rd party program but yes that would be a good feature for Diff Merge/Vault.
Thanks for the info.


J

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command Line Client question

Post by Beth » Tue Dec 08, 2009 10:57 am

Thank you for your feedback.
Beth Kieler
SourceGear Technical Support

Post Reply