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


C# GitSharp.Repository类代码示例

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


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

示例1: Index

        public ActionResult Index()
        {
            var dirs = Directory.GetDirectories(_settings.RepositoryRootPath);
            var viewModel = new RepositoriesViewModel { List = new List<RepositoryViewModel>() };
            foreach (string path in dirs)
            {
                var isValid = Repository.IsValid(path);
                if (isValid)
                {
                    using (var repo = new Repository(path))
                    {
                        viewModel.List.Add(new RepositoryViewModel
                        {
                            Name = repo.IsBare ? Path.GetFileName(repo.Directory.TrimGit())
                            : Path.GetFileName(path.TrimGit()),
                            Description = repo.Directory,
                            Path = repo.Directory,
                            CurrentCommit = repo.Branches["master"].CurrentCommit
                        });
                    }
                }

            }

            return View(viewModel);
        }
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:26,代码来源:HomeController.cs

示例2: LoadBackupList

        public void LoadBackupList(WorldSave save)
        {
            backupView.Items.Clear();

            if (!Repository.IsValid(save.Path))
                return;

            using (Repository repo = new Repository(save.Path))
            {
                foreach (Commit commit in repo.CurrentBranch.CurrentCommit.Ancestors)
                {
                    DateTime commitTime = commit.CommitDate.LocalDateTime;

                    ListViewItem item = new ListViewItem(commit.Message);
                    ListViewItem.ListViewSubItem dateItem = item.SubItems.Add(
                        commitTime.ToString());
                    dateItem.Name = "date";

                    ListViewItem.ListViewSubItem hashItem =
                        item.SubItems.Add(commit.ShortHash);
                    hashItem.Name = "shorthash";

                    ListViewItem.ListViewSubItem longHashItem =
                        item.SubItems.Add(commit.Hash);
                    longHashItem.Name = "hash";

                    backupView.Items.Add(item);
                }
            }
        }
开发者ID:Glought,项目名称:MultiMC,代码行数:30,代码来源:RestoreBackupDialog.cs

示例3: ReflogReader

 ///	<summary>
 /// Parsed reflog entry.
 /// </summary>
 public ReflogReader(Repository db, string refName)
 {
     _logName = new FileInfo(
         Path.Combine(
             db.Directory.FullName,
                 Path.Combine("logs", refName)).Replace('/', Path.DirectorySeparatorChar));
 }
开发者ID:drothmaler,项目名称:GitSharp,代码行数:10,代码来源:ReflogReader.cs

示例4: LoadRepository

 private void LoadRepository()
 {
     if (!Directory.Exists(Path.Combine(ResourceLocation, ".git"))) {
         Git.Init(ResourceLocation);
     }
     Repo = new Repository(ResourceLocation);
 }
开发者ID:CloneDeath,项目名称:FantasyScape,代码行数:7,代码来源:ResourceManager.cs

示例5: SetupContext

 protected void SetupContext()
 {
     _nicolai = new Author("Nicolai Meltveit", "[email protected]");
     _repositoryUrl = "git://github.com/flyrev/Smeedee_dummy.git";
     _localDirectory = "C:\\ennå_nyare\\";
     _repo = new Repository(_localDirectory);
 }
开发者ID:flyrev,项目名称:Smeedee_git_plugin,代码行数:7,代码来源:ChangesetRepositorySpecs.cs

示例6: ObjectWriter

 ///	<summary>
 /// Construct an object writer for the specified repository.
 /// </summary>
 ///	<param name="repo"> </param>
 public ObjectWriter(Repository repo)
 {
     _r = repo;
     _buf = new byte[0x2000];
     _md = new MessageDigest();
     _def = new Deflater(_r.Config.getCore().getCompression());
 }
开发者ID:drothmaler,项目名称:GitSharp,代码行数:11,代码来源:ObjectWriter.cs

示例7: ObjectWriter

 public ObjectWriter(Repository repo)
 {
     this.r = repo;
     buf = new byte[8192];
     md = new MessageDigest(); // [henon] Sha1 hash digest generator
     def = new Deflater(r.Config.Core.Compression);
 }
开发者ID:ArildF,项目名称:GitSharp,代码行数:7,代码来源:ObjectWriter.cs

示例8: Index

 public Index(Repository repo)
 {
     _repo = repo;
     //GitIndex.FilenameEncoding = repo.PreferredEncoding;
     //if (_repo.PreferredEncoding != Encoding.UTF8 && _repo.PreferredEncoding != Encoding.Default)
     //   GitIndex.FilenameEncoding = Encoding.Default;
 }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:7,代码来源:Index.cs

示例9: GetGitDetail

        /// <summary>
        /// TODO: only get GitDetail on Project level?
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static GitDetail GetGitDetail(string path)
        {
            GitDetail detail = null;
            if (string.IsNullOrEmpty(path)) return detail;
            try
            {
                var repoPath = Repository.FindRepository(path);
                if (string.IsNullOrEmpty(repoPath)) return detail;

                var repo = new Repository(repoPath);

                detail = new GitDetail();
                // Convert to forward slash
                detail.LocalWorkingDirectory = repo.WorkingDirectory.BackSlashToForwardSlash();
                if (repo.Head == null) return detail;

                var branch = repo.CurrentBranch;
                detail.RemoteRepositoryUrl = repo.Config["remote.origin.url"];
                detail.RemoteBranch = branch.Name;
                // detail.Description = repo.Head.CurrentCommit.ShortHash;
                detail.RelativePath = PathUtility.MakeRelativePath(Path.GetDirectoryName(repoPath), path);
            }
            catch (Exception)
            {
                // SWALLOW exception?
                // Console.Error.WriteLine(e.Message);
            }

            return detail;
        }
开发者ID:yonglehou,项目名称:docfx,代码行数:35,代码来源:GitUtility.cs

示例10: RefDatabase

 public RefDatabase(Repository repo)
 {
     Repository = repo;
     _gitDir = repo.Directory;
     _refsDir = PathUtil.CombineDirectoryPath(_gitDir, "refs");
     _packedRefsFile = PathUtil.CombineFilePath(_gitDir, "packed-refs");
     ClearCache();
 }
开发者ID:Squelch,项目名称:GitSharp,代码行数:8,代码来源:RefDatabase.cs

示例11: PersonIdent

        private readonly int tzOffset; // offset in minutes to UTC

        #endregion Fields

        #region Constructors

        ///	<summary>
        /// Creates new PersonIdent from config info in repository, with current time.
        ///	This new PersonIdent gets the info from the default committer as available
        ///	from the configuration.
        ///	</summary>
        ///	<param name="repo"></param>
        public PersonIdent(Repository repo)
        {
            RepositoryConfig config = repo.Config;
            string username = config.getString("user", null, "name");
            string email = config.getString("user", null, "email");
            Name = username;
            EmailAddress = email;
        }
开发者ID:drothmaler,项目名称:GitSharp,代码行数:20,代码来源:PersonIdent.cs

示例12: WorkDirCheckout

 ///	<summary>
 /// Create a checkout class for checking out one tree, merging with the index
 ///	</summary>
 ///	<param name="repo"> </param>
 ///	<param name="root"> workdir </param>
 ///	<param name="index"> current index </param>
 ///	<param name="merge"> tree to check out </param>
 public WorkDirCheckout(Repository repo, FileSystemInfo root, GitIndex index, Tree merge)
     : this()
 {
     this._repo = repo;
     this._root = root;
     this._index = index;
     this._merge = merge;
 }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:15,代码来源:WorkDirCheckout.cs

示例13: Versioning

        public Versioning(Data data, GitSharp.Repository repo)
        {
            GitDetails = null;
            InitializeComponent();
            VersionControlData = data;
            _repo = repo;

            LoadFileStructure();
        }
开发者ID:naztrain,项目名称:vixen,代码行数:9,代码来源:Versioning.cs

示例14: RepositoryNavigationViewModelBase

 public RepositoryNavigationViewModelBase(Repository repository, RepositoryNavigationRequest request)
     : this()
 {
     RepositoryName = request.RepositoryName;
     Treeish = request.Treeish;
     Path = request.Path;
     RepositoryLocation = request.RepositoryLocation;
     FillFromRepository(repository, request);
 }
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:9,代码来源:RepositoryNavigationViewModelBase.cs

示例15: PersonIdent

 public PersonIdent(Repository repo)
 {
     RepositoryConfig config = repo.Config;
     string username = config.GetString("user", null, "name");
     string email = config.GetString("user", null, "email");
     this.Name = username;
     this.EmailAddress = email;
     this.when_time = DateTimeOffset.Now;
 }
开发者ID:ArildF,项目名称:GitSharp,代码行数:9,代码来源:PersonIdent.cs


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