当前位置: 首页>>代码示例>>C#>>正文


C# IRepository.Commit方法代码示例

本文整理汇总了C#中IRepository.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.Commit方法的具体用法?C# IRepository.Commit怎么用?C# IRepository.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRepository的用法示例。


在下文中一共展示了IRepository.Commit方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public void Load(string extraDataKey)
        {
            _dynamicExpressionQuery = ObjectFactory.GetInstance<IDynamicExpressionQuery>();
            _repository = ObjectFactory.GetNamedInstance<IRepository>("NoFiltersOrInterceptor");

            _securityDataService = ObjectFactory.GetInstance<ISecurityDataService>();

            _repository.Initialize();

            createUser();
            _repository.Commit();
        }
开发者ID:reharik,项目名称:MethodFitness,代码行数:12,代码来源:DataLoader.cs

示例2: SetUpSimpleDiffContext

        private static void SetUpSimpleDiffContext(IRepository repo)
        {
            var fullpath = Touch(repo.Info.WorkingDirectory, "file.txt", "hello\n");

            repo.Index.Stage(fullpath);
            repo.Commit("Initial commit", Constants.Signature, Constants.Signature);

            File.AppendAllText(fullpath, "world\n");

            repo.Index.Stage(fullpath);

            File.AppendAllText(fullpath, "!!!\n");
        }
开发者ID:AndersKroghDk,项目名称:libgit2sharp,代码行数:13,代码来源:DiffTreeToTargetFixture.cs

示例3: AddCommitToRepo

        private static Commit AddCommitToRepo(IRepository repo)
        {
            string relativeFilepath = "test.txt";
            Touch(repo.Info.WorkingDirectory, relativeFilepath, content);
            repo.Index.Stage(relativeFilepath);

            var ie = repo.Index[relativeFilepath];
            Assert.NotNull(ie);
            Assert.Equal("9daeafb9864cf43055ae93beb0afd6c7d144bfa4", ie.Id.Sha);

            var author = new Signature("nulltoken", "[email protected]", DateTimeOffset.Parse("Wed, Dec 14 2011 08:29:03 +0100"));
            var commit = repo.Commit("Initial commit", author, author);

            relativeFilepath = "big.txt";
            var zeros = new string('0', 32*1024 + 3);
            Touch(repo.Info.WorkingDirectory, relativeFilepath, zeros);
            repo.Index.Stage(relativeFilepath);

            ie = repo.Index[relativeFilepath];
            Assert.NotNull(ie);
            Assert.Equal("6518215c4274845a759cb498998fe696c42e3e0f", ie.Id.Sha);

            return commit;
        }
开发者ID:AndersKroghDk,项目名称:libgit2sharp,代码行数:24,代码来源:OdbBackendFixture.cs

示例4: AddFileCommitToRepo

        private Commit AddFileCommitToRepo(IRepository repository, string filename, string content = null)
        {
            Touch(repository.Info.WorkingDirectory, filename, content);

            repository.Index.Stage(filename);

            return repository.Commit("New commit", Constants.Signature, Constants.Signature);
        }
开发者ID:ethomson,项目名称:libgit2sharp,代码行数:8,代码来源:MergeFixture.cs

示例5: AddCommitToRepo

        private Commit AddCommitToRepo(IRepository repository)
        {
            string random = Path.GetRandomFileName();
            string filename = random + ".txt";

            Touch(repository.Info.WorkingDirectory, filename, random);

            Commands.Stage(repository, filename);

            return repository.Commit("New commit", Constants.Signature, Constants.Signature);
        }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:11,代码来源:PushFixture.cs

示例6: PopulateBasicRepository

        /// <summary>
        /// Helper method to populate a simple repository with
        /// a single file and two branches.
        /// </summary>
        /// <param name="repo">Repository to populate</param>
        private void PopulateBasicRepository(IRepository repo)
        {
            // Generate a .gitignore file.
            string gitIgnoreFilePath = Touch(repo.Info.WorkingDirectory, ".gitignore", "bin");
            repo.Stage(gitIgnoreFilePath);

            string fullPathFileA = Touch(repo.Info.WorkingDirectory, originalFilePath, originalFileContent);
            repo.Stage(fullPathFileA);

            repo.Commit("Initial commit", Constants.Signature, Constants.Signature);

            repo.CreateBranch(otherBranchName);
        }
开发者ID:nulltoken,项目名称:libgit2sharp,代码行数:18,代码来源:CheckoutFixture.cs

示例7: CommitFile

 public static Commit CommitFile(IRepository repo, string filePath, string comment)
 {
     repo.Stage(filePath);
     return repo.Commit(comment, SignatureNow(), SignatureNow());
 }
开发者ID:Cocotus,项目名称:GitReleaseNotes,代码行数:5,代码来源:TestGitRepoUtils.cs

示例8: Sync

        internal ChangeSet Sync(DropboxHandler.DropboxInfo deploymentInfo, string branch, ILogger logger, IRepository repository)
        {
            DropboxDeployInfo info = deploymentInfo.DeployInfo;

            _logger = logger;

            _successCount = 0;
            _fileCount = 0;
            _failedCount = 0;
            _retriedCount = 0;

            if (_settings.GetValue(CursorKey) != info.OldCursor)
            {
                throw new InvalidOperationException(Resources.Error_MismatchDropboxCursor);
            }

            if (!repository.IsEmpty())
            {
                // git checkout --force <branch>
                repository.ClearLock();
                repository.Update(branch);
            }

            ChangeSet changeSet;
            string message = null;
            try
            {
                using (_tracer.Step("Synch with Dropbox"))
                {
                    // Sync dropbox => repository directory
                    ApplyChanges(deploymentInfo);
                }

                message = String.Format(CultureInfo.CurrentCulture,
                            Resources.Dropbox_Synchronized,
                            deploymentInfo.DeployInfo.Deltas.Count());
            }
            catch (Exception)
            {
                message = String.Format(CultureInfo.CurrentCulture,
                            Resources.Dropbox_SynchronizedWithFailure,
                            _successCount,
                            deploymentInfo.DeployInfo.Deltas.Count(),
                            _failedCount);

                throw;
            }
            finally
            {
                _logger.Log(message);

                _logger.Log(String.Format("{0} downloaded files, {1} successful retries.", _fileCount, _retriedCount));

                _status.Open(deploymentInfo.TargetChangeset.Id).UpdateMessage(message);

                _status.Open(deploymentInfo.TargetChangeset.Id).UpdateProgress(String.Format(CultureInfo.CurrentCulture, Resources.Dropbox_Committing, _successCount));

                // Commit anyway even partial change
                changeSet = repository.Commit(message, String.Format("{0} <{1}>", info.UserName, info.Email));
            }

            // Save new dropboc cursor
            LogInfo("Update dropbox cursor");
            _settings.SetValue(CursorKey, info.NewCursor);

            return changeSet;
        }
开发者ID:bogdansa,项目名称:kudu,代码行数:67,代码来源:DropboxHelper.cs

示例9: Sync

        internal async Task<ChangeSet> Sync(DropboxInfo dropboxInfo, string branch, IRepository repository)
        {
            DropboxDeployInfo deployInfo = dropboxInfo.DeployInfo;

            ResetStats();

            if (_settings.GetValue(CursorKey) != deployInfo.OldCursor)
            {
                throw new InvalidOperationException(Resources.Error_MismatchDropboxCursor);
            }

            // initial sync, remove default content
            // for simplicity, we do it blindly whether or not in-place
            // given the end result is the same
            if (String.IsNullOrEmpty(deployInfo.OldCursor) && DeploymentHelper.IsDefaultWebRootContent(_environment.WebRootPath))
            {
                string hoststarthtml = Path.Combine(_environment.WebRootPath, Constants.HostingStartHtml);
                FileSystemHelpers.DeleteFileSafe(hoststarthtml);
            }

            if (!repository.IsEmpty())
            {
                // git checkout --force <branch>
                repository.Update(branch);
            }

            ChangeSet changeSet = null;
            string message = null;
            try
            {
                using (_tracer.Step("Sync with Dropbox"))
                {
                    if (dropboxInfo.OAuthVersion == 2)
                    {
                        // Fetch the deltas
                        await UpdateDropboxDeployInfo(deployInfo);
                    }

                    // Sync dropbox => repository directory
                    await ApplyChanges(dropboxInfo, useOAuth20: dropboxInfo.OAuthVersion == 2);
                }

                message = String.Format(CultureInfo.CurrentCulture,
                            Resources.Dropbox_Synchronized,
                            deployInfo.Deltas.Count);
            }
            catch (Exception)
            {
                message = String.Format(CultureInfo.CurrentCulture,
                            Resources.Dropbox_SynchronizedWithFailure,
                            _successCount,
                            deployInfo.Deltas.Count,
                            _failedCount);

                throw;
            }
            finally
            {
                Logger.Log(message);

                Logger.Log(String.Format("{0} downloaded files, {1} successful retries.", _fileCount, _retriedCount));

                IDeploymentStatusFile statusFile = _status.Open(dropboxInfo.TargetChangeset.Id);
                statusFile.UpdateMessage(message);
                statusFile.UpdateProgress(String.Format(CultureInfo.CurrentCulture, Resources.Dropbox_Committing, _successCount));

                // Commit anyway even partial change
                if (repository.Commit(message, String.Format("{0} <{1}>", deployInfo.UserName, deployInfo.Email ?? deployInfo.UserName)))
                {
                    changeSet = repository.GetChangeSet("HEAD");
                }
            }

            // Save new dropboc cursor
            LogInfo("Update dropbox cursor");
            _settings.SetValue(CursorKey, deployInfo.NewCursor);

            return changeSet;
        }
开发者ID:albertjan,项目名称:kudu,代码行数:79,代码来源:DropboxHelper.cs

示例10: FeedTheRepository

        private static void FeedTheRepository(IRepository repo)
        {
            string fullPath = Touch(repo.Info.WorkingDirectory, "a.txt", "Hello\n");
            repo.Stage(fullPath);
            repo.Commit("Initial commit", Constants.Signature, Constants.Signature);
            repo.ApplyTag("mytag");

            File.AppendAllText(fullPath, "World\n");
            repo.Stage(fullPath);

            Signature shiftedSignature = Constants.Signature.TimeShift(TimeSpan.FromMinutes(1));
            repo.Commit("Update file", shiftedSignature, shiftedSignature);
            repo.CreateBranch("mybranch");

            repo.Checkout("mybranch");

            Assert.False(repo.RetrieveStatus().IsDirty);
        }
开发者ID:nulltoken,项目名称:libgit2sharp,代码行数:18,代码来源:ResetHeadFixture.cs

示例11: AddCommitToRepo

        private Commit AddCommitToRepo(IRepository repository)
        {

            string random = Guid.NewGuid().ToString();
            string filename = random + ".txt";

            Touch(repository.Info.WorkingDirectory, filename, random);

            repository.Index.Stage(filename);

            return repository.Commit("New commit", Constants.Signature, Constants.Signature);
        }
开发者ID:AndersKroghDk,项目名称:libgit2sharp,代码行数:12,代码来源:PushFixture.cs


注:本文中的IRepository.Commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。