public void EfVariableRepositoryConstructorTest()
        {
            RepositoryConfig           variableRepositoryConfig = null; // TODO: 初始化为适当的值
            EfVariableDesignRepository target = new EfVariableDesignRepository(variableRepositoryConfig);

            Assert.Inconclusive("TODO: 实现用来验证目标的代码");
        }
Beispiel #2
0
        private bool ValidateCustomerReportedIssues(RepositoryConfig repositoryConfig, HtmlPageCreator emailBody)
        {
            TableCreator tc = new TableCreator("Customer reported issues");

            tc.DefineTableColumn("Title", TableCreator.Templates.Title);
            tc.DefineTableColumn("Labels", TableCreator.Templates.Labels);
            tc.DefineTableColumn("Author", TableCreator.Templates.Author);
            tc.DefineTableColumn("Assigned", TableCreator.Templates.Assigned);
            tc.DefineTableColumn("Issues Found", i => i.Note);

            List <ReportIssue> issuesWithNotes = new List <ReportIssue>();

            foreach (var issue in _gitHub.SearchForGitHubIssues(CreateQuery(repositoryConfig)))
            {
                if (!ValidateIssue(issue, out string issuesFound))
                {
                    issuesWithNotes.Add(new ReportIssue()
                    {
                        Issue = issue, Note = issuesFound
                    });
                    _log.LogWarning($"{issue.Number}: {issuesFound}");
                }
            }

            // order the issues by the list of issues they have.
            issuesWithNotes = issuesWithNotes.OrderBy(i => i.Note).ToList();

            emailBody.AddContent(tc.GetContent(issuesWithNotes));

            return(issuesWithNotes.Any());
        }
Beispiel #3
0
        /// <summary>
        ///     窗体初始化加载函数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FunctionTestFormLoad(object sender, EventArgs e)
        {
            //初始化实时数据库
            var config = new RepositoryConfig
            {
                DbNameOrConnectingString = Connectstring,
                DbType = DataBaseType.SqlCeConnectionFactory
            };

            //初始化变量字典
            _iVariableDesignRepository =
                new VariableDesignRepository(config);
            _iVariableDesignRepository.Load();

            //初始化变量报警
            _iAalarmDesignRepository = new AlarmDesignRepository(config);
            _iAalarmDesignRepository.Load();

            //初始化界面
            treeView_FunctionTest.LabelEdit = false;

            //初始化datagridView需要添加按钮的列
            AddButtonColumList.Add("报警变量");
            AddButtonColumList.Add("报警配置");
            AddButtonColumList.Add("报警组");
            _ContextMenuStrip = Cms_VariableGroup;
            RefreshTree();
        }
Beispiel #4
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     services.AddAutoMapper();
     RepositoryConfig.service(services);
     //services.AddTransient<Mapdemo, Mapdemo>();
 }
Beispiel #5
0
 public UnitOfWork(
     CuboContext context,
     IOptions <RepositoryConfig> config)
 {
     _context = context;
     _config  = config.Value;
 }
Beispiel #6
0
        ///<summary>
        ///Elimina un repositorio
        ///</summary>
        ///<param name="identifier">Identificador del repositorio</param>
        public bool RemoveRepositoryConfig(Guid identifier)
        {
            try
            {
                RepositoryConfig repositoryConfig = GetRepositoryConfigById(identifier);
                // List<ShapeConfig> shapes =
                if (repositoryConfig != null)
                {
                    if (repositoryConfig.ShapeConfig != null)
                    {
                        foreach (var shape in repositoryConfig.ShapeConfig)
                        {
                            _context.Entry(shape).State = EntityState.Deleted;
                        }
                    }

                    _context.Entry(repositoryConfig).State = EntityState.Deleted;
                    _context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #7
0
        private async Task <List <PullRequest> > GetPullRequests(RepositoryConfig repo)
        {
            var url = string.Format(
                BitbucketPRUrlTemplate,
                repo.TeamName,
                repo.RepoSlug);

            var request  = new HttpRequestMessage(HttpMethod.Get, url);
            var password = Crypto.DecryptString(repo.Password, SquidConfig.CryptoKey);
            var auth     = Base64.ToBase64(Encoding.UTF8, $"{repo.Username}:{password}");

            request.Headers.Add("Authorization", $"Basic {auth}");

            var response = await _client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                var prResponse = JsonConvert.DeserializeObject <PullRequestsResponse>(content);

                if (prResponse != null && prResponse.values != null)
                {
                    _logger.LogInformation($"Retrieved the pull requests of '{repo.RepoSlug}'.");
                    return(prResponse.values);
                }
            }

            var failure = await response.Content.ReadAsStringAsync();

            _logger.LogError($"Getting the pull requests of '{repo.RepoSlug}' failed. Error: {failure}.");

            return(null);
        }
Beispiel #8
0
        public FileResult ListRecords(Guid repositoryIdentifier, string metadataPrefix, string from = null, string until = null, string set = null, string resumptionToken = null)
        {
            RepositoryConfig repositoryConfig = _repositoriesConfigService.GetRepositoryConfigById(repositoryIdentifier);
            string           uri = repositoryConfig.Url;

            uri += $"?verb=ListRecords";
            if (metadataPrefix != null)
            {
                uri += $"&metadataPrefix={metadataPrefix}";
            }
            if (!string.IsNullOrEmpty(from))
            {
                uri += $"&from={from}";
            }
            if (!string.IsNullOrEmpty(until))
            {
                uri += $"&until={until}";
            }
            if (set != null)
            {
                uri += $"&set={set}";
            }
            if (resumptionToken != null)
            {
                uri += $"&resumptionToken={resumptionToken}";
            }
            //byte[] array = getByte(uri);
            byte[] array = _callOAIPMH.GetUri(uri);
            return(File(array, "application/xml"));
        }
Beispiel #9
0
        public FileResult ListRecords(Guid repositoryIdentifier, string metadataPrefix, DateTime?from = null, DateTime?until = null, string set = null, string resumptionToken = null)
        {
            RepositoryConfig repositoryConfig = _repositoriesConfigService.GetRepositoryConfigById(repositoryIdentifier);
            string           uri = repositoryConfig.Url;

            uri += $"?verb=ListRecords";
            if (metadataPrefix != null)
            {
                uri += $"&metadataPrefix={metadataPrefix}";
            }
            if (from.HasValue)
            {
                uri += $"&from={from.Value.ToString("u", CultureInfo.InvariantCulture)}";
            }
            if (until.HasValue)
            {
                uri += $"&until={until.Value.ToString("u", CultureInfo.InvariantCulture)}";
            }
            if (set != null)
            {
                uri += $"&set={set}";
            }
            if (resumptionToken != null)
            {
                uri += $"&resumptionToken={resumptionToken}";
            }
            byte[] array = getByte(uri);
            return(File(array, "application/xml"));
        }
        public void LoadTest()
        {
            RepositoryConfig           variableRepositoryConfig = null;                                   // TODO: 初始化为适当的值
            EfVariableDesignRepository target = new EfVariableDesignRepository(variableRepositoryConfig); // TODO: 初始化为适当的值

            target.Load();
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
        public IUnitOfWork CreateNew()
        {
            var repositoryConfig = new RepositoryConfig();

            ConfigureRepositories(repositoryConfig);

            return(new UnitOfWork(_factoryConfig.Connection, _factoryConfig.SupportTransaction, repositoryConfig));
        }
 private void ConfigureRepositories(RepositoryConfig repositoryConfig)
 {
     repositoryConfig
     .AddBind <IUserRepository, UserRepository>()
     .AddBind <IUserLoginRepository, UserLoginRepository>()
     .AddBind <IFriendRepository, FriendRepository>()
     .AddBind <IGameRepository, GameRepository>();
 }
 /// <summary>
 /// Update properties by setting fields from the configuration.
 /// <para />
 /// If a property is not defined in the configuration, then it is left
 /// unmodified.
 /// </summary>
 /// <param name="rc">Configuration to read properties from.</param>
 public void FromConfig(RepositoryConfig rc)
 {
     PackedGitOpenFiles  = rc.getInt("core", null, "packedgitopenfiles", PackedGitOpenFiles);
     PackedGitLimit      = rc.getLong("core", null, "packedgitlimit", PackedGitLimit);
     PackedGitWindowSize = rc.getInt("core", null, "packedgitwindowsize", PackedGitWindowSize);
     PackedGitMMAP       = rc.getBoolean("core", null, "packedgitmmap", PackedGitMMAP);
     DeltaBaseCacheLimit = rc.getInt("core", null, "deltabasecachelimit", DeltaBaseCacheLimit);
 }
Beispiel #14
0
        /// <summary>
        ///     构造函数
        /// </summary>
        /// <param name="config">仓库配置信息</param>
        public AlarmDesignRepository(RepositoryConfig config)
        {
            _iAlarmRepository = new AlarmRepository(config);

            //注册报警变量或者报警组修改时触发的事件
            AlarmBase.VerifyTheUniqueness  += AlarmBase_VerifyTheUniqueness;
            AlarmGroup.VerifyTheUniqueness += AlarmGroup_VerifyTheUniqueness;
        }
Beispiel #15
0
        /// <summary>
        /// 使用Dapper持久化
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static IServiceCollection AddDapper(this IServiceCollection services, Action <RepositoryConfig> configure)
        {
            var mysqlOptions = new RepositoryConfig();

            configure(mysqlOptions);
            services.AddSingleton(mysqlOptions);
            services.AddScoped(typeof(IRepository <>), typeof(DapperRepository <>));
            return(services);
        }
Beispiel #16
0
        public override void setUp()
        {
            base.setUp();
            RepositoryConfig config = db.Config;

            remoteConfig = new RemoteConfig(config, "test");
            remoteConfig.AddURI(new URIish("http://everyones.loves.git/u/2"));
            transport = null;
        }
Beispiel #17
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            RepositoryConfig.Configure(
                configuration.GetValue <string>("MerchantHost"),
                configuration.GetValue <string>("ApiKey")
                );
        }
        public void RemoveGroupTest()
        {
            RepositoryConfig           variableRepositoryConfig = null;                                   // TODO: 初始化为适当的值
            EfVariableDesignRepository target = new EfVariableDesignRepository(variableRepositoryConfig); // TODO: 初始化为适当的值
            string absolutePath = string.Empty;                                                           // TODO: 初始化为适当的值

            target.RemoveGroup(absolutePath);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
Beispiel #19
0
        private IEnumerable <RepositoryConfig> ParseRepositories(string repositories)
        {
            string[] repos = repositories.Split(';');

            foreach (var repo in repos)
            {
                yield return(RepositoryConfig.Create(repo));
            }
        }
Beispiel #20
0
        public FileResult Identify(Guid repositoryIdentifier)
        {
            RepositoryConfig repositoryConfig = _repositoriesConfigService.GetRepositoryConfigById(repositoryIdentifier);
            string           uri = repositoryConfig.Url;

            uri += $"?verb=Identify";
            byte[] array = getByte(uri);
            return(File(array, "application/xml"));
        }
Beispiel #21
0
        public FileResult GetRecord(Guid repositoryIdentifier, string identifier, string metadataPrefix)
        {
            RepositoryConfig repositoryConfig = _repositoriesConfigService.GetRepositoryConfigById(repositoryIdentifier);
            string           uri = repositoryConfig.Url;

            uri += $"?verb=GetRecord&identifier={identifier}&metadataPrefix={metadataPrefix}";
            byte[] array = getByte(uri);
            return(File(array, "application/xml"));
        }
        public void DeleteConfigRepository()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            RepositoryConfig repositoryConfig = ((List <RepositoryConfig>)(((OkObjectResult)repositoryController.GetRepository()).Value))[0];

            repositoryController.DeleteRepository(repositoryConfig.RepositoryConfigID);
            repositoryConfig = (RepositoryConfig)(((OkObjectResult)repositoryController.GetRepository(repositoryConfig.RepositoryConfigID)).Value);
            Assert.Null(repositoryConfig);
        }
Beispiel #23
0
        public FileResult GetRecord(Guid repositoryIdentifier, string identifier, string metadataPrefix)
        {
            RepositoryConfig repositoryConfig = _repositoriesConfigService.GetRepositoryConfigById(repositoryIdentifier);
            string           uri = repositoryConfig.Url;

            uri += $"?verb=GetRecord&identifier={System.Web.HttpUtility.UrlEncode(identifier)}&metadataPrefix={metadataPrefix}";
            byte[] array = _callOAIPMH.GetUri(uri);
            //byte[] array = getByte(uri);
            return(File(array, "application/xml"));
        }
Beispiel #24
0
        private async Task <List <PackageDependency> > GetDependencies(RepositoryConfig repo)
        {
            var url = string.Format(
                BitbucketUrlTemplate,
                repo.TeamName,
                repo.RepoSlug,
                repo.Branch,
                repo.ProjectFile);

            var request  = new HttpRequestMessage(HttpMethod.Get, url);
            var password = Crypto.DecryptString(repo.Password, SquidConfig.CryptoKey);
            var auth     = Base64.ToBase64(Encoding.UTF8, $"{repo.Username}:{password}");

            request.Headers.Add("Authorization", $"Basic {auth}");

            var response = await _client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                XDocument projectFile = XDocument.Parse(content);
                List <PackageDependency> dependencies = projectFile.Root
                                                        .Elements("ItemGroup")
                                                        .Elements("PackageReference")
                                                        .Select(x => new PackageDependency
                {
                    PackageId = (string)x.Attribute("Include"),
                    Version   = (string)x.Attribute("Version")
                })
                                                        .Where(x => !string.IsNullOrWhiteSpace(x.PackageId) && !string.IsNullOrWhiteSpace(x.Version))
                                                        .ToList <PackageDependency>();

                if (!repo.Valid)
                {
                    repo.ErrorMessage = null;
                    repo.Valid        = true;

                    await _repo.Update(repo);
                }

                return(dependencies);
            }
            else
            {
                var content = await response.Content.ReadAsStringAsync();

                repo.ErrorMessage = content;
                repo.Valid        = false;

                await _repo.Update(repo);

                return(null);
            }
        }
Beispiel #25
0
        public void test005_ReadSimpleConfig()
        {
            RepositoryConfig c = db.Config;

            Assert.IsNotNull(c);
            Assert.AreEqual("0", c.getString("core", null, "repositoryformatversion"));
            Assert.AreEqual("0", c.getString("CoRe", null, "REPOSITORYFoRmAtVeRsIoN"));
            Assert.AreEqual("true", c.getString("core", null, "filemode"));
            Assert.AreEqual("true", c.getString("cOrE", null, "fIlEModE"));
            Assert.IsNull(c.getString("notavalue", null, "reallyNotAValue"));
        }
 public PortfolioController(IConfiguration configuration)
 {
     ProviderConfig = new RepositoryConfig()
     {
         Local              = bool.Parse(configuration["AWS:Local"]),
         DynamoDBURL        = configuration["AWS:DynamoDBURL"],
         AwsAccessKeyId     = configuration["AWS:AccessKeyId"],
         AwsSecretAccessKey = configuration["AWS:SecretAccessKey"],
         RegionEndpoint     = Amazon.RegionEndpoint.USWest2 // TODO: Include this configuration in AppSettings
     };
 }
Beispiel #27
0
        ///<summary>
        ///Añade un repositorio
        ///</summary>
        ///<param name="repositoryConfig">Repositorio a añadir</param>
        public Guid AddRepositoryConfig(RepositoryConfig repositoryConfig)
        {
            Guid repositoryConfigID = Guid.Empty;

            //if (GetRepositoryConfigByName(repositoryConfig.Name) == null)
            //{
            repositoryConfigID = Guid.NewGuid();
            repositoryConfig.RepositoryConfigID = repositoryConfigID;
            _configRepositories.Add(repositoryConfig);
            //}
            return(repositoryConfigID);
        }
Beispiel #28
0
        public async Task Execute(
            RepositoryConfig repo,
            List <Update> updates,
            string reviewer)
        {
            _logger.LogTrace($"Updating dependencies of {repo.RepoSlug}");

            await UpdateDependencies(
                repo,
                updates,
                reviewer);
        }
Beispiel #29
0
        public void ConfigureServices(IServiceCollection services)
        {
            RepositoryConfig.Config(services);
            ServiceConfig.Config(services);
            AppServiceConfig.Config(services);

            services.AddControllersWithViews();
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }
        public void AddVariableTest()
        {
            RepositoryConfig           variableRepositoryConfig = null;                                   // TODO: 初始化为适当的值
            EfVariableDesignRepository target = new EfVariableDesignRepository(variableRepositoryConfig); // TODO: 初始化为适当的值
            VariableBase variable             = null;                                                     // TODO: 初始化为适当的值
            VariableBase expected             = null;                                                     // TODO: 初始化为适当的值
            VariableBase actual;

            actual = target.AddVariable(variable);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Beispiel #31
0
        /**
         * Parse all remote blocks in an existing configuration file, looking for
         * remotes configuration.
         *
         * @param rc
         *            the existing configuration to get the remote settings from.
         *            The configuration must already be loaded into memory.
         * @return all remotes configurations existing in provided repository
         *         configuration. Returned configurations are ordered
         *         lexicographically by names.
         * @throws URISyntaxException
         *             one of the URIs within the remote's configuration is invalid.
         */
        public static List<RemoteConfig> getAllRemoteConfigs(RepositoryConfig rc)
        {
            List<string> names = new List<string>(rc.GetSubsections(SECTION));
            names.Sort();

            List<RemoteConfig> result = new List<RemoteConfig>(names.Count);
            foreach (string name in names)
            {
                result.Add(new RemoteConfig(rc, name));
            }
            return result;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        /// <param name="options"></param>
        public RavenStorage(RepositoryConfig config, RavenStorageOptions options)
        {
            options.ThrowIfNull("options");

            _options = options;
            _repository = new Repository(config);

            _repository.ExecuteIndexes(new List<AbstractIndexCreationTask>()
            {
                new Hangfire_RavenJobs()
            });

            InitializeQueueProviders();
        }
Beispiel #33
0
        public void Update(RepositoryConfig rc)
        {
            List<string> vlst = new List<string>();

            vlst.Clear();
            foreach (URIish u in URIs)
            {
                vlst.Add(u.ToPrivateString());
            }
            rc.SetStringList(SECTION, Name, KEY_URL, vlst);

            vlst.Clear();
            foreach (RefSpec u in Fetch)
                vlst.Add(u.ToString());
            rc.SetStringList(SECTION, Name, KEY_FETCH, vlst);

            vlst.Clear();
            foreach (RefSpec u in Push)
                vlst.Add(u.ToString());
            rc.SetStringList(SECTION, Name, KEY_PUSH, vlst);

            set(rc, KEY_UPLOADPACK, UploadPack, DEFAULT_UPLOAD_PACK);
            set(rc, KEY_RECEIVEPACK, ReceivePack, DEFAULT_RECEIVE_PACK);
            set(rc, KEY_TAGOPT, TagOpt.Option, TagOpt.AUTO_FOLLOW.Option);
            set(rc, KEY_MIRROR, Mirror, DEFAULT_MIRROR);
        }
Beispiel #34
0
        public virtual void setUp()
        {
            Configure();

            string name = GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name;

            // Cleanup old failed stuff
            recursiveDelete(new DirectoryInfo(trashParent.FullName), true, name, false);

            trash = new DirectoryInfo(trashParent + "/trash" + DateTime.Now.Ticks + "." + (_testcount++));
            trash_git = new DirectoryInfo(trash + "/.git");

            var gitConfigFile = new FileInfo(trash_git + "/usergitconfig").FullName;
            var gitConfig = new RepositoryConfig(null, new FileInfo(gitConfigFile));

            SystemReader.setUserGitConfig(gitConfig);

            db = new Repository(trash_git);
            db.Create();

            string[] packs = {
                "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f",
                "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371",
                "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745",
                "pack-546ff360fe3488adb20860ce3436a2d6373d2796",
                "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa",
                "pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12"
            };

            var packDir = new DirectoryInfo(db.ObjectsDirectory + "/pack");

            foreach (var packname in packs)
            {
                new FileInfo("Resources/" + GitSharp.Transport.IndexPack.GetPackFileName(packname)).CopyTo(packDir + "/" + GitSharp.Transport.IndexPack.GetPackFileName(packname), true);
                new FileInfo("Resources/" + GitSharp.Transport.IndexPack.GetIndexFileName(packname)).CopyTo(packDir + "/" + GitSharp.Transport.IndexPack.GetIndexFileName(packname), true);
            }

            new FileInfo("Resources/packed-refs").CopyTo(trash_git.FullName + "/packed-refs", true);

            // Read fake user configuration values
            SystemReader.Values.Clear();
            SystemReader.Values[Constants.OS_USER_NAME_KEY] = Constants.OS_USER_NAME_KEY;
            SystemReader.Values[Constants.GIT_AUTHOR_NAME_KEY] = Constants.GIT_AUTHOR_NAME_KEY;
            SystemReader.Values[Constants.GIT_AUTHOR_EMAIL_KEY] = Constants.GIT_AUTHOR_EMAIL_KEY;
            SystemReader.Values[Constants.GIT_COMMITTER_NAME_KEY] = Constants.GIT_COMMITTER_NAME_KEY;
            SystemReader.Values[Constants.GIT_COMMITTER_EMAIL_KEY] = Constants.GIT_COMMITTER_EMAIL_KEY;
        }
Beispiel #35
0
 public void setUserGitConfig(RepositoryConfig userGitConfig)
 {
     _userGitConfig = userGitConfig;
 }
Beispiel #36
0
        public void Update(RepositoryConfig rc)
        {
            var vlst = new List<string>();

            vlst.Clear();
            foreach (URIish u in URIs)
            {
                vlst.Add(u.ToPrivateString());
            }
            rc.setStringList(Section, Name, KeyUrl, vlst);

            vlst.Clear();
            foreach (URIish u in PushURIs)
                vlst.Add(u.ToPrivateString());
            rc.setStringList(Section, Name, KeyPushurl, vlst);

            vlst.Clear();
            foreach (RefSpec u in Fetch)
            {
                vlst.Add(u.ToString());
            }
            rc.setStringList(Section, Name, KeyFetch, vlst);

            vlst.Clear();
            foreach (RefSpec u in Push)
            {
                vlst.Add(u.ToString());
            }
            rc.setStringList(Section, Name, KeyPush, vlst);

            Set(rc, KeyUploadpack, UploadPack, DEFAULT_UPLOAD_PACK);
            Set(rc, KeyReceivepack, ReceivePack, DEFAULT_RECEIVE_PACK);
            Set(rc, KeyTagopt, TagOpt.Option, TagOpt.AUTO_FOLLOW.Option);
            Set(rc, KeyMirror, Mirror, DefaultMirror);
            Set(rc, KeyTimeout, Timeout, 0);
        }
Beispiel #37
0
        public RemoteConfig(RepositoryConfig rc, string remoteName)
        {
            Name = remoteName;

            string[] vlst;
            string val;

            vlst = rc.GetStringList(SECTION, Name, KEY_URL);
            URIs = new List<URIish>(vlst.Length);
            foreach (string s in vlst)
                URIs.Add(new URIish(s));

            vlst = rc.GetStringList(SECTION, Name, KEY_FETCH);
            Fetch = new List<RefSpec>(vlst.Length);
            foreach (string s in vlst)
                Fetch.Add(new RefSpec(s));

            vlst = rc.GetStringList(SECTION, Name, KEY_PUSH);
            Push = new List<RefSpec>(vlst.Length);
            foreach (string s in vlst)
                Push.Add(new RefSpec(s));

            val = rc.GetString(SECTION, Name, KEY_UPLOADPACK) ?? DEFAULT_UPLOAD_PACK;
            UploadPack = val;

            val = rc.GetString(SECTION, Name, KEY_RECEIVEPACK) ?? DEFAULT_RECEIVE_PACK;
            ReceivePack = val;

            val = rc.GetString(SECTION, Name, KEY_TAGOPT);
            TagOpt = TagOpt.fromOption(val);
            Mirror = rc.GetBoolean(SECTION, Name, KEY_MIRROR, DEFAULT_MIRROR);
        }
 public RavenStorage(RepositoryConfig config)
     : this(config, new RavenStorageOptions())
 {
 }
Beispiel #39
0
 private void set(RepositoryConfig rc, string key, string currentValue, string defaultValue)
 {
     if (defaultValue.Equals(currentValue))
         unset(rc, key);
     else
         rc.SetString(SECTION, Name, key, currentValue);
 }
Beispiel #40
0
 private void unset(RepositoryConfig rc, string key)
 {
     rc.UnsetString(SECTION, Name, key);
 }
Beispiel #41
0
 private void set(RepositoryConfig rc, string key, bool currentValue, bool defaultValue)
 {
     if (defaultValue == currentValue)
         unset(rc, key);
     else
         rc.SetBoolean(SECTION, Name, key, currentValue);
 }
Beispiel #42
0
		/// <summary>
		/// Parse all remote blocks in an existing configuration file, looking for
		/// remotes configuration.
		/// </summary>
		/// <param name="rc">
		/// The existing configuration to get the remote settings from.
		/// The configuration must already be loaded into memory.
		/// </param>
		/// <returns>
		/// All remotes configurations existing in provided repository
		/// configuration. Returned configurations are ordered
		/// lexicographically by names.
		/// </returns>
		public static List<RemoteConfig> GetAllRemoteConfigs(RepositoryConfig rc)
		{
			if (rc == null)
				throw new ArgumentNullException ("rc");
			var names = new List<string>(rc.getSubsections(Section));
			names.Sort();

			var result = new List<RemoteConfig>(names.Count);
			foreach (string name in names)
			{
				result.Add(new RemoteConfig(rc, name));
			}

			return result;
		}
 /// <summary>
 /// Update properties by setting fields from the configuration.
 /// <para />
 /// If a property is not defined in the configuration, then it is left
 /// unmodified.
 /// </summary>
 /// <param name="rc">Configuration to read properties from.</param>
 public void FromConfig(RepositoryConfig rc)
 {
     PackedGitOpenFiles = rc.getInt("core", null, "packedgitopenfiles", PackedGitOpenFiles);
     PackedGitLimit = rc.getInt("core", null, "packedgitlimit", PackedGitLimit);
     PackedGitWindowSize = rc.getInt("core", null, "packedgitwindowsize", PackedGitWindowSize);
     PackedGitMMAP = rc.getBoolean("core", null, "packedgitmmap", PackedGitMMAP);
     DeltaBaseCacheLimit = rc.getInt("core", null, "deltabasecachelimit", DeltaBaseCacheLimit);
 }