Detecting Modified Files From Command Line
Detecting Modified Files From Command Line
I'm trying to backup and keep a history of my cruise control configuration to vault. I want to edit files on the cruise control machine and have a scheduled script run which detects additions/changes and commits them to vault.
I am having trouble figuring out how to detect modified files (like the Gui does). By default, there are no files in the command line changeset (LISTCHANGESET) despite files having been modified.
How do I go about implementing this solution?
I am having trouble figuring out how to detect modified files (like the Gui does). By default, there are no files in the command line changeset (LISTCHANGESET) despite files having been modified.
How do I go about implementing this solution?
Re: Detecting Modified Files From Command Line
Do you have a Vault GUI client installed on that machine or only the command-line client (CLC)? If so, login as the user that will be used in the CLC script. Then go to Tools - Options - Concurrent Development Style and set it to use CVS mode. Then perform a Get on the files so that the read-only flag is changed on the files.
Do you have a working folder set that points to the files you want tracked? A working folder needs to be set to detect changes, even when using the CLC.
Do you have a working folder set that points to the files you want tracked? A working folder needs to be set to detect changes, even when using the CLC.
Beth Kieler
SourceGear Technical Support
SourceGear Technical Support
Re: Detecting Modified Files From Command Line
Thank you for your response. That worked.
I set the working folder using the CLC and set the Concurrent Development Style to CVS using the GUI.
Do you know of a simple way to recognize if a new file exists and add it to the changeset?
I set the working folder using the CLC and set the Concurrent Development Style to CVS using the GUI.
Do you know of a simple way to recognize if a new file exists and add it to the changeset?
Re: Detecting Modified Files From Command Line
There isn't a way to detect if new files are added to a folder using the command-line client. That is a feature that is in the Vault GUI client with the Detect Files to Add, and in Visual Studio, new files added to a project will be pended as an add to Vault.
Beth Kieler
SourceGear Technical Support
SourceGear Technical Support
Re: Detecting Modified Files From Command Line
Is this something that could be done with the Vault Client API?
Would it be a reasonable approach to write an algorithm to reconcile the ouput of LISTFOLDER with the directory's files?
Thank you. I really appreciate your help.
Would it be a reasonable approach to write an algorithm to reconcile the ouput of LISTFOLDER with the directory's files?
Thank you. I really appreciate your help.
Re: Detecting Modified Files From Command Line
You could write a script that incorporates some other scripting along with the Vault command line client. For example, a quick Google search found a little script here, http://www.computing.net/answers/window ... 71031.html, that is supposed to detect new files on disk. You might then have some variables or array, or whatever you prefer to use, save the file names and/or paths that were found and use those in the lines of the script that will call Vault and add those files.
The Vault API could probably be used as well, but I'm not sure we have a detect function in the API. I'll have to do some more looking into that.
The Vault API could probably be used as well, but I'm not sure we have a detect function in the API. I'll have to do some more looking into that.
Beth Kieler
SourceGear Technical Support
SourceGear Technical Support
Re: Detecting Modified Files From Command Line
As an alternate suggestion for the OP, have you considered instead of editing the file on the build server and having this detection happen, check out the file from Vault and edit it locally, then commit it back? You can setup a ccnet project that will watch for changes to the config and pull it down when changed. This is how I have a ccnet build that watch for changes to the file in Vault:
Code: Select all
<project name="CCNet.config - Configuration Update">
<workingDirectory>d:\BuildServer\</workingDirectory>
<artifactDirectory>d:\BuildServer\Artifacts</artifactDirectory>
<state type="state">
<directory>D:\BuildServer\State</directory>
</state>
<triggers>
<intervalTrigger name="continuous" seconds="30" initialSeconds="30" />
</triggers>
<sourcecontrol type="vaultproplugin" autoGetSource="true" applyLabel="false">
<username>yourBuildUser</username>
<password>buildUsersPassword</password>
<host>VaultHost</host>
<repository>YourRepo</repository>
<folder>$/build_config</folder> <!-- Where ever you keep the ccnet.config file -->
<ssl>true</ssl>
<useWorkingDirectory>false</useWorkingDirectory>
<workingDirectory>.</workingDirectory>
<deleteItemsThatAreNotInTheRepository>false</deleteItemsThatAreNotInTheRepository>
</sourcecontrol>
</project>
Re: Detecting Modified Files From Command Line
Thank you for the additional information.
Beth Kieler
SourceGear Technical Support
SourceGear Technical Support