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


C# Repository.Get方法代码示例

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


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

示例1: GetChanges

        public static IEnumerable<Change> GetChanges(string path, string firstIdentifier, string secondIdentifier, string repositoryPath = "Backend.git")
        {
            var repo = new Repository(repositoryPath);

            var firstCommit = repo.Get<Commit>(firstIdentifier);
            var secondCommit = repo.Get<Commit>(secondIdentifier);
            if (firstCommit == null || secondCommit == null) return null;

            return secondCommit.CompareAgainst(firstCommit).ToArray();
        }
开发者ID:pdelvo,项目名称:MarkdownTemplateGitServer,代码行数:10,代码来源:GitBackend.cs

示例2: access_git_objects

 public void access_git_objects()
 {
     // standard access of git objects, supported by gitsharp.core
     using (var repo = new Repository(@"L:\Documents and Settings\All Users\Application Data\Smeedee_dummy"))
     {
         Assert.IsTrue(repo.Get<Commit>("master").IsCommit);
         (repo.Get<Branch>("master")).ShouldNotBeNull();
         (repo.Get<Branch>("master").Target).ShouldNotBeNull();
         Assert.IsTrue(repo.Get<Commit>("HEAD^^").IsCommit);
         /*
         Assert.IsTrue(repo.Get<Tag>("A").IsTag);
         Assert.IsTrue(repo.Get<Branch>("a").Target.IsCommit);
         Assert.IsTrue(repo.Get<Commit>("a").IsCommit);
         Assert.IsTrue(repo.Get<Commit>("prefix/a").IsCommit);
         Assert.IsTrue(repo.Get<Commit>("68cb1f232964f3cd698afc1dafe583937203c587").IsCommit);
         Assert.NotNull(repo.Get<Blob>("a")); // <--- returns a blob containing the raw representation of tree "a" on master
         Assert.IsTrue(repo.Get<Tree>("a").IsTree); // <--- there is a directory "a" on master
         Assert.IsTrue(repo.Get<Tree>("a/").IsTree);
         Assert.NotNull(repo.Get<Blob>("a/a1"));
         Assert.NotNull(repo.Get<Leaf>("a/a1"));*/
     }
 }
开发者ID:flyrev,项目名称:Smeedee_git_plugin,代码行数:22,代码来源:AccessGitObjects.cs

示例3: GetTemplate

        public static string GetTemplate(string path, string repository = "Backend.git", string branch = "template")
        {
            var repo = new Repository(repository);

            var commit = repo.Get<Commit>(branch);
            if (commit == null) return null;
            var blob = commit.Tree[path];

            if (blob == null || !blob.IsBlob)
            {
                return null;
            }

            return new Blob(repo, blob.Hash).Data;
        }
开发者ID:pdelvo,项目名称:MarkdownTemplateGitServer,代码行数:15,代码来源:Template.cs

示例4: GetData

        public static Blob GetData(string path, string identifier, string repositoryPath = "Backend.git")
        {
            var repo = new Repository(repositoryPath);

            var commit = repo.Get<Commit>(identifier);
            if (commit == null) return null;
            var blob = commit.Tree[path];

            if (blob == null || !blob.IsBlob)
            {
                return null;
            }

            return new Blob(repo, blob.Hash);
        }
开发者ID:pdelvo,项目名称:MarkdownTemplateGitServer,代码行数:15,代码来源:GitBackend.cs

示例5: see_if_we_get_a_not_disposed_warning

        public void see_if_we_get_a_not_disposed_warning()
        {
            Repository repository = new Repository(_localDirectory_cloned);
            var head = repository.Get<Commit>("HEAD");
            var log = new Collection<Commit>();

            Console.WriteLine(head.Message);
            log.Add(head);
            log.Add(head.Parent);

            for (int i=0; i<log.Count(); i++)
                Console.WriteLine(log.ElementAt(i).Message);

            GitChangesetRepository gcr = new GitChangesetRepository(_localDirectory_cloned);
            var testGet = gcr.Get(new ChangesetsAfterRevisionSpecification(65));
        }
开发者ID:flyrev,项目名称:Smeedee_git_plugin,代码行数:16,代码来源:GitSharpDisposeRepositoryTest.cs

示例6: GetHistory

        public static IEnumerable<Commit> GetHistory(string path, string identifier, string repositoryPath = "Backend.git")
        {
            var repo = new Repository(repositoryPath);

            var commit = repo.Get<Commit>(identifier);
            if (commit == null) yield break;

            while (commit != null)
            {
                if (commit.Tree[path] != null)
                {
                    yield return commit;
                }
                commit = commit.HasParents ? commit.Parent : null;
            }
        }
开发者ID:pdelvo,项目名称:MarkdownTemplateGitServer,代码行数:16,代码来源:GitBackend.cs

示例7: FillFromRepository

        public void FillFromRepository(Repository repository, RepositoryNavigationRequest request)
        {
            Branches.AddRange(repository.Branches.Keys.Select(x =>
                new BranchViewModel(x, new RepositoryNavigationRequest()
                {
                    RepositoryName = request.RepositoryName,
                    Treeish = x,
                    RepositoryLocation = request.RepositoryLocation
                })));

            Tags.AddRange(repository.Tags.Keys.Select(x =>
                new BranchViewModel(x, new RepositoryNavigationRequest()
                {
                    RepositoryName = request.RepositoryName,
                    Treeish = x,
                    RepositoryLocation = request.RepositoryLocation
                })));

            var obj = repository.Get<AbstractObject>(Treeish);

            if (obj.IsTag)
            {
                obj = (obj as Tag).Target;
            }

            if (obj.IsCommit)
            {
                CurrentCommit = new CommitViewModel(repository, request, obj as Commit, true);
            }
        }
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:30,代码来源:RepositoryNavigationViewModelBase.cs


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