特定のファイルとフォルダーを作成してローカルに配置した後、TFServer のさまざまな場所にアップロード/チェックインする必要があるため、しばらく TFS をいじっています。ワークスペースとすべてをマッピングしていますが、PendingChanges から一連の変更を取得していますが、必要な変更ではなく、必要な場所ではありません。チェックインのたびに、既にマップされている特定の場所にある特定のフォルダーまたはファイルでのみ作業したいので、この問題は本当に面倒です。参照用にコードの一部をここに貼り付けます。
using (TfsTeamProjectCollection collection = new TfsTeamProjectCollection(serverUri, _cred))
{
VersionControlServer versionControl = (VersionControlServer)collection.GetService(typeof(VersionControlServer));
string machineName = Environment.MachineName;
string currentUserName = Environment.UserName;
Workspace myWorkspace = versionControl.GetWorkspace(machineName, currentUserName);
// tried this from Stack but didn't work.
//PendingChange[] changes = myWorkspace.GetPendingChanges().Where(x => x.LocalOrServerFolder.Contains(localPath)).ToArray();
PendingChange[] changes = myWorkspace.GetPendingChanges();
if (changes.Length != 0)
{
foreach (PendingChange c in changes)
{
rt.Text += " path: " + c.LocalItem + ", change: " + PendingChange.GetLocalizedStringForChangeType(c.ChangeType) + "\n";
}
}
else
{
rt.Text += "This didn't work.";
}
}
基本的に、TFS クラスでフォルダーまたはファイルをスローし、ファイルまたはフォルダーが最新かどうか、または TFS に存在するかどうかを確認し、それに応じて動作させたいと考えています。問題を十分に説明できたことを願っています。