Select statement to return the last tran / vs id for folder
Moderator: SourceGear
Select statement to return the last tran / vs id for folder
Can you help me out here guys? I've written a little script that a developer runs whenever they want to update their machine with the latest in version control. This script then does a heap load of stuff taking the latest in vault and installing it on their machine.
At the moment this work is done regardless of whether what's in vault has changed since the last time the developer run the script so... I want to query a particular vault folder for its most recent tranid / versionid for that folder. I then compare this with the id the last time the script ran, if its different the script assumes something has changed and therefore does its full update on the developer's machine. Now, the next refinement to this query is to be a little more discriminating so that those tran's committed by the developer are excluded.
Can you give the appropriate select statement I need to execute that does the above?
Thanks in advance
Christian
At the moment this work is done regardless of whether what's in vault has changed since the last time the developer run the script so... I want to query a particular vault folder for its most recent tranid / versionid for that folder. I then compare this with the id the last time the script ran, if its different the script assumes something has changed and therefore does its full update on the developer's machine. Now, the next refinement to this query is to be a little more discriminating so that those tran's committed by the developer are excluded.
Can you give the appropriate select statement I need to execute that does the above?
Thanks in advance
Christian
Any progress on this? Sorry to push but I'd really like to get this query working tonight if possible. Much longer and the script that does the update on a development machine is going to fall into disuse 'cause it takes way to long to do a full update when an incremental update of those bits that's changed would suffice.
Thanks
Christian
Thanks
Christian
Hi Jeremy,
Been thinking about this query a bit more. I thought I was going to be excluding transactions that the developer had checked in to figure out whether his machine needs to be updated from vault. Then I thought, what happens if the developer checks in from another machine? The script would ignore this check-in and would assume that his current machine was all up to date (assuming nobody else has checked in).
So I don't think I can use this history command for what I'm trying to do. An alternative (I think) would be to do a diff against the working directory and what's in the repository. Ok, so I started looking at the DIFF command but I can't get things to work.
Here's the command line I tried:
vault.exe DIFF -user myuser -password mypassword -host myhost -repository ECICGenIns -compareto current "$/Mainline/Build/ecicDataAccess"
And I got this error:
<vault>
<error>
The Diff utility encountered an error during execution. Please verify the use o
f VAULTDIFF or the "diff" utility.
</error>
<exception>
System.Exception: The Diff utility encountered an error during execution. Pleas
e verify the use of VAULTDIFF or the "diff" utility.
at VaultCmdLineClient.VaultCmdLineClient.ProcessCommandDiff(String strArgDiff
Bin, String strArgDiffArgs, DiffAgainstType datDiffChoice, Boolean bRecursive, S
tring strLeft, String strLeftLbl, String strRight, String strRightLbl)
at VaultCmdLineClient.VaultCmdLineClient.ProcessCommand(Args curArg)
at VaultCmdLineClient.VaultCmdLineClient.Main(String[] args)
</exception>
<result success="no" />
</vault>
What am I doing wrong?
Thanks
Christian
Been thinking about this query a bit more. I thought I was going to be excluding transactions that the developer had checked in to figure out whether his machine needs to be updated from vault. Then I thought, what happens if the developer checks in from another machine? The script would ignore this check-in and would assume that his current machine was all up to date (assuming nobody else has checked in).
So I don't think I can use this history command for what I'm trying to do. An alternative (I think) would be to do a diff against the working directory and what's in the repository. Ok, so I started looking at the DIFF command but I can't get things to work.
Here's the command line I tried:
vault.exe DIFF -user myuser -password mypassword -host myhost -repository ECICGenIns -compareto current "$/Mainline/Build/ecicDataAccess"
And I got this error:
<vault>
<error>
The Diff utility encountered an error during execution. Please verify the use o
f VAULTDIFF or the "diff" utility.
</error>
<exception>
System.Exception: The Diff utility encountered an error during execution. Pleas
e verify the use of VAULTDIFF or the "diff" utility.
at VaultCmdLineClient.VaultCmdLineClient.ProcessCommandDiff(String strArgDiff
Bin, String strArgDiffArgs, DiffAgainstType datDiffChoice, Boolean bRecursive, S
tring strLeft, String strLeftLbl, String strRight, String strRightLbl)
at VaultCmdLineClient.VaultCmdLineClient.ProcessCommand(Args curArg)
at VaultCmdLineClient.VaultCmdLineClient.Main(String[] args)
</exception>
<result success="no" />
</vault>
What am I doing wrong?
Thanks
Christian
Christian,
I'm confused. If all you want is to update the Vault working folders with the latest code, then you should be able to use the GET command with no destpath and specify the -merge automerge parameter. This will only download the necessary files, and will merge in with any local changes where it needs to. This is exactly equivalent to doing a get with automerge from the GUI client.
The DIFF command only works if you specify the VAULTDIFF environment variable. The variable should point to the location of the diff tool you want to invoke.
I'm confused. If all you want is to update the Vault working folders with the latest code, then you should be able to use the GET command with no destpath and specify the -merge automerge parameter. This will only download the necessary files, and will merge in with any local changes where it needs to. This is exactly equivalent to doing a get with automerge from the GUI client.
The DIFF command only works if you specify the VAULTDIFF environment variable. The variable should point to the location of the diff tool you want to invoke.
Unfortunately, it not that simple. For example, each sql database is maintained as a series of DDL scripts, one for each database object. When a developer wants to update his development machine its not just a case of doing a Get on those scripts. Get is the first thing that happens but after that another tool is executed that takes those scripts and synchs the developer database. Now I only want to execute this tool if something has changed in vault as it takes about 2-3 minutes to run. So you see why I want to query first?jeremy_sg wrote: I'm confused. If all you want is to update the Vault working folders with the latest code, then you should be able to use the GET command with no destpath and specify the -merge automerge parameter. This will only download the necessary files, and will merge in with any local changes where it needs to. This is exactly equivalent to doing a get with automerge from the GUI client.
Ok, I already did that but it didn't take affect until a reboot. Now I've got it to run I'm disappointed as it just opens up the gui diff rather than give me an xml doc describing the difference. My script needs a report or status back from the command line that it can inspect programmatically, not a visual diff. Does Vault diff have a command line parameter to suppress the visual diff and hand back this xml or status code?jeremy_sg wrote: The DIFF command only works if you specify the VAULTDIFF environment variable. The variable should point to the location of the diff tool you want to invoke.
Thanks
Christian
Cool ideas. I particularly like the sound of the second one. I can then redirect the output to a text file, parse this to tell me whether something has changed? Please send me some instructions :-)jeremy_sg wrote:You could use the filetime to determine if the get operation overwrote the file. Also, if you need to, I could show you how to get the Command line client to ouput verbose logging about what files are downloaded during the get operation.
Christian
Jeremy,
Just found an undocumented command line switch for the GET command: -verbose
It looks as though this will tell me the files (if any) that are retrieved from Vault on a get. Looks to me I can parse this rather than having to parse a config file for gets. Is this the better way to go?
Thanks
Christian
Just found an undocumented command line switch for the GET command: -verbose
It looks as though this will tell me the files (if any) that are retrieved from Vault on a get. Looks to me I can parse this rather than having to parse a config file for gets. Is this the better way to go?
Thanks
Christian
Christian,
I was just looking at the command line client to add that, but it looks like someone beat me to it. I think that Darren Sargent deserves the credit for that contribution. I added it as an option to the Get, GetLabel, GetVersion, and GetWildCard help text, so after 3.0.3, it will no longer be undocumented.
I was just looking at the command line client to add that, but it looks like someone beat me to it. I think that Darren Sargent deserves the credit for that contribution. I added it as an option to the Get, GetLabel, GetVersion, and GetWildCard help text, so after 3.0.3, it will no longer be undocumented.