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


C# IRepository.RetrieveStatus方法代码示例

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


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

示例1: IndexViewModel

        public IndexViewModel(IRepository repo)
        {
            this.repo = repo;
            this.refreshCommand = ReactiveCommand.Create();

            this.repositoryStatus = this.refreshCommand.Select(u =>
            {
                return repo.RetrieveStatus(new StatusOptions() { Show = StatusShowOption.IndexAndWorkDir });
            }).ToProperty(this, vm => vm.RepositoryStatus);

            this.statusEntries = this
                .WhenAny(vm => vm.RepositoryStatus, change =>
                {
                    var status = change.GetValue();

                    return status.CreateDerivedCollection(s => s, null, null, null, this.refreshCommand);
                }).ToProperty(this, vm => vm.StatusEntries);

            var resetSignal = this.WhenAny(vm => vm.StatusEntries, change =>
             {
                 return 0;
             });

            var allEntries = this.WhenAny(vm => vm.StatusEntries, change => change.GetValue());

            this.unstagedEntries = allEntries.Select(s =>
            {
                return s.CreateDerivedCollection(i => i, i => Unstaged(i.State), null, resetSignal);
            }).ToProperty(this, vm => vm.UnstagedEntries);

            this.stagedEntries = allEntries.Select(s =>
            {
                return s.CreateDerivedCollection(i => i, i => Staged(i.State), null, resetSignal);
            }).ToProperty(this, vm => vm.StagedEntries);
        }
开发者ID:abbottdev,项目名称:gitreminder,代码行数:35,代码来源:IndexViewModel.cs

示例2: Model

        public Model(IRepository repository)
        {
            mRepository = repository;

            mRevision = new Lazy<string>(() => mRepository.Commits.Count().ToString(CultureInfo.InvariantCulture));
            mShortHash = new Lazy<string>(() => mRepository.Commits.Last().Sha.Substring(0, 7));
            mBranch = new Lazy<string>(() => mRepository.Head.CanonicalName);
            mHasLocalChange = new Lazy<string>(() => mRepository.RetrieveStatus().IsDirty.ToString(CultureInfo.InvariantCulture));
            #if DEBUG
            mBuildConfig = "DEBUG";
            #else
            mBuildConfig = "RELEASE";
            #endif
        }
开发者ID:jrgcubano,项目名称:NAsync,代码行数:14,代码来源:Model.cs

示例3: AssertStatus

 private static void AssertStatus(bool shouldIgnoreCase, FileStatus expectedFileStatus, IRepository repo, string path)
 {
     try
     {
         Assert.Equal(expectedFileStatus, repo.RetrieveStatus(path));
     }
     catch (ArgumentException)
     {
         Assert.False(shouldIgnoreCase);
     }
 }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:11,代码来源:StatusFixture.cs

示例4: RemoveStagedItems

        private static IEnumerable<string> RemoveStagedItems(IRepository repository, IEnumerable<string> paths, bool removeFromWorkingDirectory = true, ExplicitPathsOptions explicitPathsOptions = null)
        {
            var removed = new List<string>();
            using (var changes = repository.Diff.Compare<TreeChanges>(DiffModifiers.IncludeUnmodified | DiffModifiers.IncludeUntracked, paths, explicitPathsOptions))
            {
                var index = repository.Index;

                foreach (var treeEntryChanges in changes)
                {
                    var status = repository.RetrieveStatus(treeEntryChanges.Path);

                    switch (treeEntryChanges.Status)
                    {
                        case ChangeKind.Added:
                        case ChangeKind.Deleted:
                            removed.Add(treeEntryChanges.Path);
                            index.Remove(treeEntryChanges.Path);
                            break;

                        case ChangeKind.Unmodified:
                            if (removeFromWorkingDirectory && (
                                status.HasFlag(FileStatus.ModifiedInIndex) ||
                                status.HasFlag(FileStatus.NewInIndex)))
                            {
                                throw new RemoveFromIndexException("Unable to remove file '{0}', as it has changes staged in the index. You can call the Remove() method with removeFromWorkingDirectory=false if you want to remove it from the index only.",
                                    treeEntryChanges.Path);
                            }
                            removed.Add(treeEntryChanges.Path);
                            index.Remove(treeEntryChanges.Path);
                            continue;

                        case ChangeKind.Modified:
                            if (status.HasFlag(FileStatus.ModifiedInWorkdir) && status.HasFlag(FileStatus.ModifiedInIndex))
                            {
                                throw new RemoveFromIndexException("Unable to remove file '{0}', as it has staged content different from both the working directory and the HEAD.",
                                    treeEntryChanges.Path);
                            }
                            if (removeFromWorkingDirectory)
                            {
                                throw new RemoveFromIndexException("Unable to remove file '{0}', as it has local modifications. You can call the Remove() method with removeFromWorkingDirectory=false if you want to remove it from the index only.",
                                    treeEntryChanges.Path);
                            }
                            removed.Add(treeEntryChanges.Path);
                            index.Remove(treeEntryChanges.Path);
                            continue;

                        default:
                            throw new RemoveFromIndexException("Unable to remove file '{0}'. Its current status is '{1}'.",
                                treeEntryChanges.Path,
                                treeEntryChanges.Status);
                    }
                }

                index.Write();

                return removed;
            }
        }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:58,代码来源:Remove.cs

示例5: GitModifications

 /// <summary>
 /// Get a value indicating if there are modifications in the current working directory.
 /// </summary>
 private void GitModifications(IRepository repo)
 {
     var status = repo.RetrieveStatus(new StatusOptions());
     this.gitInfo.Added = status.Added.Count();
     this.gitInfo.Missing = status.Missing.Count();
     this.gitInfo.Modified = status.Modified.Count();
     this.gitInfo.Removed = status.Removed.Count();
     this.gitInfo.Staged = status.Staged.Count();
     this.gitInfo.Changes = this.gitInfo.Added + this.gitInfo.Missing + this.gitInfo.Modified
                            + this.gitInfo.Removed + this.gitInfo.Staged;
     this.gitInfo.HasModifications = Convert.ToBoolean(this.gitInfo.Changes);
 }
开发者ID:Torion,项目名称:Itchy,代码行数:15,代码来源:GitEmulation.cs

示例6: 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

示例7: AssertStage

 private static void AssertStage(bool? ignorecase, IRepository repo, string path)
 {
     try
     {
         repo.Stage(path);
         Assert.Equal(FileStatus.Added, repo.RetrieveStatus(path));
         repo.Reset();
         Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(path));
     }
     catch (ArgumentException)
     {
         Assert.False(ignorecase ?? true);
     }
 }
开发者ID:beulah444,项目名称:libgit2sharp,代码行数:14,代码来源:StageFixture.cs

示例8: AssertStage

 private static void AssertStage(bool? ignorecase, IRepository repo, string path)
 {
     try
     {
         Commands.Stage(repo, path);
         Assert.Equal(FileStatus.NewInIndex, repo.RetrieveStatus(path));
         repo.Index.Replace(repo.Head.Tip);
         Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(path));
     }
     catch (ArgumentException)
     {
         Assert.False(ignorecase ?? true);
     }
 }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:14,代码来源:StageFixture.cs

示例9: BuildFrom

 private static Tuple<string, FileStatus> BuildFrom(IRepository repository, string path)
 {
     string relativePath = repository.BuildRelativePathFrom(path);
     return new Tuple<string, FileStatus>(relativePath, repository.RetrieveStatus(relativePath));
 }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:5,代码来源:Stage.cs


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