Hi!
I am adapting an application we use for building automated setups from VSS to SGV.
The application used to do the following steps:
Get the complete Base Directory
Compile with MsBuild
Add some files not in SourceSafe
CHECKOUT the directory where the setup is built (installshield)
Build the setup
CHECKIN the directory where the setup is built.
The working directory is NOT the directory where the SetupBuilder checks out to.
I have managed to get it all up and running, except for the checkin part.
I can see the files checked out to the Installshield Dir (the files show up as missing in Vault client)
If I try to get the changes via InternalChangeSet_GetItems I do get an empty set.
If I try to commit in VaultClient I also get an empty set.
HOW can I checkin a file from a folder other than the working folder?
Can I set the working folder for the client for the time I checkout, build and checkin, and revert to the old setting afterwards?
Thanks for your help!
Andreas Kroll
Checkin or Commit from folder other than working folder
Moderator: SourceGear
You can't checkin a file that's not in the working folder. But you can use the Vault Command Line Client to reset the working folder before and after the build. The command is SETWORKINGFOLDER. For Vault CLC help, cd to the Vault GUI Client directory and type "vault help setworkingfolder," or if you're using Vault 3.1, type "vault helphtml" for an html version.
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
Checkin or Commit from folder other than working folder
Hi!
Thanks for the quick answer.
I looked at the example code in the command "SETWORKINGFOLDER" and tried to duplicate what is done there.
I get a different result than before, but still not what I want.
I checkout the files with the following code:
files is a collection of files I collected by using
The files get all checked out in the right location.
After performing the installshield action I use the following code to checkin the changes:
The InternalChangeSet_GetItems does return a collection of 1 element.
There are definately more than 1 changes made (I can see that with VaultClient.
How can I set workingfolder for an actual folder and its subfolders? Do I have to recurse down manually and set it for each folder and file?
In the VaultClient you can set a checkbox to force working folder for child elements. Is there some option in the API to do so?
Thanks in advance for your help on this.
Andreas Kroll
Thanks for the quick answer.
I looked at the example code in the command "SETWORKINGFOLDER" and tried to duplicate what is done there.
I get a different result than before, but still not what I want.
I checkout the files with the following code:
Code: Select all
vriResponses = _SGVClient.CheckOut(files, VaultCheckOutType.Exclusive, Comment);
if (vriResponses == null)
{
throw new Exception(string.Format("The checkout on {0} did not return a response.", reposItem));
}
// Get the items that were checked out.
_SGVClient.GetToNonWorkingFolder(files, false, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.CheckIn, ParentPath, TargetDir, null);
Code: Select all
theFiles.AddRange(vcfolder.Files);
if (Recursive)
{
foreach (VaultClientFolder subfolder1 in vcfolder.Folders)
subfolder1.GetFilesRecursive(ref theFiles, _SGVClient.TreeCache.Cloaks);
}
After performing the installshield action I use the following code to checkin the changes:
Code: Select all
WorkingFolder workingFolder = _SGVClient.GetWorkingFolder(vcfolder);
_SGVClient.TreeCache.SetWorkingFolder(vcfolder.FullPath, TargetDir);
ChangeSetItemColl csic = _SGVClient.InternalChangeSet_GetItems(true);
// remove unchanged files here (code removed)
// set the comment
_SGVClient.InternalChangeSet_SetComment(Comment);
// remove any change set items which will not be committed
// with the changeset.
for (int i = 0; i < csiRemove.Count; i++)
{
csic.Remove(csiRemove[i]);
}
// commit the transaction
bRet = _SGVClient.Commit(csic, false /*_args.KeepCheckedOut*/, false);
if ((bRet == true) && (vcfcUndoCheckouts.Count > 0))
{
// the commit was successful, now undo checkouts.
_SGVClient.UndoCheckOut((VaultClientFile[])vcfcUndoCheckouts.ToArray(typeof(VaultClientFile)), LocalCopyType.Leave);
}
There are definately more than 1 changes made (I can see that with VaultClient.
How can I set workingfolder for an actual folder and its subfolders? Do I have to recurse down manually and set it for each folder and file?
In the VaultClient you can set a checkbox to force working folder for child elements. Is there some option in the API to do so?
Thanks in advance for your help on this.
Andreas Kroll
Checkin or Commit from folder other than working folder
Hi!
I'd rather doubt that setting the working folder before checkout makes any difference.
The reason I am doubting that is, that the changes I made are sufficient to commit changes via VaultClient, and VaultClient does also show > 20 files modified, which are abe to be checked in.
I am not shure why I do only get one change back.
Is there any other option I could test / use?
Sincerely,
Andreas Kroll
I'd rather doubt that setting the working folder before checkout makes any difference.
The reason I am doubting that is, that the changes I made are sufficient to commit changes via VaultClient, and VaultClient does also show > 20 files modified, which are abe to be checked in.
I am not shure why I do only get one change back.
Is there any other option I could test / use?
Sincerely,
Andreas Kroll
Sorry to not reply, this scrolled off my list.
Vault can only checkin from the currently set working folder, so you'll need to find a way to change the working folder to the place where you check in from.
One problem here might be that you are doing a Get to a non-working folder, which doesn't update Vault state information, so Vault doesn't know which version of the file you have retrieved. It can try to guess if you do another Get after setting the working folder, but all files that have been edited will have a Needs Merge state, and you can't check those in until you've resolved the merge.
The order you should look at doing this is:
Set working folder (this applies only to the current user)
Get to working folder
Checkin from working folder
(optionally, reset working folder to where you permanently want it)
If this is a script, you could also simply copy the files that have been edited elsewhere into the permanent working folder and just check them in from there.
Hope this helps
Vault can only checkin from the currently set working folder, so you'll need to find a way to change the working folder to the place where you check in from.
One problem here might be that you are doing a Get to a non-working folder, which doesn't update Vault state information, so Vault doesn't know which version of the file you have retrieved. It can try to guess if you do another Get after setting the working folder, but all files that have been edited will have a Needs Merge state, and you can't check those in until you've resolved the merge.
The order you should look at doing this is:
Set working folder (this applies only to the current user)
Get to working folder
Checkin from working folder
(optionally, reset working folder to where you permanently want it)
If this is a script, you could also simply copy the files that have been edited elsewhere into the permanent working folder and just check them in from there.
Hope this helps