|
I'm trying to write a script for PDB source server indexing, and one of the things I need to do is generate a Veracity command to grab a file from a repo, at a particular changeset, to a file. It appears that 'vv cat' almost gets me there, but it always writes to stdout. Is there a way I can get it to write it to a specified file path? |
|
As for a vscript to help you, here is a rough example. We don't currently have a 'cat' api in the JavaScript API or an exact equivalent to do what you want, but this isn't too bad until we fix the other problem. This uses the code we use to fetch individual file versions that we use before launching one of the diff tools. Hope this helps.
Thank you, great stuff. I love vscript, just hard to discover the API without digging into the source. In the version of vscript I have (1.5.1) it looks like vscript skips over the first script argument. Running:
vscript -i one two
Then:
vscript> for(i in arguments){print(arguments[i])}
Prints:
two
Is this expected behavior? (Like how argv[0] is usually the program name)
(Feb 06 at 09:46)
jslutter
We've logged a bug for that. The first arg "one" is naming a 'scriptfile' that should be loaded. When the -i option is we're not throwing an error when the file doesn't exist.
(Feb 06 at 10:59)
Jeff Hostetler ♦♦
|
|
I just looked at the source of 'cat' (it'd be a while). And yes, it is hard-coded to splat the contents to stdout. I'll log a feature request to have an output file option and/or make it more friendly to output binary data. |
Having looked at the source code that I have (it is not recent, maybe from 1.5.0) it looks like you can not get cat to do anything but write to stdout. Which, on Windows, causes some file transformations to happen: 1) My Byte Order Mark at the start of the file gets munged 2) rn sequences are becoming rrn 3) An extra rn is at the end of the file
Unfortunately this means that the file is now different (in the eyes of Visual Studio) from what was used during build. I guess the hash of the file is stored in the PDB file.
Adding on to my question, can I make a script for vscript that would, like 'cat', but write the contents directly to a file? This would work for binary files then to right?
For a future version of Veracity can we get a "-o FILENAME" option for cat to dump it right to file instead of stdout?
Thanks again! We're in the process of adopting Veracity at work and it looks like we have Jenkins doing builds using Veracity as a source control provider, and we should soon have symbol/source server support for PDB files built from sources managed by Veracity.