3

perforce デポの選択したディレクトリに含まれるファイルの詳細をコンボ ボックスに入力するプログラムがあります。

関連するコードは次のとおりです。

PerforcePath dir = _ctlProductSelect.SelectedItem as PerforcePath;

_ctlServicePackSelect.Items.Clear();

if (dir != null)
{
    foreach (P4.File file in _perforce.GetFiles(null, P4.FileSpec.DepotSpec(dir.Path + "/*.sp")))
    {
       _ctlServicePackSelect.Items.Add(new PerforcePath(file.DepotPath.Path));
    }
}

問題は、これには削除済みとしてマークされたファイルも含まれていることです。メソッドによって返されたリストから削除されたファイルをフィルタリングする方法はありますGetFilesか? P4_dotNet API のドキュメントには、容疑者と思われるものは見つかりません。

4

3 に答える 3

1

P4API.NET を使用すると、次の-eオプションを追加できGetFilesます。


IList filesToFind = new List();
FileSpec fileToFind = new FileSpec(new DepotPath("//depot/..."), null, null, VersionSpec.Head);
filesToFind.Add(fileToFind);
Options o = new Options();
o.Add("-e", "");
IList filesFound = pRep.GetFiles(filesToFind, o);
于 2012-06-12T14:49:35.163 に答える
0
IList<FileSpec> filesToFind = new List<FileSpec>();
FileSpec fileToFind = new FileSpec(FileSpec.DepotSpec("//depot/...").DepotPath, Revision.Head);
filesToFind.Add(fileToFind);
Options o = new Options();

o.Add("-m", "changelistid");
IList<File> FilesFound = rep.GetFiles(filesToFind, o)
于 2013-03-15T08:03:18.853 に答える
0

私が最終的に機能したのは、これを foreach ループ内で行うことでした。

foreach (P4.File file in _perforce.GetFiles(null, P4.FileSpec.DepotSpec(dir.Path + "/*.sp")))
{
    if (_perforce.GetFileMetaData(null, file)[0].HeadAction.ToString() != "MoveDelete")
    _ctlServicePackSelect.Items.Add(new PerforcePath(file.DepotPath.Path));
}

基本的に、コンボボックスに追加する前に各ファイルのメタデータをチェックします。

于 2012-06-14T14:32:27.227 に答える