Get Latest Version with NAnt
Moderator: SourceGear
Get Latest Version with NAnt
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.
I'm using Vault 3.1.6.3658 with NAnt 0.85.1932.0.
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."
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
SourceGear
Technical Support Manager
-
- Posts: 40
- Joined: Thu Apr 06, 2006 10:33 pm
-
- Posts: 40
- Joined: Thu Apr 06, 2006 10:33 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
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
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.
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.
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.
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
SourceGear
-
- Posts: 40
- Joined: Thu Apr 06, 2006 10:33 pm