SharpSVN:如何使用单个命令从存储库导出多个文件?

时间:2014-04-02 07:43:59

标签: svn sharpsvn

我使用SharpSVN API和.NET 4.0开发了一个应用程序,用户浏览并从SVN存储库中选择一些特定版本的文件。然后将文件逐个导出到临时文件夹中并压缩。

我正在为每个文件执行SvnClient.Export方法,它可能会很长,所以我想知道是否可以一次只调用SvnClient.Export方法,并将要导出的文件列表作为输入参数。

以下是我正在使用的代码示例:

            using (SvnClient client = new SvnClient())
            {
                foreach (RepoFileExplorer.RepositoryFile repositoryfile in repositoryfiles)
                {
                    string localfilename = System.IO.Path.Combine(localfolder, repositoryfile.Name);
                    try
                    {
                        SvnExportArgs args = new SvnExportArgs();
                        args.Revision = new SvnRevision(repositoryfile.RevisionNumber);
                        args.Overwrite = true;
                        args.ThrowOnError = true;
                        args.ThrowOnWarning = true;
                        SvnTarget target = new SvnUriTarget(repositoryfile.Uri);
                        client.Export(target, localfilename, args);
                    }
                    catch (Exception ex)
                    {
                        Message.InfoMessage("An error occurred while exporting the file " + repositoryfile.Path + ": " + ex.Message);
                        break;
                    }
                }
            }

谢谢

0 个答案:

没有答案
相关问题