Пример #1
0
        public IEnumerable <SvnRepoInfo> GetRepoList(SvnRepositoryRequest request)
        {
            SetCredentials(request);

            try
            {
                using (var client = GetSvnClient())
                {
                    Collection <SvnListEventArgs> contents;
                    var repoList = new List <SvnRepoInfo>();
                    if (client.GetList(new Uri(_svnRootUrl), out contents))
                    {
                        repoList = contents.Select(content => new SvnRepoInfo
                        {
                            Name = content.Name,
                            Url  = content.Uri.AbsoluteUri
                        }).ToList();
                    }

                    return(repoList);
                }
            }
            catch (SvnRepositoryIOException ex)
            {
                throw new SvnMigrationException(ex.Message, ex);
            }
        }
Пример #2
0
        private void SetCredentials(SvnRepositoryRequest request)
        {
            if (string.IsNullOrEmpty(request.Password))
            {
                throw new SvnMigrationException("A SVN password wasn't provided");
            }
            if (string.IsNullOrEmpty(request.RootUrl))
            {
                throw new SvnMigrationException("A SVN Repository Url wasn't provided");
            }
            if (string.IsNullOrEmpty(request.Username))
            {
                throw new SvnMigrationException("A SVN Username wasn't provided");
            }

            _svnPassword = request.Password;
            _svnRootUrl  = request.RootUrl;
            _svnUsername = request.Username;
        }