Detecting Modified Files From Command Line

If you are having a problem using Vault, post a message here.
Post Reply
khuggins
Posts: 3
Joined: Wed Apr 25, 2012 10:57 am

Detecting Modified Files From Command Line

Post by khuggins » Wed Apr 25, 2012 11:12 am

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?

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

Re: Detecting Modified Files From Command Line

Post by Beth » Wed Apr 25, 2012 12:53 pm

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.
Beth Kieler
SourceGear Technical Support

khuggins
Posts: 3
Joined: Wed Apr 25, 2012 10:57 am

Re: Detecting Modified Files From Command Line

Post by khuggins » Wed Apr 25, 2012 4:27 pm

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?

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

Re: Detecting Modified Files From Command Line

Post by Beth » Thu Apr 26, 2012 9:32 am

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

khuggins
Posts: 3
Joined: Wed Apr 25, 2012 10:57 am

Re: Detecting Modified Files From Command Line

Post by khuggins » Thu Apr 26, 2012 1:41 pm

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.

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

Re: Detecting Modified Files From Command Line

Post by Beth » Thu Apr 26, 2012 3:13 pm

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.
Beth Kieler
SourceGear Technical Support

ajj3085
Posts: 228
Joined: Thu Feb 16, 2006 11:39 am

Re: Detecting Modified Files From Command Line

Post by ajj3085 » Sun May 06, 2012 9:34 am

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>

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

Re: Detecting Modified Files From Command Line

Post by Beth » Tue May 08, 2012 12:16 pm

Thank you for the additional information.
Beth Kieler
SourceGear Technical Support

Post Reply