Get Latest Version with NAnt

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
robinz
Posts: 20
Joined: Wed Mar 15, 2006 3:31 pm
Location: Oklahoma, USA
Contact:

Get Latest Version with NAnt

Post by robinz » Wed May 24, 2006 10:59 am

I have playing around with NAnt build scripts. When I use vaultgetfile it gets latest version, regardless of if the file is checked out our not. This is great for a build server, but I'm trying to use it on a developer box as well and it keeps overwriting files that are checked out. How do I keep it from doing that?

I'm using Vault 3.1.6.3658 with NAnt 0.85.1932.0.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Wed May 24, 2006 3:28 pm

I don't think you can. I'm not the NAnt guru here, but just in normal Vault operations, when you do a Get Latest, Vault does not skip files that have been checked out.

We do have a feature logged to skip files that are checked out and modified. I'll add your "vote."
Linda Bauer
SourceGear
Technical Support Manager

mitch.wheat
Posts: 40
Joined: Thu Apr 06, 2006 10:33 pm

Post by mitch.wheat » Wed Jun 07, 2006 7:28 pm

Hi Linda

Please add my vote as well. Had I not seen this post, I would have been extremely embarassed explaining why the SCC tool I recommended to a client is blowing away developer changes.

Will this be in the next release? If so, what's the timeframe?

Regards,
Mitch

mitch.wheat
Posts: 40
Joined: Thu Apr 06, 2006 10:33 pm

Post by mitch.wheat » Wed Jun 07, 2006 7:31 pm

This is not as Nant specific problem.

Are you saying that when I do a GetLatest from within Visual Studio it will erase any chnages in checked out files? I would hope it would do a merge!!!

Or were you just referring to GetLatest from the VaultClient? Once again, I would hope it 'smart' enough to auto-merge and alert where intervention is required?

Mitch

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Thu Jun 08, 2006 8:20 am

Vault only overwrites changed files if you tell it to, and even then, it makes a backup in an _sgbak folder by default, just in case.

The issue here isn't modified files, because on a Get Latest, you have the choice of overwriting them, not overwriting them, or merging the repository's latest changes into them, and that all works as expected.

The issue is that Get Latest doesn't treat checked out files specially if those checked out files are *not* modified. Some folks want Get Latest to completely ignore files that are checked out, regardless of what state they are in. For example, a file can be checked out, but have a status of Old, which means it hasn't been modified locally and a newer version has been checked in on the server.

Since the file isn't modified, the Get Latest option for what to do with modified files is ignored. So a Get Latest will overwrite the local file with the new file from the repository. No user work is lost, but the file is changed.

I hope this clarifies the issue. Let us know if you have any concerns.

ian_sg
Posts: 787
Joined: Wed May 04, 2005 10:55 am
Location: SourceGear
Contact:

Post by ian_sg » Thu Jun 08, 2006 9:48 am

Upon further investigation, Dan's answer isn't quite accurate where the NAnt tasks are concerned. The Nant getfile task does actually overwrite under any circumstances, which is arguably the correct behavior. (The standard GUI client, the command-line client, and the IDE-integrated client all attempt to merge, as you'd expect.)

A fix for this, meaning an option to change this default behavior, will be included with Vault 3.5.

The source code for the NAnt tasks is available on our public Vault server, http://vaultpub.sourcegear.com. When the fix is made it will be available immediately there.

NAnt is a build tool, and on a build you typically want the code from source control regardless of the state of the working folder. By this rationale the getfile task does the right thing. As an example, in our own build we modify resource files in the working directory on the build server to include the appropriate version numbers. These therefore have a status of "Modified" and therefore would not be overwritten. You don't want this in a build, you want that file overwritten.

If you're doing non-build-related vault work from a script, you'll be much better off using Vault's command-line client, as its defaults will be more sensible for this scenario.


Edit: added the stuff in italics to clarify our thinking and the behavior of the other (non-NAnt) Vault clients.
Ian Olsen
SourceGear

mitch.wheat
Posts: 40
Joined: Thu Apr 06, 2006 10:33 pm

Post by mitch.wheat » Fri Jun 09, 2006 10:00 pm

Thanks for the clarification Ian. I agree with your reasoning with regard to the build server usage, but I would rather it had failed on developer boxes rather than silently overwrite checked out files.

Look forward to the fix in 3.5

Locked