• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NGit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RepositoryStatus

		internal RepositoryStatus(NGit.Repository repository, IEnumerable<string> singleFiles, string rootDir, bool recursive)
		{
			Repository = repository;
			_root_path = rootDir;
			_recursive = recursive;
			_file_paths = singleFiles;
			Update();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:8,代码来源:RepositoryStatus.cs


示例2: RepositoryStatus

		internal RepositoryStatus(NGit.Repository repository, string singleFile, string rootDir, bool recursive)
		{
			Repository = repository;
			_root_path = rootDir;
			_recursive = recursive;
			_file_path = singleFile;
			Update();
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:8,代码来源:RepositoryStatus.cs


示例3: RebaseOperation

		public RebaseOperation (NGit.Repository repo, string upstreamRef, IProgressMonitor monitor)
		{
			this.monitor = monitor;
			this.repo = repo;
			this.upstreamRef = upstreamRef;
			rw = new RevWalk (repo);
			branch = repo.GetBranch ();
			starting = true;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:9,代码来源:RebaseOperation.cs


示例4: CompareCommits

		/// <summary>
		/// Compares two commits and returns a list of files that have changed
		/// </summary>
		public static IEnumerable<DiffEntry> CompareCommits (NGit.Repository repo, RevCommit reference, RevCommit compared)
		{
			var changes = new List<DiffEntry>();
			if (reference == null && compared == null)
				return changes;
			ObjectId refTree = (reference != null ? reference.Tree.Id : ObjectId.ZeroId);
			ObjectId comparedTree = (compared != null ? compared.Tree.Id : ObjectId.ZeroId);
			return CompareCommits (repo, refTree, comparedTree);
		}
开发者ID:llucenic,项目名称:monodevelop,代码行数:12,代码来源:GitUtil.cs


示例5: GetCommitChanges

		/// <summary>
		/// Returns a list of files that have changed in a commit
		/// </summary>
		public static IEnumerable<Change> GetCommitChanges (NGit.Repository repo, RevCommit commit)
		{
			var treeIds = new[] { commit.Tree.Id }.Concat (commit.Parents.Select (c => c.Tree.Id)).ToArray ();
			var walk = new TreeWalk (repo);
			walk.Reset (treeIds);
			walk.Recursive = true;
			walk.Filter = AndTreeFilter.Create (AndTreeFilter.ANY_DIFF, AndTreeFilter.ALL);
			
			return CalculateCommitDiff (repo, walk, new[] { commit }.Concat (commit.Parents).ToArray ());
		}
开发者ID:joaonunesk,项目名称:monodevelop,代码行数:13,代码来源:GitUtil.cs


示例6: Configure

        /// <summary>
        /// 設定
        /// </summary>
        /// <param name="hc">ホスト</param>
        /// <param name="session">セッション</param>
        protected override void Configure(NGit.Transport.OpenSshConfig.Host hc, NSch.Session session)
        {
            var config = new Properties();

            config["StrictHostKeyChecking"] = "no";
            config["PreferredAuthentications"] = "publickey";
            session.SetConfig(config);

            var jsch = this.GetJSch(hc, FS.DETECTED);
            jsch.AddIdentity("KeyPair", Encoding.UTF8.GetBytes(PrivateKey), Encoding.UTF8.GetBytes(PublicKey), null);
        }
开发者ID:takanemu,项目名称:BluePlumGit,代码行数:16,代码来源:MainWindowModel.cs


示例7: GetJSch

        protected override NSch.JSch GetJSch(OpenSshConfig.Host hc, NGit.Util.FS fs)
        {
            var jsch = base.GetJSch(hc, fs);

            foreach (var certificate in GitCertificates.GetAllCertificates())
            {
                jsch.AddIdentity(certificate.Path);
            }

            // Set the known hosts file.

            jsch.SetKnownHosts(GetKnownHostsFilename());

            return jsch;
        }
开发者ID:pvginkel,项目名称:VisualGit,代码行数:15,代码来源:SshSessionFactory.cs


示例8: GetConflictedFiles

		public static List<string> GetConflictedFiles (NGit.Repository repo)
		{
			List<string> list = new List<string> ();
			TreeWalk treeWalk = new TreeWalk (repo);
			treeWalk.Reset ();
			treeWalk.Recursive = true;
			DirCache dc = repo.ReadDirCache ();
			treeWalk.AddTree (new DirCacheIterator (dc));
			while (treeWalk.Next()) {
				DirCacheIterator dirCacheIterator = treeWalk.GetTree<DirCacheIterator>(0);
				var ce = dirCacheIterator.GetDirCacheEntry ();
				if (ce != null && ce.Stage == 1)
					list.Add (ce.PathString);
			}
			return list;
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:16,代码来源:GitUtil.cs


示例9: CompareCommits

		/// <summary>
		/// Compares two commits and returns a list of files that have changed
		/// </summary>
		public static IEnumerable<Change> CompareCommits (NGit.Repository repo, RevCommit reference, RevCommit compared)
		{
			var changes = new List<Change>();
			if (reference == null && compared == null)
				return changes;
			ObjectId refTree = (reference != null ? reference.Tree.Id : ObjectId.ZeroId);
			ObjectId comparedTree = (compared != null ? compared.Tree.Id : ObjectId.ZeroId);
			var walk = new TreeWalk (repo);
			if (reference == null || compared == null)
				walk.Reset ((reference ?? compared).Tree.Id);
			else
				walk.Reset (new AnyObjectId[] {refTree, comparedTree});
			walk.Recursive = true;
			walk.Filter = AndTreeFilter.Create(TreeFilter.ANY_DIFF, TreeFilter.ALL);

			return CalculateCommitDiff (repo, walk, new[] { reference, compared });
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:20,代码来源:GitUtil.cs


示例10: BundleFetchConnection

		/// <exception cref="NGit.Errors.TransportException"></exception>
		internal BundleFetchConnection(NGit.Transport.Transport transportBundle, InputStream
			 src)
		{
			transport = transportBundle;
			bin = new BufferedInputStream(src);
			try
			{
				switch (ReadSignature())
				{
					case 2:
					{
						ReadBundleV2();
						break;
					}

					default:
					{
						throw new TransportException(transport.uri, JGitText.Get().notABundle);
					}
				}
			}
			catch (TransportException err)
			{
				Close();
				throw;
			}
			catch (IOException err)
			{
				Close();
				throw new TransportException(transport.uri, err.Message, err);
			}
			catch (RuntimeException err)
			{
				Close();
				throw new TransportException(transport.uri, err.Message, err);
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:38,代码来源:BundleFetchConnection.cs


示例11: IdEqual

		/// <summary>Check if the current entry of both iterators has the same id.</summary>
		/// <remarks>
		/// Check if the current entry of both iterators has the same id.
		/// <p>
		/// This method is faster than
		/// <see cref="EntryObjectId()">EntryObjectId()</see>
		/// as it does not
		/// require copying the bytes out of the buffers. A direct
		/// <see cref="IdBuffer()">IdBuffer()</see>
		/// compare operation is performed.
		/// </remarks>
		/// <param name="otherIterator">the other iterator to test against.</param>
		/// <returns>true if both iterators have the same object id; false otherwise.</returns>
		public virtual bool IdEqual(NGit.Treewalk.AbstractTreeIterator otherIterator)
		{
			return ObjectId.Equals(IdBuffer, IdOffset, otherIterator.IdBuffer, otherIterator.
				IdOffset);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:18,代码来源:AbstractTreeIterator.cs


示例12: AlreadyMatch

		private static int AlreadyMatch(NGit.Treewalk.AbstractTreeIterator a, NGit.Treewalk.AbstractTreeIterator
			 b)
		{
			for (; ; )
			{
				NGit.Treewalk.AbstractTreeIterator ap = a.parent;
				NGit.Treewalk.AbstractTreeIterator bp = b.parent;
				if (ap == null || bp == null)
				{
					return 0;
				}
				if (ap.matches == bp.matches)
				{
					return a.pathOffset;
				}
				a = ap;
				b = bp;
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:19,代码来源:AbstractTreeIterator.cs


示例13: PathCompare

		internal virtual int PathCompare(NGit.Treewalk.AbstractTreeIterator p, int pMode)
		{
			// Its common when we are a subtree for both parents to match;
			// when this happens everything in path[0..cPos] is known to
			// be equal and does not require evaluation again.
			//
			int cPos = AlreadyMatch(this, p);
			return PathCompare(p.path, cPos, p.pathLen, pMode, cPos);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:AbstractTreeIterator.cs


示例14: AbstractTreeIterator

		/// <summary>Create an iterator for a subtree of an existing iterator.</summary>
		/// <remarks>
		/// Create an iterator for a subtree of an existing iterator.
		/// <p>
		/// The caller is responsible for setting up the path of the child iterator.
		/// </remarks>
		/// <param name="p">parent tree iterator.</param>
		/// <param name="childPath">
		/// path array to be used by the child iterator. This path must
		/// contain the path from the top of the walk to the first child
		/// and must end with a '/'.
		/// </param>
		/// <param name="childPathOffset">
		/// position within <code>childPath</code> where the child can
		/// insert its data. The value at
		/// <code>childPath[childPathOffset-1]</code> must be '/'.
		/// </param>
		protected internal AbstractTreeIterator(NGit.Treewalk.AbstractTreeIterator p, byte
			[] childPath, int childPathOffset)
		{
			parent = p;
			path = childPath;
			pathOffset = childPathOffset;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:24,代码来源:AbstractTreeIterator.cs


示例15: InsertCommit

 /// <exception cref="System.IO.IOException"></exception>
 /// <exception cref="Sharpen.UnsupportedEncodingException"></exception>
 private ObjectId InsertCommit(NGit.CommitBuilder builder)
 {
     ObjectInserter oi = db.NewObjectInserter();
     try
     {
         ObjectId id = oi.Insert(builder);
         oi.Flush();
         return id;
     }
     finally
     {
         oi.Release();
     }
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:16,代码来源:T0003_BasicTest.cs


示例16: ShareFreeList

 /// <summary>Reconfigure this queue to share the same free list as another.</summary>
 /// <remarks>
 /// Reconfigure this queue to share the same free list as another.
 /// <p/>
 /// Multiple revision queues can be connected to the same free list, making
 /// it less expensive for applications to shuttle commits between them. This
 /// method arranges for the receiver to take from / return to the same free
 /// list as the supplied queue.
 /// <p/>
 /// Free lists are not thread-safe. Applications must ensure that all queues
 /// sharing the same free list are doing so from only a single thread.
 /// </remarks>
 /// <param name="q">the other queue we will steal entries from.</param>
 internal override void ShareFreeList(NGit.Revwalk.BlockRevQueue q)
 {
     free = q.free;
 }
开发者ID:sharwell,项目名称:ngit,代码行数:17,代码来源:BlockRevQueue.cs


示例17: GetDirectoryVersionInfoCore

		void GetDirectoryVersionInfoCore (NGit.Repository repository, GitRevision rev, FilePath [] localPaths, HashSet<FilePath> existingFiles, HashSet<FilePath> nonVersionedMissingFiles, List<VersionInfo> versions)
		{
			
			var status = new FilteredStatus (repository, repository.ToGitPath (localPaths)).Call (); 
			HashSet<string> added = new HashSet<string> ();
			Action<IEnumerable<string>, VersionStatus> AddFiles = delegate(IEnumerable<string> files, VersionStatus fstatus) {
				foreach (string file in files) {
					if (!added.Add (file))
						continue;
					FilePath statFile = repository.FromGitPath (file);
					existingFiles.Remove (statFile.CanonicalPath);
					nonVersionedMissingFiles.Remove (statFile.CanonicalPath);
					versions.Add (new VersionInfo (statFile, "", false, fstatus, rev, VersionStatus.Versioned, null));
				}
			};
			
			AddFiles (status.GetAdded (), VersionStatus.Versioned | VersionStatus.ScheduledAdd);
			AddFiles (status.GetChanged (), VersionStatus.Versioned | VersionStatus.Modified);
			AddFiles (status.GetModified (), VersionStatus.Versioned | VersionStatus.Modified);
			AddFiles (status.GetRemoved (), VersionStatus.Versioned | VersionStatus.ScheduledDelete);
			AddFiles (status.GetMissing (), VersionStatus.Versioned | VersionStatus.ScheduledDelete);
			AddFiles (status.GetConflicting (), VersionStatus.Versioned | VersionStatus.Conflicted);
			AddFiles (status.GetUntracked (), VersionStatus.Unversioned);
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:24,代码来源:GitRepository.cs


示例18: GetHeadCommit

		RevCommit GetHeadCommit (NGit.Repository repository)
		{
			RevWalk rw = new RevWalk (repository);
			ObjectId headId = repository.Resolve (Constants.HEAD);
			if (headId == null)
				return null;
			return rw.ParseCommit (headId);
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:8,代码来源:GitRepository.cs


示例19: GitRevision

		public GitRevision (Repository repo, NGit.Repository gitRepository, string rev) : base(repo)
		{
			this.rev = rev;
			GitRepository = gitRepository;
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:5,代码来源:GitRepository.cs


示例20: GetRawText

		static RawText GetRawText(NGit.Repository repo, string file, RevCommit commit) {
			TreeWalk tw = TreeWalk.ForPath (repo, file, commit.Tree);
			ObjectId objectID = tw.GetObjectId(0);
			byte[] data = repo.ObjectDatabase.Open (objectID).GetBytes ();
			return new RawText (data);
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:6,代码来源:GitUtil.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NHExt类代码示例发布时间:2022-05-24
下一篇:
C# Common.ResultModel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap