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


C# Git.SetName方法代码示例

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


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

示例1: SwitchToBranch

		public void SwitchToBranch (IProgressMonitor monitor, string branch)
		{
			monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), GitService.StashUnstashWhenSwitchingBranches ? 4 : 2);
			
			// Get a list of files that are different in the target branch
			IEnumerable<DiffEntry> statusList = GitUtil.GetChangedFiles (RootRepository, branch);
			
			StashCollection stashes = null;
			Stash stash = null;
			
			if (GitService.StashUnstashWhenSwitchingBranches) {
				stashes = GitUtil.GetStashes (RootRepository);
				
				// Remove the stash for this branch, if exists
				string currentBranch = GetCurrentBranch ();
				stash = GetStashForBranch (stashes, currentBranch);
				if (stash != null)
					stashes.Remove (stash);
				
				// Create a new stash for the branch. This allows switching branches
				// without losing local changes
				using (var gm = new GitMonitor (monitor))
					stash = stashes.Create (gm, GetStashName (currentBranch));
			
				monitor.Step (1);
			}

			// Replace with NGit.Api.Git ().Checkout ()
			// Switch to the target branch
			var checkout = new NGit.Api.Git (RootRepository).Checkout ();
			checkout.SetName (branch);
			try {
				checkout.Call ();
			} finally {
				// Restore the branch stash
				if (GitService.StashUnstashWhenSwitchingBranches) {
					stash = GetStashForBranch (stashes, branch);
					if (stash != null) {
						using (var gm = new GitMonitor (monitor))
							stash.Apply (gm);
						stashes.Remove (stash);
					}
					monitor.Step (1);
				}
			}
			// Notify file changes
			
			NotifyFileChanges (monitor, statusList);
			
			if (BranchSelectionChanged != null)
				BranchSelectionChanged (this, EventArgs.Empty);
			
			monitor.EndTask ();
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:54,代码来源:GitRepository.cs

示例2: CreateBranch

		public void CreateBranch (string name, string trackSource)
		{
			var create = new NGit.Api.Git (RootRepository).BranchCreate ();
			if (!String.IsNullOrEmpty (trackSource))
				create.SetStartPoint (trackSource);
			create.SetName (name);
			create.Call ();
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:8,代码来源:GitRepository.cs

示例3: AddTag

		public void AddTag (string name, Revision rev, string message)
		{
			var addTag = new NGit.Api.Git (RootRepository).Tag ();
			var gitRev = (GitRevision)rev;

			addTag.SetName (name).SetMessage (message).SetObjectId (gitRev.Commit);
			addTag.SetObjectId (gitRev.Commit).SetTagger (new PersonIdent (RootRepository));
			addTag.Call ();
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:9,代码来源:GitRepository.cs

示例4: CreateBranchFromCommit

		public void CreateBranchFromCommit (string name, RevCommit id)
		{
			var create = new NGit.Api.Git (RootRepository).BranchCreate ();
			if (id != null)
				create.SetStartPoint (id);
			create.SetName (name);
			create.Call ();
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:8,代码来源:GitRepository.cs


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