我需要构建一些与P4V中的treeview非常相似的树视图,其中列出了挂起的变更列表;
我可以将挂起的变更列表添加到treeview中,如果我使用GetFileName(),可以添加子节点,但是我想要文件的LocalPath,如果我尝试它,就可以得到"Object reference not set to an instance of object".
IList<Changelist> lista;
Options opcoes = new Options(ChangesCmdFlags.FullDescription, con.Cliente.Name, 100, ChangeListStatus.Pending, con.Usuario);
lista = new List<Changelist>();
lista = con.Repositorio.GetChangelists(opcoes);
for (int i = 0; i < lista.Count; i++ )
{
Changelist change = new Changelist();
TreeNode node = new TreeNode();
change = lista[i];
change.initialize(con.conexao);
node = tre.Nodes.Add(change.Id.ToString());
FileSpec arquivoSpec = new FileSpec(new LocalPath(PathSpec.UnescapePath("")), Revision.Have);
for (int arquivoAtual = 0; arquivoAtual < change.Files.Count; arquivoAtual++)
{
node.Nodes.Add(change.Files[arquivoAtual].LocalPath.Path);
}
}任何帮助都将不胜感激。
发布于 2014-01-15 05:47:37
您将希望使用Repository.GetFileMetaData(),将GetFileMetaDataOptions()的'byChangelist‘设置为挂起的更改,并将'GetFileMetaDataCmdFlag’设置为‘GetFileMetaDataOptions’和'LocalPath‘。以下是相关文档的链接:
1.htm
ctor.htm
我怀疑调用'p4描述‘的方法没有得到本地路径。GetFileMetaData()调用'p4 fstat‘。
https://stackoverflow.com/questions/19983715
复制相似问题