Hi, I'm using C#.Net 2003, Vault version 3.0.4 and API version 3.0.7
I've written some code to Check Files Out & In based on a folder in a repository. The problem I have is when I check the code back in and add a comment all the files whether or not they have been modified are being labeled and listed in the Folder history. This does not happen if I use the Windows Vault application as that only labels changed files. Is it possible to work out if a file has been changed in the API?
Code I'm using.
ChangeSetItemColl oSetItemColl = null;
foreach (ChangeSetItem oChangeSetItem in ClientInstance.InternalChangeSet_GetItem(false))
{
oChangeSetItem.Comment = "Checked in ";
oSetItemColl.Add(oChangeSetItem);
}
ClientInstance.Commit(oSetItemColl, false, false);
Everything else works fine
Thanks
API Checked in Files - Label only if modified
Moderator: SourceGear
I'll address one thing first. I recommend changing the code to:
Does that convince the API to not check in unchanged files?
Code: Select all
ClientInstance.InternalChangeSet_SetComment("Checked in");
ClientInstance.Commit();
Thanks for the reply by sadly it didn't work.
All I'm doing is:-
//Test Folder Contains 3 files (2 gif, 1 text)
ClientInst.CheckOut(ClientFolder, true, VaultLib.VaultCheckOutType.Exclusive, null);
ClientInst.Get(ClientFolder, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
ClientInst.Refresh();
//Amend text file
ClientInst.InternalChangeSet_SetComment("Checked in 14Dec");
ClientInst.Commit();
Even though I have only amended one file it still checks in all the files and increments their version number.
All I'm doing is:-
//Test Folder Contains 3 files (2 gif, 1 text)
ClientInst.CheckOut(ClientFolder, true, VaultLib.VaultCheckOutType.Exclusive, null);
ClientInst.Get(ClientFolder, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
ClientInst.Refresh();
//Amend text file
ClientInst.InternalChangeSet_SetComment("Checked in 14Dec");
ClientInst.Commit();
Even though I have only amended one file it still checks in all the files and increments their version number.
Going back to your original code:
Code: Select all
foreach (ChangeSetItem oChangeSetItem in ClientInstance.InternalChangeSet_GetItem(false))
{
if (! (item is ChangeSetItem_Unmodified))
{
oChangeSetItem.Comment = "Checked in ";
oSetItemColl.Add(oChangeSetItem);
}
ClientInstance.Commit(oSetItemColl, false, false);